From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Matthew Wilcox <willy@infradead.org>,
linux-block@vger.kernel.org, linux-bcache@vger.kernel.org
Subject: [PATCH 1/2] bcache: clean up do_btree_node_write a bit
Date: Thu, 25 Apr 2019 09:02:59 +0200 [thread overview]
Message-ID: <20190425070300.3388-2-hch@lst.de> (raw)
In-Reply-To: <20190425070300.3388-1-hch@lst.de>
Use a variable containing the buffer address instead of the to be
removed integer iterator from bio_for_each_segment_all.
Suggested-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/md/bcache/btree.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index b139858b0802..3a9f8ed437de 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -431,12 +431,13 @@ static void do_btree_node_write(struct btree *b)
if (!bch_bio_alloc_pages(b->bio, __GFP_NOWARN|GFP_NOWAIT)) {
int j;
struct bio_vec *bv;
- void *base = (void *) ((unsigned long) i & ~(PAGE_SIZE - 1));
+ void *addr = (void *) ((unsigned long) i & ~(PAGE_SIZE - 1));
struct bvec_iter_all iter_all;
- bio_for_each_segment_all(bv, b->bio, j, iter_all)
- memcpy(page_address(bv->bv_page),
- base + j * PAGE_SIZE, PAGE_SIZE);
+ bio_for_each_segment_all(bv, b->bio, j, iter_all) {
+ memcpy(page_address(bv->bv_page), addr, PAGE_SIZE);
+ addr += PAGE_SIZE;
+ }
bch_submit_bbio(b->bio, b->c, &k.key, 0);
--
2.20.1
next prev parent reply other threads:[~2019-04-25 7:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-25 7:02 simplify bio_for_each_segment_all Christoph Hellwig
2019-04-25 7:02 ` Christoph Hellwig [this message]
2019-04-25 8:35 ` [PATCH 1/2] bcache: clean up do_btree_node_write a bit Hannes Reinecke
2019-04-25 16:22 ` Coly Li
2019-04-25 7:03 ` [PATCH 2/2] block: remove the i argument to bio_for_each_segment_all Christoph Hellwig
2019-04-25 8:29 ` David Sterba
2019-04-25 8:36 ` Hannes Reinecke
2019-04-25 16:23 ` Coly Li
2019-04-30 15:06 ` simplify bio_for_each_segment_all Christoph Hellwig
2019-04-30 15:15 ` Matthew Wilcox
2019-04-30 15:27 ` Jens Axboe
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=20190425070300.3388-2-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=willy@infradead.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