diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-11-11 20:35:24 -0500 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2014-01-08 16:05:13 -0500 |
commit | c052dd9a26f60bcf70c0c3fcc08e07abb60295cd (patch) | |
tree | 9b6f0f270c546ef974bd0b091679a81e1ea295fc /drivers/md/bcache/btree.c | |
parent | f67342dd342d5917d94a7c0ffbde5f78e0d7a57a (diff) |
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/btree.c')
-rw-r--r-- | drivers/md/bcache/btree.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 2c90003ff4ce..9424c8a15e37 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c | |||
@@ -212,7 +212,7 @@ void bch_btree_node_read_done(struct btree *b) | |||
212 | iter->used = 0; | 212 | iter->used = 0; |
213 | 213 | ||
214 | #ifdef CONFIG_BCACHE_DEBUG | 214 | #ifdef CONFIG_BCACHE_DEBUG |
215 | iter->b = b; | 215 | iter->b = &b->keys; |
216 | #endif | 216 | #endif |
217 | 217 | ||
218 | if (!i->seq) | 218 | if (!i->seq) |
@@ -1195,7 +1195,7 @@ static bool btree_gc_mark_node(struct btree *b, struct gc_stat *gc) | |||
1195 | 1195 | ||
1196 | gc->nodes++; | 1196 | gc->nodes++; |
1197 | 1197 | ||
1198 | for_each_key_filter(b, k, &iter, bch_ptr_invalid) { | 1198 | for_each_key_filter(&b->keys, k, &iter, bch_ptr_invalid) { |
1199 | stale = max(stale, btree_mark_key(b, k)); | 1199 | stale = max(stale, btree_mark_key(b, k)); |
1200 | keys++; | 1200 | keys++; |
1201 | 1201 | ||
@@ -1386,7 +1386,7 @@ static unsigned btree_gc_count_keys(struct btree *b) | |||
1386 | struct btree_iter iter; | 1386 | struct btree_iter iter; |
1387 | unsigned ret = 0; | 1387 | unsigned ret = 0; |
1388 | 1388 | ||
1389 | for_each_key_filter(b, k, &iter, bch_ptr_bad) | 1389 | for_each_key_filter(&b->keys, k, &iter, bch_ptr_bad) |
1390 | ret += bkey_u64s(k); | 1390 | ret += bkey_u64s(k); |
1391 | 1391 | ||
1392 | return ret; | 1392 | return ret; |
@@ -1406,7 +1406,7 @@ static int btree_gc_recurse(struct btree *b, struct btree_op *op, | |||
1406 | struct gc_merge_info *last = r + GC_MERGE_NODES - 1; | 1406 | struct gc_merge_info *last = r + GC_MERGE_NODES - 1; |
1407 | 1407 | ||
1408 | bch_keylist_init(&keys); | 1408 | bch_keylist_init(&keys); |
1409 | bch_btree_iter_init(b, &iter, &b->c->gc_done); | 1409 | bch_btree_iter_init(&b->keys, &iter, &b->c->gc_done); |
1410 | 1410 | ||
1411 | for (i = 0; i < GC_MERGE_NODES; i++) | 1411 | for (i = 0; i < GC_MERGE_NODES; i++) |
1412 | r[i].b = ERR_PTR(-EINTR); | 1412 | r[i].b = ERR_PTR(-EINTR); |
@@ -1722,7 +1722,7 @@ static int bch_btree_check_recurse(struct btree *b, struct btree_op *op, | |||
1722 | struct bucket *g; | 1722 | struct bucket *g; |
1723 | struct btree_iter iter; | 1723 | struct btree_iter iter; |
1724 | 1724 | ||
1725 | for_each_key_filter(b, k, &iter, bch_ptr_invalid) { | 1725 | for_each_key_filter(&b->keys, k, &iter, bch_ptr_invalid) { |
1726 | for (i = 0; i < KEY_PTRS(k); i++) { | 1726 | for (i = 0; i < KEY_PTRS(k); i++) { |
1727 | if (!ptr_available(b->c, k, i)) | 1727 | if (!ptr_available(b->c, k, i)) |
1728 | continue; | 1728 | continue; |
@@ -1745,7 +1745,7 @@ static int bch_btree_check_recurse(struct btree *b, struct btree_op *op, | |||
1745 | } | 1745 | } |
1746 | 1746 | ||
1747 | if (b->level) { | 1747 | if (b->level) { |
1748 | bch_btree_iter_init(b, &iter, NULL); | 1748 | bch_btree_iter_init(&b->keys, &iter, NULL); |
1749 | 1749 | ||
1750 | do { | 1750 | do { |
1751 | k = bch_btree_iter_next_filter(&iter, &b->keys, | 1751 | k = bch_btree_iter_next_filter(&iter, &b->keys, |
@@ -1892,7 +1892,7 @@ static bool fix_overlapping_extents(struct btree *b, struct bkey *insert, | |||
1892 | * depends on us inserting a new key for the top | 1892 | * depends on us inserting a new key for the top |
1893 | * here. | 1893 | * here. |
1894 | */ | 1894 | */ |
1895 | top = bch_bset_search(b, | 1895 | top = bch_bset_search(&b->keys, |
1896 | bset_tree_last(&b->keys), | 1896 | bset_tree_last(&b->keys), |
1897 | insert); | 1897 | insert); |
1898 | bch_bset_insert(&b->keys, top, k); | 1898 | bch_bset_insert(&b->keys, top, k); |
@@ -1965,7 +1965,7 @@ static bool btree_insert_key(struct btree *b, struct btree_op *op, | |||
1965 | * the previous key. | 1965 | * the previous key. |
1966 | */ | 1966 | */ |
1967 | prev = NULL; | 1967 | prev = NULL; |
1968 | m = bch_btree_iter_init(b, &iter, | 1968 | m = bch_btree_iter_init(&b->keys, &iter, |
1969 | PRECEDING_KEY(&START_KEY(k))); | 1969 | PRECEDING_KEY(&START_KEY(k))); |
1970 | 1970 | ||
1971 | if (fix_overlapping_extents(b, k, &iter, replace_key)) { | 1971 | if (fix_overlapping_extents(b, k, &iter, replace_key)) { |
@@ -2001,7 +2001,7 @@ static bool btree_insert_key(struct btree *b, struct btree_op *op, | |||
2001 | goto copy; | 2001 | goto copy; |
2002 | } else { | 2002 | } else { |
2003 | BUG_ON(replace_key); | 2003 | BUG_ON(replace_key); |
2004 | m = bch_bset_search(b, bset_tree_last(&b->keys), k); | 2004 | m = bch_bset_search(&b->keys, bset_tree_last(&b->keys), k); |
2005 | } | 2005 | } |
2006 | 2006 | ||
2007 | insert: bch_bset_insert(&b->keys, m, k); | 2007 | insert: bch_bset_insert(&b->keys, m, k); |
@@ -2357,7 +2357,7 @@ static int bch_btree_map_nodes_recurse(struct btree *b, struct btree_op *op, | |||
2357 | struct bkey *k; | 2357 | struct bkey *k; |
2358 | struct btree_iter iter; | 2358 | struct btree_iter iter; |
2359 | 2359 | ||
2360 | bch_btree_iter_init(b, &iter, from); | 2360 | bch_btree_iter_init(&b->keys, &iter, from); |
2361 | 2361 | ||
2362 | while ((k = bch_btree_iter_next_filter(&iter, &b->keys, | 2362 | while ((k = bch_btree_iter_next_filter(&iter, &b->keys, |
2363 | bch_ptr_bad))) { | 2363 | bch_ptr_bad))) { |
@@ -2390,7 +2390,7 @@ static int bch_btree_map_keys_recurse(struct btree *b, struct btree_op *op, | |||
2390 | struct bkey *k; | 2390 | struct bkey *k; |
2391 | struct btree_iter iter; | 2391 | struct btree_iter iter; |
2392 | 2392 | ||
2393 | bch_btree_iter_init(b, &iter, from); | 2393 | bch_btree_iter_init(&b->keys, &iter, from); |
2394 | 2394 | ||
2395 | while ((k = bch_btree_iter_next_filter(&iter, &b->keys, bch_ptr_bad))) { | 2395 | while ((k = bch_btree_iter_next_filter(&iter, &b->keys, bch_ptr_bad))) { |
2396 | ret = !b->level | 2396 | ret = !b->level |