Commit f936b06a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

bcache: clean up do_btree_node_write a bit

Use a variable containing the buffer address instead of the to be
removed integer iterator from bio_for_each_segment_all.
Suggested-by: default avatarMatthew Wilcox <willy@infradead.org>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Acked-by: default avatarColy Li <colyli@suse.de>
Reviewed-by: default avatarMatthew Wilcox <willy@infradead.org>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent cdca22bc
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment