public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>, Coly Li <colyli@suse.de>
Cc: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org
Subject: [PATCH 2/6] bcache: use bio_reuse instead of bio_reinit where applicable
Date: Mon, 11 Jun 2018 21:48:02 +0200	[thread overview]
Message-ID: <20180611194806.13222-3-hch@lst.de> (raw)
In-Reply-To: <20180611194806.13222-1-hch@lst.de>

Use the bio_reuse helper instead of rebuilding the bio_vecs and
size for bios that get reused for the same data.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/bcache/request.c | 5 +----
 drivers/md/bcache/super.c   | 6 ++----
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index ae67f5fa8047..cd2505b9bee9 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -810,12 +810,9 @@ static void cached_dev_read_done(struct closure *cl)
 	 */
 
 	if (s->iop.bio) {
-		bio_reset(s->iop.bio);
+		bio_reuse(s->iop.bio);
 		s->iop.bio->bi_iter.bi_sector = s->cache_miss->bi_iter.bi_sector;
 		bio_copy_dev(s->iop.bio, s->cache_miss);
-		s->iop.bio->bi_iter.bi_size = s->insert_bio_sectors << 9;
-		bch_bio_map(s->iop.bio, NULL);
-
 		bio_copy_data(s->cache_miss, s->iop.bio);
 
 		bio_put(s->cache_miss);
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index a31e55bcc4e5..cd27eabbab24 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -205,9 +205,7 @@ static void __write_super(struct cache_sb *sb, struct bio *bio)
 	unsigned i;
 
 	bio->bi_iter.bi_sector	= SB_SECTOR;
-	bio->bi_iter.bi_size	= SB_SIZE;
 	bio_set_op_attrs(bio, REQ_OP_WRITE, REQ_SYNC|REQ_META);
-	bch_bio_map(bio, NULL);
 
 	out->offset		= cpu_to_le64(sb->offset);
 	out->version		= cpu_to_le64(sb->version);
@@ -249,7 +247,7 @@ void bch_write_bdev_super(struct cached_dev *dc, struct closure *parent)
 	down(&dc->sb_write_mutex);
 	closure_init(cl, parent);
 
-	bio_reset(bio);
+	bio_reuse(bio);
 	bio_set_dev(bio, dc->bdev);
 	bio->bi_end_io	= write_bdev_super_endio;
 	bio->bi_private = dc;
@@ -298,7 +296,7 @@ void bcache_write_super(struct cache_set *c)
 
 		SET_CACHE_SYNC(&ca->sb, CACHE_SYNC(&c->sb));
 
-		bio_reset(bio);
+		bio_reuse(bio);
 		bio_set_dev(bio, ca->bdev);
 		bio->bi_end_io	= write_super_endio;
 		bio->bi_private = ca;
-- 
2.17.1

  parent reply	other threads:[~2018-06-11 19:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11 19:48 [RFC] cleanup bcache bio handling Christoph Hellwig
2018-06-11 19:48 ` [PATCH 1/6] block: add a bio_reuse helper Christoph Hellwig
2018-06-12  6:16   ` Kent Overstreet
2018-06-13  7:32     ` Christoph Hellwig
2018-06-13  8:54       ` Kent Overstreet
2018-06-13 13:59         ` Christoph Hellwig
2018-06-13 14:49           ` Kent Overstreet
2018-06-11 19:48 ` Christoph Hellwig [this message]
2018-06-11 19:48 ` [PATCH 3/6] bcache: clean up bio reuse for struct moving_io Christoph Hellwig
2018-06-11 19:48 ` [PATCH 4/6] bcache: clean up bio reuse for struct dirty_io Christoph Hellwig
2018-06-11 19:48 ` [PATCH 5/6] bcache: don't clone bio in bch_data_verify Christoph Hellwig
2018-06-11 19:48 ` [PATCH 6/6] bcache: use bio_add_page instead of open coded bio manipulation Christoph Hellwig
2018-06-12  4:40 ` [RFC] cleanup bcache bio handling Coly Li
2018-06-13  9:58 ` Kent Overstreet
2018-06-13 11:06   ` Ming Lei
2018-06-13 13:56     ` Christoph Hellwig
2018-06-13 14:54       ` Kent Overstreet
2018-06-14  1:55         ` Ming Lei
2018-06-14  7:20           ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2018-06-13 13:51 [RFC] cleanup bcache bio handling v2 Christoph Hellwig
2018-06-13 13:51 ` [PATCH 2/6] bcache: use bio_reuse instead of bio_reinit where applicable Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180611194806.13222-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=colyli@suse.de \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox