summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/dir.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-02-25 15:13:48 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2020-06-24 18:12:20 -0700
commitb4a8e309923630d5b42c0bee70e6dfd066ba862b (patch)
treeb6f1308db2d0cea8725db257bd221248ec14b3ed /fs/xfs/scrub/dir.c
parent86f6595db67d8061b069caa54739914ac9564899 (diff)
xfs: online repair of directoriesrepair-inode-data_2020-06-24
If a directory looks like it's in bad shape, try to sift through the rubble to find whatever directory entries we can, zap the old tree, and re-add the entries. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/scrub/dir.c')
-rw-r--r--fs/xfs/scrub/dir.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c
index 7c432997edad..5d8eb883e987 100644
--- a/fs/xfs/scrub/dir.c
+++ b/fs/xfs/scrub/dir.c
@@ -25,7 +25,22 @@ xchk_setup_directory(
struct xfs_scrub *sc,
struct xfs_inode *ip)
{
- return xchk_setup_inode_contents(sc, ip, 0);
+ unsigned int sz;
+ int error;
+
+ error = xchk_setup_inode_contents(sc, ip, 0);
+ if (error)
+ return error;
+
+ if (!(sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR))
+ return 0;
+
+ sz = max_t(unsigned int, MAXNAMELEN + 1, sizeof(struct xfs_da_args));
+ sc->buf = kmem_alloc_large(sz, 0);
+ if (!sc->buf)
+ return -ENOMEM;
+
+ return 0;
}
/* Directories */