Message ID | 6b4e55458868b7d8f7b61be137fe9f9d7860dea1.1663167824.git.josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: initial ctree.h cleanups, simple stuff | expand |
On 2022/9/14 23:06, Josef Bacik wrote: > 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. > > Signed-off-by: Josef Bacik <josef@toxicpanda.com> Since it's only used by backref, uninlining it looks fine. Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > fs/btrfs/ctree.c | 9 +++++++++ > fs/btrfs/ctree.h | 10 ++-------- > 2 files changed, 11 insertions(+), 8 deletions(-) > > diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c > index 1f0355c74fe6..0f7f93bc2582 100644 > --- a/fs/btrfs/ctree.c > +++ b/fs/btrfs/ctree.c > @@ -4775,6 +4775,15 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path, > return ret; > } > > +int btrfs_next_old_item(struct btrfs_root *root, 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; > +} > + > /* > * 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' > diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h > index af6f6764d9a4..42dec21b3517 100644 > --- a/fs/btrfs/ctree.h > +++ b/fs/btrfs/ctree.h > @@ -2836,14 +2836,8 @@ int btrfs_get_next_valid_item(struct btrfs_root *root, struct btrfs_key *key, > (path)->slots[0]++ \ > ) > > -static inline int btrfs_next_old_item(struct btrfs_root *root, > - 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; > -} > +int btrfs_next_old_item(struct btrfs_root *root, struct btrfs_path *p, > + u64 time_seq); > > /* > * Search the tree again to find a leaf with greater keys.
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 1f0355c74fe6..0f7f93bc2582 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -4775,6 +4775,15 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path, return ret; } +int btrfs_next_old_item(struct btrfs_root *root, 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; +} + /* * 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' diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index af6f6764d9a4..42dec21b3517 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -2836,14 +2836,8 @@ int btrfs_get_next_valid_item(struct btrfs_root *root, struct btrfs_key *key, (path)->slots[0]++ \ ) -static inline int btrfs_next_old_item(struct btrfs_root *root, - 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; -} +int btrfs_next_old_item(struct btrfs_root *root, struct btrfs_path *p, + u64 time_seq); /* * Search the tree again to find a leaf with greater keys.
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. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/ctree.c | 9 +++++++++ fs/btrfs/ctree.h | 10 ++-------- 2 files changed, 11 insertions(+), 8 deletions(-)