summaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/btree.c
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-09-11 03:46:36 +0200
committerKent Overstreet <kmo@daterainc.com>2013-11-11 06:55:59 +0100
commit4f3d40147b8d0ce7055e241e1d263e0aa2b2b46d (patch)
treeb49db9c82d6301c01734fa40c42ab470cdde0414 /drivers/md/bcache/btree.c
parentbcache: Convert btree_insert_check_key() to btree_insert_node() (diff)
downloadlinux-4f3d40147b8d0ce7055e241e1d263e0aa2b2b46d.tar.xz
linux-4f3d40147b8d0ce7055e241e1d263e0aa2b2b46d.zip
bcache: Add explicit keylist arg to btree_insert()
Some refactoring - better to explicitly pass stuff around instead of having it all in the "big bag of state", struct btree_op. Going to prune struct btree_op quite a bit over time. Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/btree.c')
-rw-r--r--drivers/md/bcache/btree.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 08a85327431c..fc3cae5c94b2 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -2109,30 +2109,32 @@ out:
return ret;
}
-static int bch_btree_insert_recurse(struct btree *b, struct btree_op *op)
+static int bch_btree_insert_recurse(struct btree *b, struct btree_op *op,
+ struct keylist *keys)
{
- if (bch_keylist_empty(&op->keys))
+ if (bch_keylist_empty(keys))
return 0;
if (b->level) {
- struct bkey *insert = op->keys.bottom;
- struct bkey *k = bch_next_recurse_key(b, &START_KEY(insert));
+ struct bkey *k;
+ k = bch_next_recurse_key(b, &START_KEY(keys->bottom));
if (!k) {
btree_bug(b, "no key to recurse on at level %i/%i",
b->level, b->c->root->level);
- op->keys.top = op->keys.bottom;
+ keys->top = keys->bottom;
return -EIO;
}
- return btree(insert_recurse, k, b, op);
+ return btree(insert_recurse, k, b, op, keys);
} else {
- return bch_btree_insert_node(b, op, &op->keys);
+ return bch_btree_insert_node(b, op, keys);
}
}
-int bch_btree_insert(struct btree_op *op, struct cache_set *c)
+int bch_btree_insert(struct btree_op *op, struct cache_set *c,
+ struct keylist *keys)
{
int ret = 0;
@@ -2142,11 +2144,11 @@ int bch_btree_insert(struct btree_op *op, struct cache_set *c)
*/
clear_closure_blocking(&op->cl);
- BUG_ON(bch_keylist_empty(&op->keys));
+ BUG_ON(bch_keylist_empty(keys));
- while (!bch_keylist_empty(&op->keys)) {
+ while (!bch_keylist_empty(keys)) {
op->lock = 0;
- ret = btree_root(insert_recurse, c, op);
+ ret = btree_root(insert_recurse, c, op, keys);
if (ret == -EAGAIN) {
ret = 0;
@@ -2157,7 +2159,7 @@ int bch_btree_insert(struct btree_op *op, struct cache_set *c)
pr_err("error %i trying to insert key for %s",
ret, op_type(op));
- while ((k = bch_keylist_pop(&op->keys)))
+ while ((k = bch_keylist_pop(keys)))
bkey_put(c, k, 0);
}
}