summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-04-16 18:58:42 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2017-01-18 21:39:10 -0900
commit39b9098cabbc9da8a283d5ddc21ab395b6aaf23c (patch)
treee3bfc5cfc9922a07528036a59824196d52844af9
parent05c5e6090d2f750c01afbf73cdd88d5f63957fa6 (diff)
bcache: perf tweaks
-rw-r--r--drivers/md/bcache/alloc.c11
-rw-r--r--drivers/md/bcache/fs-io.c2
-rw-r--r--drivers/md/bcache/io.c23
-rw-r--r--drivers/md/bcache/journal_types.h2
-rw-r--r--drivers/md/bcache/super.c3
5 files changed, 20 insertions, 21 deletions
diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c
index e33eb373ed4a..753c32442da0 100644
--- a/drivers/md/bcache/alloc.c
+++ b/drivers/md/bcache/alloc.c
@@ -1440,17 +1440,14 @@ void bch_alloc_sectors_done(struct cache_set *c, struct write_point *wp,
has_data = true;
}
- cache_member_info_put();
-
- if (!has_data)
- BUG_ON(xchg(&wp->b, NULL) != ob);
- else
+ if (likely(has_data))
atomic_inc(&ob->pin);
+ else
+ BUG_ON(xchg(&wp->b, NULL) != ob);
- rcu_read_lock();
open_bucket_for_each_online_device(c, ob, ptr, ca)
atomic_long_add(sectors, &ca->sectors_written);
- rcu_read_unlock();
+ cache_member_info_put();
mutex_unlock(&ob->lock);
}
diff --git a/drivers/md/bcache/fs-io.c b/drivers/md/bcache/fs-io.c
index 5262262a7ef8..61087c8163bb 100644
--- a/drivers/md/bcache/fs-io.c
+++ b/drivers/md/bcache/fs-io.c
@@ -845,7 +845,7 @@ static void bch_writepage_do_io(struct bch_writepage_io *io)
(u64) io->bio.bio.bio.bi_iter.bi_sector);
closure_call(&io->op.op.cl, bch_write, NULL, &io->cl);
- continue_at(&io->cl, bch_writepage_io_done, io->op.op.c->wq);
+ continue_at(&io->cl, bch_writepage_io_done, NULL);
}
/*
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
index 28f84efe6068..1e3d0b4065f5 100644
--- a/drivers/md/bcache/io.c
+++ b/drivers/md/bcache/io.c
@@ -1017,12 +1017,11 @@ static void __bch_write(struct closure *cl)
do {
struct bkey_i *k;
- BUG_ON(bio_sectors(bio) != op->insert_key.k.size);
- BUG_ON(bio_end_sector(bio) != op->insert_key.k.p.offset);
+ EBUG_ON(bio_sectors(bio) != op->insert_key.k.size);
+ EBUG_ON(bio_end_sector(bio) != op->insert_key.k.p.offset);
if (open_bucket_nr == ARRAY_SIZE(op->open_buckets))
- continue_at(cl, bch_write_index,
- op->c->wq);
+ continue_at(cl, bch_write_index, op->c->wq);
/* for the device pointers and 1 for the chksum */
if (bch_keylist_realloc(&op->insert_keys,
@@ -1035,9 +1034,12 @@ static void __bch_write(struct closure *cl)
b = bch_alloc_sectors_start(op->c, op->wp,
bkey_i_to_extent(k), op->nr_replicas,
(op->flags & BCH_WRITE_ALLOC_NOWAIT) ? NULL : cl);
- BUG_ON(!b);
+ EBUG_ON(!b);
+
+ if (unlikely(IS_ERR(b))) {
+ if (unlikely(PTR_ERR(b) != -EAGAIN))
+ goto err;
- if (PTR_ERR(b) == -EAGAIN) {
/*
* If we already have some keys, must insert them first
* before allocating another open bucket. We only hit
@@ -1064,18 +1066,17 @@ static void __bch_write(struct closure *cl)
*/
closure_sync(cl);
continue;
- } else if (IS_ERR(b))
- goto err;
+ }
op->open_buckets[open_bucket_nr++] = b;
bch_write_extent(op, b, k, bio);
bch_cut_front(k->k.p, &op->insert_key);
- BUG_ON(op->insert_key.k.size &&
- op->insert_key.k.size != bio_sectors(bio));
+ EBUG_ON(op->insert_key.k.size &&
+ op->insert_key.k.size != bio_sectors(bio));
- BUG_ON(bch_extent_normalize(op->c, bkey_i_to_s(k)));
+ bch_extent_normalize(op->c, bkey_i_to_s(k));
bch_check_mark_super(op->c, k, false);
bkey_extent_set_cached(&k->k, (op->flags & BCH_WRITE_CACHED));
diff --git a/drivers/md/bcache/journal_types.h b/drivers/md/bcache/journal_types.h
index 0633dc3f5c95..24d7bfffcd26 100644
--- a/drivers/md/bcache/journal_types.h
+++ b/drivers/md/bcache/journal_types.h
@@ -8,7 +8,7 @@
struct journal_res;
/* size of allocated buffer, max journal entry size: */
-#define JOURNAL_BUF_BYTES (128 << 10)
+#define JOURNAL_BUF_BYTES (256 << 10)
#define JOURNAL_BUF_SECTORS (JOURNAL_BUF_BYTES >> 9)
#define JOURNAL_BUF_ORDER ilog2(JOURNAL_BUF_BYTES >> PAGE_SHIFT)
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 930a17467644..48d90e3edb33 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1155,7 +1155,8 @@ static struct cache_set *bch_cache_set_alloc(struct cache_sb *sb,
iter_size = (btree_blocks(c) + 1) *
sizeof(struct btree_node_iter_set);
- if (!(c->wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0)) ||
+ if (!(c->wq = alloc_workqueue("bcache",
+ WQ_FREEZABLE|WQ_MEM_RECLAIM|WQ_HIGHPRI, 1)) ||
percpu_ref_init(&c->writes, bch_writes_disabled, 0, GFP_KERNEL) ||
mempool_init_slab_pool(&c->search, 1, bch_search_cache) ||
mempool_init_kmalloc_pool(&c->btree_reserve_pool, 1,