diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-04-11 19:00:32 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2023-04-11 19:00:32 -0700 |
commit | 5b02a3e8391c703638c5a97513c353aa0c3fd5b0 (patch) | |
tree | 2ab7d01f763d2da4bbee013f4418fdc7514932ff | |
parent | f58977edc0b50bf6aee5a63bff34581b22b2ce63 (diff) | |
download | linux-stable-5b02a3e8391c703638c5a97513c353aa0c3fd5b0.tar.gz linux-stable-5b02a3e8391c703638c5a97513c353aa0c3fd5b0.tar.bz2 linux-stable-5b02a3e8391c703638c5a97513c353aa0c3fd5b0.zip |
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>
-rw-r--r-- | fs/xfs/scrub/attr.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c index 420166336f56..b37de9459dc0 100644 --- a/fs/xfs/scrub/attr.c +++ b/fs/xfs/scrub/attr.c @@ -346,18 +346,10 @@ xchk_xattr_block( unsigned int usedbytes = 0; unsigned int hdrsize; int i; - int error; if (*last_checked == blk->blkno) return 0; - /* Allocate memory for block usage checking. */ - error = xchk_setup_xattr_buf(ds->sc, 0); - if (error == -ENOMEM) - return -EDEADLOCK; - if (error) - return error; - *last_checked = blk->blkno; bitmap_zero(ab->usedmap, mp->m_attr_geo->blksize); @@ -507,6 +499,13 @@ xchk_xattr( if (!xfs_inode_hasattr(sc->ip)) return -ENOENT; + /* Allocate memory for xattr checking. */ + error = xchk_setup_xattr_buf(sc, 0); + if (error == -ENOMEM) + return -EDEADLOCK; + if (error) + return error; + memset(&sx, 0, sizeof(sx)); /* Check attribute tree structure */ error = xchk_da_btree(sc, XFS_ATTR_FORK, xchk_xattr_rec, |