On Thu, Jul 09, 2020 at 02:46:09PM +0100, Christoph Hellwig wrote: > 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. Rrrgh, fine, this is going to cause a lot of hell refactoring the whole series a fourth time, but here I go... --D