[PATCH 29/39] xfs: scrub the metadir path of rt rmap btree files

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

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

Add a new XFS_SCRUB_METAPATH subtype so that we can scrub the metadata
directory tree path to the rmap btree file for each rt group.

Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
---
 fs/xfs/libxfs/xfs_fs.h  |    3 ++-
 fs/xfs/scrub/metapath.c |   27 ++++++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 2 deletions(-)


diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
index dcf048aae8c17..0bbdbfb0a8ae7 100644
--- a/fs/xfs/libxfs/xfs_fs.h
+++ b/fs/xfs/libxfs/xfs_fs.h
@@ -804,9 +804,10 @@ struct xfs_scrub_metadata {
 #define XFS_SCRUB_METAPATH_USRQUOTA	2
 #define XFS_SCRUB_METAPATH_GRPQUOTA	3
 #define XFS_SCRUB_METAPATH_PRJQUOTA	4
+#define XFS_SCRUB_METAPATH_RTRMAPBT	5
 
 /* Number of metapath sm_ino values */
-#define XFS_SCRUB_METAPATH_NR		5
+#define XFS_SCRUB_METAPATH_NR		6
 
 /*
  * ioctl limits
diff --git a/fs/xfs/scrub/metapath.c b/fs/xfs/scrub/metapath.c
index 5a669a1a8ad17..6afd117c890e9 100644
--- a/fs/xfs/scrub/metapath.c
+++ b/fs/xfs/scrub/metapath.c
@@ -21,6 +21,8 @@
 #include "xfs_bmap_btree.h"
 #include "xfs_trans_space.h"
 #include "xfs_attr.h"
+#include "xfs_rtgroup.h"
+#include "xfs_rtrmap_btree.h"
 #include "scrub/scrub.h"
 #include "scrub/common.h"
 #include "scrub/trace.h"
@@ -93,13 +95,25 @@ xchk_setup_metapath(
 	struct xchk_metapath	*mpath;
 	struct xfs_mount	*mp = sc->mp;
 	struct xfs_inode	*ip = NULL;
+	struct xfs_rtgroup	*rtg;
+	struct xfs_imeta_path	*path;
 	int			error;
 
 	if (!xfs_has_metadir(mp))
 		return -ENOENT;
-	if (sc->sm->sm_gen || sc->sm->sm_agno)
+	if (sc->sm->sm_gen)
 		return -EINVAL;
 
+	switch (sc->sm->sm_ino) {
+	case XFS_SCRUB_METAPATH_RTRMAPBT:
+		/* empty */
+		break;
+	default:
+		if (sc->sm->sm_agno)
+			return -EINVAL;
+		break;
+	}
+
 	mpath = kzalloc(sizeof(struct xchk_metapath), XCHK_GFP_FLAGS);
 	if (!mpath)
 		return -ENOMEM;
@@ -132,6 +146,17 @@ xchk_setup_metapath(
 		if (XFS_IS_PQUOTA_ON(mp))
 			ip = xfs_quota_inode(mp, XFS_DQTYPE_PROJ);
 		break;
+	case XFS_SCRUB_METAPATH_RTRMAPBT:
+		error = xfs_rtrmapbt_create_path(mp, sc->sm->sm_agno, &path);
+		if (error)
+			return error;
+		mpath->path = path;
+		rtg = xfs_rtgroup_get(mp, sc->sm->sm_agno);
+		if (rtg) {
+			ip = rtg->rtg_rmapip;
+			xfs_rtgroup_put(rtg);
+		}
+		break;
 	default:
 		return -EINVAL;
 	}





[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