Commit 890d2b1a authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: move btrfs_next_old_item into ctree.c

This uses btrfs_header_nritems, which I will be moving out of ctree.h.
In order to avoid needing to include the relevant header in ctree.h,
simply move this helper function into ctree.c.
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
[ rename parameters ]
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent eda517fd
...@@ -4852,6 +4852,14 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path, ...@@ -4852,6 +4852,14 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
return ret; return ret;
} }
int btrfs_next_old_item(struct btrfs_root *root, struct btrfs_path *path, u64 time_seq)
{
path->slots[0]++;
if (path->slots[0] >= btrfs_header_nritems(path->nodes[0]))
return btrfs_next_old_leaf(root, path, time_seq);
return 0;
}
/* /*
* this uses btrfs_prev_leaf to walk backwards in the tree, and keeps * this uses btrfs_prev_leaf to walk backwards in the tree, and keeps
* searching until it gets past min_objectid or finds an item of 'type' * searching until it gets past min_objectid or finds an item of 'type'
......
...@@ -2821,14 +2821,7 @@ int btrfs_get_next_valid_item(struct btrfs_root *root, struct btrfs_key *key, ...@@ -2821,14 +2821,7 @@ int btrfs_get_next_valid_item(struct btrfs_root *root, struct btrfs_key *key,
(path)->slots[0]++ \ (path)->slots[0]++ \
) )
static inline int btrfs_next_old_item(struct btrfs_root *root, int btrfs_next_old_item(struct btrfs_root *root, struct btrfs_path *path, u64 time_seq);
struct btrfs_path *p, u64 time_seq)
{
++p->slots[0];
if (p->slots[0] >= btrfs_header_nritems(p->nodes[0]))
return btrfs_next_old_leaf(root, p, time_seq);
return 0;
}
/* /*
* Search the tree again to find a leaf with greater keys. * Search the tree again to find a leaf with greater keys.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment