On Sun, Jul 05, 2020 at 03:13:00PM -0700, Darrick J. Wong wrote: > + dtype = ddq->d_flags & XFS_DDQFEAT_TYPE_MASK; > + if (type && dtype != type) > + return __this_address; > + if (dtype != XFS_DDQFEAT_USER && > + dtype != XFS_DDQFEAT_PROJ && > + dtype != XFS_DDQFEAT_GROUP) > return __this_address; Why not use hweight here? > if (id != -1 && id != be32_to_cpu(ddq->d_id)) > @@ -123,7 +128,7 @@ xfs_dqblk_repair( > > dqb->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC); > dqb->dd_diskdq.d_version = XFS_DQUOT_VERSION; > - dqb->dd_diskdq.d_flags = type; > + dqb->dd_diskdq.d_flags = type & XFS_DDQFEAT_TYPE_MASK; And this still mixes up the on-disk and in-memory flags. I think they really need to be separated and kept entirely separate. e.g. rename the d_flags field to d_type in both the on-disk and in-core inode, rename the values to XFS_DQTYPE_*, and then have a separate u8 d_flags just in the in-core inode for just the in-core values.