diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-11-11 17:35:24 -0800 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2014-01-08 13:05:13 -0800 |
commit | c052dd9a26f60bcf70c0c3fcc08e07abb60295cd (patch) | |
tree | 9b6f0f270c546ef974bd0b091679a81e1ea295fc /drivers/md/bcache/bset.h | |
parent | f67342dd342d5917d94a7c0ffbde5f78e0d7a57a (diff) | |
download | blackbird-obmc-linux-c052dd9a26f60bcf70c0c3fcc08e07abb60295cd.tar.gz blackbird-obmc-linux-c052dd9a26f60bcf70c0c3fcc08e07abb60295cd.zip |
bcache: Convert btree_iter to struct btree_keys
More work to disentangle bset.c from struct btree
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/bset.h')
-rw-r--r-- | drivers/md/bcache/bset.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/md/bcache/bset.h b/drivers/md/bcache/bset.h index 49135695342e..563130c28142 100644 --- a/drivers/md/bcache/bset.h +++ b/drivers/md/bcache/bset.h @@ -309,7 +309,7 @@ static inline bool bch_bkey_try_merge(struct btree_keys *b, struct btree_iter { size_t size, used; #ifdef CONFIG_BCACHE_DEBUG - struct btree *b; + struct btree_keys *b; #endif struct btree_iter_set { struct bkey *k, *end; @@ -323,21 +323,30 @@ struct bkey *bch_btree_iter_next_filter(struct btree_iter *, struct btree_keys *, ptr_filter_fn); void bch_btree_iter_push(struct btree_iter *, struct bkey *, struct bkey *); -struct bkey *bch_btree_iter_init(struct btree *, struct btree_iter *, +struct bkey *bch_btree_iter_init(struct btree_keys *, struct btree_iter *, struct bkey *); -struct bkey *__bch_bset_search(struct btree *, struct bset_tree *, - const struct bkey *); +struct bkey *__bch_bset_search(struct btree_keys *, struct bset_tree *, + const struct bkey *); /* * Returns the first key that is strictly greater than search */ -static inline struct bkey *bch_bset_search(struct btree *b, struct bset_tree *t, +static inline struct bkey *bch_bset_search(struct btree_keys *b, + struct bset_tree *t, const struct bkey *search) { return search ? __bch_bset_search(b, t, search) : t->data->start; } +#define for_each_key_filter(b, k, iter, filter) \ + for (bch_btree_iter_init((b), (iter), NULL); \ + ((k) = bch_btree_iter_next_filter((iter), (b), filter));) + +#define for_each_key(b, k, iter) \ + for (bch_btree_iter_init((b), (iter), NULL); \ + ((k) = bch_btree_iter_next(iter));) + /* Sorting */ struct bset_sort_state { |