aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/alloc.c
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-07-24 19:46:42 -0400
committerKent Overstreet <kmo@daterainc.com>2013-11-11 00:56:34 -0500
commit3a3b6a4e075188342b58d4b6560f5540af64cac0 (patch)
tree5c64e4cdcb292d3b0a9e1d9f16e461ff5c4fdcbe /drivers/md/bcache/alloc.c
parent280481d06c8a683d9aaa26125476222e76b733c5 (diff)
bcache: Don't bother with bucket refcount for btree node allocations
The bucket refcount (dropped with bkey_put()) is only needed to prevent the newly allocated bucket from being garbage collected until we've added a pointer to it somewhere. But for btree node allocations, the fact that we have btree nodes locked is enough to guard against races with garbage collection. Eventually the per bucket refcount is going to be replaced with something specific to bch_alloc_sectors(). Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/alloc.c')
-rw-r--r--drivers/md/bcache/alloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c
index ed5920b20c61..2b46bf1d7e40 100644
--- a/drivers/md/bcache/alloc.c
+++ b/drivers/md/bcache/alloc.c
@@ -472,7 +472,7 @@ int __bch_bucket_alloc_set(struct cache_set *c, unsigned watermark,
472 return 0; 472 return 0;
473err: 473err:
474 bch_bucket_free(c, k); 474 bch_bucket_free(c, k);
475 __bkey_put(c, k); 475 bkey_put(c, k);
476 return -1; 476 return -1;
477} 477}
478 478
@@ -588,7 +588,7 @@ bool bch_alloc_sectors(struct cache_set *c, struct bkey *k, unsigned sectors,
588 * didn't use it, drop the refcount bch_bucket_alloc_set() took: 588 * didn't use it, drop the refcount bch_bucket_alloc_set() took:
589 */ 589 */
590 if (KEY_PTRS(&alloc.key)) 590 if (KEY_PTRS(&alloc.key))
591 __bkey_put(c, &alloc.key); 591 bkey_put(c, &alloc.key);
592 592
593 for (i = 0; i < KEY_PTRS(&b->key); i++) 593 for (i = 0; i < KEY_PTRS(&b->key); i++)
594 EBUG_ON(ptr_stale(c, &b->key, i)); 594 EBUG_ON(ptr_stale(c, &b->key, i));