Skip to content

Commit 204a26a

Browse files
author
Darrick J. Wong
committed
xfs: create a helper to compute the blockcount of a max sized remote value
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 <[email protected]> Reviewed-by: Andrey Albershteyn <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent a5714b6 commit 204a26a

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ xfs_attr_set(
10361036
break;
10371037
case XFS_ATTRUPDATE_REMOVE:
10381038
XFS_STATS_INC(mp, xs_attr_remove);
1039-
rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
1039+
rmt_blks = xfs_attr3_max_rmt_blocks(mp);
10401040
break;
10411041
}
10421042

fs/xfs/libxfs/xfs_attr_remote.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
unsigned int xfs_attr3_rmt_blocks(struct xfs_mount *mp, unsigned int attrlen);
1010

11+
/* Number of rmt blocks needed to store the maximally sized attr value */
12+
static inline unsigned int xfs_attr3_max_rmt_blocks(struct xfs_mount *mp)
13+
{
14+
return xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
15+
}
16+
1117
int xfs_attr_rmtval_get(struct xfs_da_args *args);
1218
int xfs_attr_rmtval_stale(struct xfs_inode *ip, struct xfs_bmbt_irec *map,
1319
xfs_buf_flags_t incore_flags);

fs/xfs/scrub/reap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ xrep_bufscan_max_sectors(
223223
int max_fsbs;
224224

225225
/* Remote xattr values are the largest buffers that we support. */
226-
max_fsbs = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
226+
max_fsbs = xfs_attr3_max_rmt_blocks(mp);
227227

228228
return XFS_FSB_TO_BB(mp, min_t(xfs_extlen_t, fsblocks, max_fsbs));
229229
}
@@ -806,7 +806,7 @@ xreap_bmapi_binval(
806806
* of the next hole.
807807
*/
808808
off = imap->br_startoff + imap->br_blockcount;
809-
max_off = off + xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
809+
max_off = off + xfs_attr3_max_rmt_blocks(mp);
810810
while (off < max_off) {
811811
struct xfs_bmbt_irec hmap;
812812
int nhmaps = 1;

0 commit comments

Comments
 (0)