[PATCH 2/7] xfs: pass diroffset back from xchk_dir_lookup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

Pass directory offsets back from xchk_dir_lookup so that we can compare
things in scrub.

Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
---
 fs/xfs/scrub/dir.c     |    2 +-
 fs/xfs/scrub/readdir.c |   12 ++++++++++--
 fs/xfs/scrub/readdir.h |    3 ++-
 3 files changed, 13 insertions(+), 4 deletions(-)


diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c
index 46080134b408..06783e4b95ad 100644
--- a/fs/xfs/scrub/dir.c
+++ b/fs/xfs/scrub/dir.c
@@ -105,7 +105,7 @@ xchk_dir_actor(
 	}
 
 	/* Verify that we can look up this name by hash. */
-	error = xchk_dir_lookup(sc, dp, name, &lookup_ino);
+	error = xchk_dir_lookup(sc, dp, name, &lookup_ino, NULL);
 	/* ENOENT means the hash lookup failed and the dir is corrupt */
 	if (error == -ENOENT)
 		error = -EFSCORRUPTED;
diff --git a/fs/xfs/scrub/readdir.c b/fs/xfs/scrub/readdir.c
index 7d1695e98cc6..0a53438975c3 100644
--- a/fs/xfs/scrub/readdir.c
+++ b/fs/xfs/scrub/readdir.c
@@ -314,7 +314,8 @@ xchk_dir_lookup(
 	struct xfs_scrub	*sc,
 	struct xfs_inode	*dp,
 	const struct xfs_name	*name,
-	xfs_ino_t		*ino)
+	xfs_ino_t		*ino,
+	xfs_dir2_dataptr_t	*diroffsetp)
 {
 	struct xfs_da_args	args = {
 		.dp		= dp,
@@ -326,10 +327,14 @@ xchk_dir_lookup(
 		.hashval	= xfs_dir2_hashname(dp->i_mount, name),
 		.whichfork	= XFS_DATA_FORK,
 		.op_flags	= XFS_DA_OP_OKNOENT,
+		.offset		= XFS_DIR2_NULL_DATAPTR,
 	};
 	bool			isblock, isleaf;
 	int			error;
 
+	if (diroffsetp)
+		*diroffsetp = XFS_DIR2_NULL_DATAPTR;
+
 	if (xfs_is_shutdown(dp->i_mount))
 		return -EIO;
 
@@ -369,7 +374,10 @@ xchk_dir_lookup(
 out_check_rval:
 	if (error == -EEXIST)
 		error = 0;
-	if (!error)
+	if (!error) {
 		*ino = args.inumber;
+		if (diroffsetp)
+			*diroffsetp = args.offset;
+	}
 	return error;
 }
diff --git a/fs/xfs/scrub/readdir.h b/fs/xfs/scrub/readdir.h
index 7272f3bd28b4..1a18bb59adb2 100644
--- a/fs/xfs/scrub/readdir.h
+++ b/fs/xfs/scrub/readdir.h
@@ -14,6 +14,7 @@ int xchk_dir_walk(struct xfs_scrub *sc, struct xfs_inode *dp,
 		xchk_dirent_fn dirent_fn, void *priv);
 
 int xchk_dir_lookup(struct xfs_scrub *sc, struct xfs_inode *dp,
-		const struct xfs_name *name, xfs_ino_t *ino);
+		const struct xfs_name *name, xfs_ino_t *ino,
+		xfs_dir2_dataptr_t *diroffsetp);
 
 #endif /* __XFS_SCRUB_READDIR_H__ */




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux