xfs: create helpers to scan an allocation group

Add some helpers to enable us to lock an AG's headers, create btree
cursors for all btrees in that allocation group, and clean up
afterwards.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
Darrick J. Wong
2017-10-17 21:37:38 -07:00
parent 37f3fa7f16
commit b6c1beb967
4 changed files with 214 additions and 0 deletions

View File

@@ -34,6 +34,24 @@ struct xfs_scrub_meta_ops {
bool (*has)(struct xfs_sb *);
};
/* Buffer pointers and btree cursors for an entire AG. */
struct xfs_scrub_ag {
xfs_agnumber_t agno;
/* AG btree roots */
struct xfs_buf *agf_bp;
struct xfs_buf *agfl_bp;
struct xfs_buf *agi_bp;
/* AG btrees */
struct xfs_btree_cur *bno_cur;
struct xfs_btree_cur *cnt_cur;
struct xfs_btree_cur *ino_cur;
struct xfs_btree_cur *fino_cur;
struct xfs_btree_cur *rmap_cur;
struct xfs_btree_cur *refc_cur;
};
struct xfs_scrub_context {
/* General scrub state. */
struct xfs_mount *mp;
@@ -42,6 +60,9 @@ struct xfs_scrub_context {
struct xfs_trans *tp;
struct xfs_inode *ip;
bool try_harder;
/* State tracking for single-AG operations. */
struct xfs_scrub_ag sa;
};
/* Metadata scrubbers */