diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2020-02-25 15:13:48 -0800 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2020-03-03 18:47:38 -0800 |
commit | faa8f3b259634ed6f67d4464d1da7e2fb7df1d99 (patch) | |
tree | 559b10d4390e35ceabad4b67217421fcf2bf8d99 /fs/xfs/scrub/dir.c | |
parent | 90b7d9278f82ebaa5a0e357dbdc3bcc15cd127cc (diff) |
xfs: online repair of directoriesrepair-inode-data_2020-03-03
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.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c index c186c83544ac..46d8e1923af1 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 */ |