summaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/btree.c
diff options
context:
space:
mode:
authorSlava Pestov <sp@daterainc.com>2014-04-21 18:23:12 -0700
committerKent Overstreet <kmo@daterainc.com>2014-08-04 15:23:03 -0700
commitc5aa4a3157b55bdca18dd2a9d9f43314470b6d32 (patch)
tree561c55e24a7bc8d646ef2af5bb039b7b815bb676 /drivers/md/bcache/btree.c
parenta664d0f05a2ec02c8f042db536d84d15d6e19e81 (diff)
downloadblackbird-op-linux-c5aa4a3157b55bdca18dd2a9d9f43314470b6d32.tar.gz
blackbird-op-linux-c5aa4a3157b55bdca18dd2a9d9f43314470b6d32.zip
bcache: wait for buckets when allocating new btree root
Tested: - sometimes bcache_tier test would hang on startup with a failure to allocate the btree root -- no longer seeing this Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/btree.c')
-rw-r--r--drivers/md/bcache/btree.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 7347b6100961..9dd9f1c4d0d9 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -1060,15 +1060,15 @@ static void btree_node_free(struct btree *b)
mutex_unlock(&b->c->bucket_lock);
}
-struct btree *bch_btree_node_alloc(struct cache_set *c, struct btree_op *op,
- int level)
+struct btree *__bch_btree_node_alloc(struct cache_set *c, struct btree_op *op,
+ int level, bool wait)
{
BKEY_PADDED(key) k;
struct btree *b = ERR_PTR(-EAGAIN);
mutex_lock(&c->bucket_lock);
retry:
- if (__bch_bucket_alloc_set(c, RESERVE_BTREE, &k.key, 1, op != NULL))
+ if (__bch_bucket_alloc_set(c, RESERVE_BTREE, &k.key, 1, wait))
goto err;
bkey_put(c, &k.key);
@@ -1100,6 +1100,12 @@ err:
return b;
}
+static struct btree *bch_btree_node_alloc(struct cache_set *c,
+ struct btree_op *op, int level)
+{
+ return __bch_btree_node_alloc(c, op, level, op != NULL);
+}
+
static struct btree *btree_node_alloc_replacement(struct btree *b,
struct btree_op *op)
{
OpenPOWER on IntegriCloud