bcache: use bvec_virt
authorChristoph Hellwig <hch@lst.de>
Wed, 4 Aug 2021 09:56:28 +0000 (11:56 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 16 Aug 2021 16:50:33 +0000 (10:50 -0600)
Use bvec_virt instead of open coding it.  Note that the existing code is
fine despite ignoring bv_offset as the bio is known to contain exactly
one page from the page allocator per bio_vec.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20210804095634.460779-10-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/btree.c

index 183a58c893774d59f46c02070d84462d454bb3a7..0595559de174a9806e792b785362e6866a97e5ea 100644 (file)
@@ -378,7 +378,7 @@ static void do_btree_node_write(struct btree *b)
                struct bvec_iter_all iter_all;
 
                bio_for_each_segment_all(bv, b->bio, iter_all) {
-                       memcpy(page_address(bv->bv_page), addr, PAGE_SIZE);
+                       memcpy(bvec_virt(bv), addr, PAGE_SIZE);
                        addr += PAGE_SIZE;
                }