From: Darrick J. Wong Date: Mon, 29 Jul 2024 23:22:56 +0000 (-0700) Subject: xfs: create a helper to compute the blockcount of a max sized remote value X-Git-Tag: v6.10.0~24^2~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a5ec4d59c3a4c57e3c5a3eaec10997b801808e2e;p=thirdparty%2Fxfsprogs-dev.git xfs: create a helper to compute the blockcount of a max sized remote value 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 Reviewed-by: Andrey Albershteyn Reviewed-by: Christoph Hellwig --- diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 52fcb1c4..99648d78 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -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; } diff --git a/libxfs/xfs_attr_remote.h b/libxfs/xfs_attr_remote.h index c64b04f9..e3c6c7d7 100644 --- a/libxfs/xfs_attr_remote.h +++ b/libxfs/xfs_attr_remote.h @@ -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);