xfs: refactor xfs_iread_extents to use xfs_btree_visit_blocks
xfs_iread_extents open-codes everything in xfs_btree_visit_blocks, so refactor the btree helper to be able to iterate only the records on level 0, then port iread_extents to use it. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
@@ -4286,6 +4286,7 @@ int
|
||||
xfs_btree_visit_blocks(
|
||||
struct xfs_btree_cur *cur,
|
||||
xfs_btree_visit_blocks_fn fn,
|
||||
unsigned int flags,
|
||||
void *data)
|
||||
{
|
||||
union xfs_btree_ptr lptr;
|
||||
@@ -4311,6 +4312,11 @@ xfs_btree_visit_blocks(
|
||||
|
||||
/* save for the next iteration of the loop */
|
||||
xfs_btree_copy_ptrs(cur, &lptr, ptr, 1);
|
||||
|
||||
if (!(flags & XFS_BTREE_VISIT_LEAVES))
|
||||
continue;
|
||||
} else if (!(flags & XFS_BTREE_VISIT_RECORDS)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* for each buffer in the level */
|
||||
@@ -4413,7 +4419,7 @@ xfs_btree_change_owner(
|
||||
bbcoi.buffer_list = buffer_list;
|
||||
|
||||
return xfs_btree_visit_blocks(cur, xfs_btree_block_change_owner,
|
||||
&bbcoi);
|
||||
XFS_BTREE_VISIT_ALL, &bbcoi);
|
||||
}
|
||||
|
||||
/* Verify the v5 fields of a long-format btree block. */
|
||||
@@ -4865,7 +4871,7 @@ xfs_btree_count_blocks(
|
||||
{
|
||||
*blocks = 0;
|
||||
return xfs_btree_visit_blocks(cur, xfs_btree_count_blocks_helper,
|
||||
blocks);
|
||||
XFS_BTREE_VISIT_ALL, blocks);
|
||||
}
|
||||
|
||||
/* Compare two btree pointers. */
|
||||
|
Reference in New Issue
Block a user