xfs: create a function to query all records in a btree

Create a helper function that will query all records in a btree.
This will be used by the online repair functions to examine every
record in a btree to rebuild a second btree.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
This commit is contained in:
Darrick J. Wong
2017-03-28 14:56:35 -07:00
parent 2d520bfaa2
commit e9a2599a24
6 changed files with 57 additions and 7 deletions

View File

@@ -4842,6 +4842,21 @@ xfs_btree_query_range(
fn, priv);
}
/* Query a btree for all records. */
int
xfs_btree_query_all(
struct xfs_btree_cur *cur,
xfs_btree_query_range_fn fn,
void *priv)
{
union xfs_btree_irec low_rec;
union xfs_btree_irec high_rec;
memset(&low_rec, 0, sizeof(low_rec));
memset(&high_rec, 0xFF, sizeof(high_rec));
return xfs_btree_query_range(cur, &low_rec, &high_rec, fn, priv);
}
/*
* Calculate the number of blocks needed to store a given number of records
* in a short-format (per-AG metadata) btree.