]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: create a helper to compute the blockcount of a max sized remote value
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:22:56 +0000 (16:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:05 +0000 (17:01 -0700)
Source kernel commit: 204a26aa1d5a891154c9275fe4022e28793ca112

Create a helper function to compute the number of fsblocks needed to
store a maximally-sized extended attribute value.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_attr.c
libxfs/xfs_attr_remote.h

index 52fcb1c4c939757f4e27104a000ae0c7fdd4d32d..99648d78cd041b907a69fffc4c9f4df23e0c5b32 100644 (file)
@@ -1035,7 +1035,7 @@ xfs_attr_set(
                break;
        case XFS_ATTRUPDATE_REMOVE:
                XFS_STATS_INC(mp, xs_attr_remove);
-               rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
+               rmt_blks = xfs_attr3_max_rmt_blocks(mp);
                break;
        }
 
index c64b04f91cafdd717f4568c54266ac54caf136ae..e3c6c7d774bf93e362ed9a54bde6eabab60b817c 100644 (file)
@@ -8,6 +8,12 @@
 
 unsigned int xfs_attr3_rmt_blocks(struct xfs_mount *mp, unsigned int attrlen);
 
+/* Number of rmt blocks needed to store the maximally sized attr value */
+static inline unsigned int xfs_attr3_max_rmt_blocks(struct xfs_mount *mp)
+{
+       return xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
+}
+
 int xfs_attr_rmtval_get(struct xfs_da_args *args);
 int xfs_attr_rmtval_stale(struct xfs_inode *ip, struct xfs_bmbt_irec *map,
                xfs_buf_flags_t incore_flags);