]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: prepare to reuse the dquot pointer space in struct xfs_inode
authorDarrick J. Wong <djwong@kernel.org>
Mon, 24 Feb 2025 18:21:46 +0000 (10:21 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 25 Feb 2025 17:15:57 +0000 (09:15 -0800)
Source kernel commit: 84140a96cf7a5b5b48b862a79c8322aa220ce591

Files participating in the metadata directory tree are not accounted to
the quota subsystem.  Therefore, the i_[ugp]dquot pointers in struct
xfs_inode are never used and should always be NULL.

In the next patch we want to add a u64 count of fs blocks reserved for
metadata btree expansion, but we don't want every inode in the fs to pay
the memory price for this feature.  The intent is to union those three
pointers with the u64 counter, but for that to work we must guard
against all access to the dquot pointers for metadata files.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_attr.c
libxfs/xfs_bmap.c

index 7567014abbe7f0cedb8a0314836dcbad2893bd1b..4b985e054ff84c93015e08a1e960ebd0e292fcd5 100644 (file)
@@ -1003,9 +1003,7 @@ xfs_attr_add_fork(
        unsigned int            blks;           /* space reservation */
        int                     error;          /* error return value */
 
-       if (xfs_is_metadir_inode(ip))
-               ASSERT(XFS_IS_DQDETACHED(ip));
-       else
+       if (!xfs_is_metadir_inode(ip))
                ASSERT(!XFS_NOT_DQATTACHED(mp, ip));
 
        blks = XFS_ADDAFORK_SPACE_RES(mp);
index fcb400bc768c2fdb305920e7383175c09e630d7a..41cfadb51f4937037597fc4576caa48ef2cb988f 100644 (file)
@@ -1036,9 +1036,7 @@ xfs_bmap_add_attrfork(
        int                     error;          /* error return value */
 
        xfs_assert_ilocked(ip, XFS_ILOCK_EXCL);
-       if (xfs_is_metadir_inode(ip))
-               ASSERT(XFS_IS_DQDETACHED(ip));
-       else
+       if (!xfs_is_metadir_inode(ip))
                ASSERT(!XFS_NOT_DQATTACHED(mp, ip));
        ASSERT(!xfs_inode_has_attr_fork(ip));