Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Matthew Wilcox <willy@infradead.org>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Coly Li <colyli@suse.de>
Reviewed-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
f936b06a cdca22bc

+5 -4
+5 -4
drivers/md/bcache/btree.c
··· 431 431 if (!bch_bio_alloc_pages(b->bio, __GFP_NOWARN|GFP_NOWAIT)) { 432 432 int j; 433 433 struct bio_vec *bv; 434 - void *base = (void *) ((unsigned long) i & ~(PAGE_SIZE - 1)); 434 + void *addr = (void *) ((unsigned long) i & ~(PAGE_SIZE - 1)); 435 435 struct bvec_iter_all iter_all; 436 436 437 - bio_for_each_segment_all(bv, b->bio, j, iter_all) 438 - memcpy(page_address(bv->bv_page), 439 - base + j * PAGE_SIZE, PAGE_SIZE); 437 + bio_for_each_segment_all(bv, b->bio, j, iter_all) { 438 + memcpy(page_address(bv->bv_page), addr, PAGE_SIZE); 439 + addr += PAGE_SIZE; 440 + } 440 441 441 442 bch_submit_bbio(b->bio, b->c, &k.key, 0); 442 443