summaryrefslogtreecommitdiffstats
path: root/fs/xfs/scrub/common.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2023-02-13 09:14:52 +1100
committerDave Chinner <dchinner@redhat.com>2023-02-13 09:14:52 +1100
commit498f0adbcdb6a68403bfb9645a7555b789a7fee4 (patch)
treea8077f6724d6f1d30a91dc81d01e4d4facc37790 /fs/xfs/scrub/common.c
parent368e2d09b41caa5b44a61bb518c362f46d6d615c (diff)
downloadlinux-stable-498f0adbcdb6a68403bfb9645a7555b789a7fee4.tar.gz
linux-stable-498f0adbcdb6a68403bfb9645a7555b789a7fee4.tar.bz2
linux-stable-498f0adbcdb6a68403bfb9645a7555b789a7fee4.zip
xfs: convert xfs_imap() to take a perag
Callers have referenced perags but they don't pass it into xfs_imap() so it takes it's own reference. Fix that so we can change inode allocation over to using active references. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub/common.c')
-rw-r--r--fs/xfs/scrub/common.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c
index 613260b04a3d..033bf6730ece 100644
--- a/fs/xfs/scrub/common.c
+++ b/fs/xfs/scrub/common.c
@@ -636,6 +636,7 @@ xchk_get_inode(
{
struct xfs_imap imap;
struct xfs_mount *mp = sc->mp;
+ struct xfs_perag *pag;
struct xfs_inode *ip_in = XFS_I(file_inode(sc->file));
struct xfs_inode *ip = NULL;
int error;
@@ -671,10 +672,14 @@ xchk_get_inode(
* Otherwise, we really couldn't find it so tell userspace
* that it no longer exists.
*/
- error = xfs_imap(sc->mp, sc->tp, sc->sm->sm_ino, &imap,
- XFS_IGET_UNTRUSTED | XFS_IGET_DONTCACHE);
- if (error)
- return -ENOENT;
+ pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, sc->sm->sm_ino));
+ if (pag) {
+ error = xfs_imap(pag, sc->tp, sc->sm->sm_ino, &imap,
+ XFS_IGET_UNTRUSTED | XFS_IGET_DONTCACHE);
+ xfs_perag_put(pag);
+ if (error)
+ return -ENOENT;
+ }
error = -EFSCORRUPTED;
fallthrough;
default: