diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2015-08-21 00:06:53 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2017-01-18 20:19:50 -0900 |
commit | 75cb56d16f42a5f1ac1b1509c3d50c7e7637d07d (patch) | |
tree | 1b55f5f5d456b85b2eca57346c1729cf8516bce9 | |
parent | 75fc548134a46e3d216902c46d044bdfdc22a154 (diff) |
bcache: Don't punt bio submits to wq in bch_data_insert()
Performance optimization - the punting is needed for btree node writes, but it
isn't for normal data writes.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | drivers/md/bcache/bcache.h | 2 | ||||
-rw-r--r-- | drivers/md/bcache/btree.c | 7 | ||||
-rw-r--r-- | drivers/md/bcache/io.c | 13 | ||||
-rw-r--r-- | drivers/md/bcache/request.c | 2 |
4 files changed, 16 insertions, 8 deletions
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 380fd1e7528b..486da65277df 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -1010,7 +1010,7 @@ void __bch_bbio_prep(struct bio *, struct cache_set *); void bch_bbio_prep(struct bio *, struct cache_set *, struct bkey *, unsigned); void bch_submit_bbio(struct bio *, struct cache_set *, struct bkey *, unsigned); void bch_submit_bbio_replicas(struct bio *, struct cache_set *, - struct bkey *, unsigned long *); + struct bkey *, unsigned long *, bool); __printf(2, 3) bool bch_cache_set_error(struct cache_set *, const char *, ...); diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 084defd1c27b..079625f5c31b 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -436,8 +436,8 @@ static void do_btree_node_write(struct btree *b) memcpy(page_address(bv->bv_page), base + j * PAGE_SIZE, PAGE_SIZE); - - bch_submit_bbio_replicas(b->bio, b->c, &k.key, ptrs_to_write); + bch_submit_bbio_replicas(b->bio, b->c, &k.key, + ptrs_to_write, true); continue_at(cl, btree_node_write_done, NULL); } else { trace_bcache_btree_write_sync(b); @@ -445,7 +445,8 @@ static void do_btree_node_write(struct btree *b) b->bio->bi_vcnt = 0; bch_bio_map(b->bio, i); - bch_submit_bbio_replicas(b->bio, b->c, &k.key, ptrs_to_write); + bch_submit_bbio_replicas(b->bio, b->c, &k.key, + ptrs_to_write, true); closure_sync(cl); continue_at_nobarrier(cl, __btree_node_write_done, NULL); diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c index de739142ea50..c1e2b4fbdf6d 100644 --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c @@ -90,7 +90,8 @@ void bch_submit_bbio(struct bio *bio, struct cache_set *c, } void bch_submit_bbio_replicas(struct bio *bio_src, struct cache_set *c, - struct bkey *k, unsigned long *ptrs_to_write) + struct bkey *k, unsigned long *ptrs_to_write, + bool punt) { struct bio *bio; unsigned first, i; @@ -105,11 +106,17 @@ void bch_submit_bbio_replicas(struct bio *bio_src, struct cache_set *c, bio->bi_private = bio_src->bi_private; bch_bbio_prep(bio, c, k, i); - closure_bio_submit_punt(bio, bio->bi_private, c); + if (punt) + closure_bio_submit_punt(bio, bio->bi_private, c); + else + closure_bio_submit(bio, bio->bi_private); } bch_bbio_prep(bio_src, c, k, first); - closure_bio_submit_punt(bio_src, bio_src->bi_private, c); + if (punt) + closure_bio_submit_punt(bio_src, bio_src->bi_private, c); + else + closure_bio_submit(bio_src, bio_src->bi_private); } /* IO errors */ diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index ebfd79419bfc..c57de46337fc 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -302,7 +302,7 @@ static void bch_data_insert_start(struct closure *cl) trace_bcache_cache_insert(k); bio_set_op_attrs(n, REQ_OP_WRITE, 0); - bch_submit_bbio_replicas(n, op->c, k, ptrs_to_write); + bch_submit_bbio_replicas(n, op->c, k, ptrs_to_write, false); bch_extent_normalize(op->c, k); bch_keylist_push(&op->insert_keys); |