diff options
author | Darrick J. Wong <djwong@kernel.org> | 2024-04-16 00:54:51 +0300 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2024-04-16 00:58:55 +0300 |
commit | b1991ee3e7cf852e95a3498801303cfbb4468681 (patch) | |
tree | ece0ae35a9233b1a1fcb4964cbe4f8567e8daf29 /fs/xfs/scrub/dir.c | |
parent | 8d81082a8c9541bdf6164c4639dc1936209fe1c4 (diff) | |
download | linux-b1991ee3e7cf852e95a3498801303cfbb4468681.tar.xz |
xfs: online repair of directories
If a directory looks like it's in bad shape, try to sift through the
rubble to find whatever directory entries we can, scan the directory
tree for the parent (if needed), stage the new directory contents in a
temporary file and use the atomic extent swapping mechanism to commit
the results in bulk.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/scrub/dir.c')
-rw-r--r-- | fs/xfs/scrub/dir.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c index 7bac74621af7..3fe6ffcf9c06 100644 --- a/fs/xfs/scrub/dir.c +++ b/fs/xfs/scrub/dir.c @@ -21,12 +21,21 @@ #include "scrub/dabtree.h" #include "scrub/readdir.h" #include "scrub/health.h" +#include "scrub/repair.h" /* Set us up to scrub directories. */ int xchk_setup_directory( struct xfs_scrub *sc) { + int error; + + if (xchk_could_repair(sc)) { + error = xrep_setup_directory(sc); + if (error) + return error; + } + return xchk_setup_inode_contents(sc, 0); } |