zram: use memcpy_to_bvec in zram_bvec_read
authorChristoph Hellwig <hch@lst.de>
Thu, 3 Mar 2022 11:18:58 +0000 (14:18 +0300)
committerJens Axboe <axboe@kernel.dk>
Fri, 4 Mar 2022 19:29:20 +0000 (12:29 -0700)
Use the proper helper instead of open coding the copy.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/20220303111905.321089-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/zram/zram_drv.c

index a3a5e1e..14becdf 100644 (file)
@@ -1331,12 +1331,10 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
                goto out;
 
        if (is_partial_io(bvec)) {
-               void *dst = kmap_atomic(bvec->bv_page);
                void *src = kmap_atomic(page);
 
-               memcpy(dst + bvec->bv_offset, src + offset, bvec->bv_len);
+               memcpy_to_bvec(bvec, src + offset);
                kunmap_atomic(src);
-               kunmap_atomic(dst);
        }
 out:
        if (is_partial_io(bvec))