Skip to content

Commit 5b02a3e

Browse files
author
Darrick J. Wong
committed
xfs: move xattr scrub buffer allocation to top level function
Move the xchk_setup_xattr_buf call from xchk_xattr_block to xchk_xattr, since we only need to set up the leaf block bitmaps once. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
1 parent f58977e commit 5b02a3e

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

fs/xfs/scrub/attr.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -346,18 +346,10 @@ xchk_xattr_block(
346346
unsigned int usedbytes = 0;
347347
unsigned int hdrsize;
348348
int i;
349-
int error;
350349

351350
if (*last_checked == blk->blkno)
352351
return 0;
353352

354-
/* Allocate memory for block usage checking. */
355-
error = xchk_setup_xattr_buf(ds->sc, 0);
356-
if (error == -ENOMEM)
357-
return -EDEADLOCK;
358-
if (error)
359-
return error;
360-
361353
*last_checked = blk->blkno;
362354
bitmap_zero(ab->usedmap, mp->m_attr_geo->blksize);
363355

@@ -507,6 +499,13 @@ xchk_xattr(
507499
if (!xfs_inode_hasattr(sc->ip))
508500
return -ENOENT;
509501

502+
/* Allocate memory for xattr checking. */
503+
error = xchk_setup_xattr_buf(sc, 0);
504+
if (error == -ENOMEM)
505+
return -EDEADLOCK;
506+
if (error)
507+
return error;
508+
510509
memset(&sx, 0, sizeof(sx));
511510
/* Check attribute tree structure */
512511
error = xchk_da_btree(sc, XFS_ATTR_FORK, xchk_xattr_rec,

0 commit comments

Comments
 (0)