From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> If an attr block indicates that it could use compaction, set the preen flag to have the attr fork rebuilt, since the attr fork rebuilder can take care of that for us. Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> --- fs/xfs/scrub/attr.c | 2 ++ fs/xfs/scrub/dabtree.c | 15 +++++++++++++++ fs/xfs/scrub/dabtree.h | 1 + fs/xfs/scrub/trace.h | 1 + 4 files changed, 19 insertions(+) diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c index 50715617eb1e..56894045f147 100644 --- a/fs/xfs/scrub/attr.c +++ b/fs/xfs/scrub/attr.c @@ -293,6 +293,8 @@ xfs_scrub_xattr_block( xfs_scrub_da_set_corrupt(ds, level); if (!xfs_scrub_xattr_set_map(ds->sc, usedmap, 0, hdrsize)) xfs_scrub_da_set_corrupt(ds, level); + if (leafhdr.holes) + xfs_scrub_da_set_preen(ds, level); if (ds->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) goto out; diff --git a/fs/xfs/scrub/dabtree.c b/fs/xfs/scrub/dabtree.c index d700c4d4d4ef..ccf2d92b2756 100644 --- a/fs/xfs/scrub/dabtree.c +++ b/fs/xfs/scrub/dabtree.c @@ -85,6 +85,21 @@ xfs_scrub_da_set_corrupt( __return_address); } +/* Flag a da btree node in need of optimization. */ +void +xfs_scrub_da_set_preen( + struct xfs_scrub_da_btree *ds, + int level) +{ + struct xfs_scrub_context *sc = ds->sc; + + sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; + trace_xfs_scrub_fblock_preen(sc, ds->dargs.whichfork, + xfs_dir2_da_to_db(ds->dargs.geo, + ds->state->path.blk[level].blkno), + __return_address); +} + /* Find an entry at a certain level in a da btree. */ STATIC void * xfs_scrub_da_btree_entry( diff --git a/fs/xfs/scrub/dabtree.h b/fs/xfs/scrub/dabtree.h index 365f9f0019e6..92916e543549 100644 --- a/fs/xfs/scrub/dabtree.h +++ b/fs/xfs/scrub/dabtree.h @@ -36,6 +36,7 @@ bool xfs_scrub_da_process_error(struct xfs_scrub_da_btree *ds, int level, int *e /* Check for da btree corruption. */ void xfs_scrub_da_set_corrupt(struct xfs_scrub_da_btree *ds, int level); +void xfs_scrub_da_set_preen(struct xfs_scrub_da_btree *ds, int level); int xfs_scrub_da_btree_hash(struct xfs_scrub_da_btree *ds, int level, __be32 *hashp); diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h index 2a561689cecb..0212d273ca8b 100644 --- a/fs/xfs/scrub/trace.h +++ b/fs/xfs/scrub/trace.h @@ -230,6 +230,7 @@ DEFINE_EVENT(xfs_scrub_fblock_error_class, name, \ DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xfs_scrub_fblock_error); DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xfs_scrub_fblock_warning); +DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xfs_scrub_fblock_preen); TRACE_EVENT(xfs_scrub_incomplete, TP_PROTO(struct xfs_scrub_context *sc, void *ret_ip), -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html