Skip to content

Commit bd3d320

Browse files
Christoph Hellwigaxboe
authored andcommitted
zram: use memcpy_from_bvec in zram_bvec_write
Use memcpy_from_bvec instead of open coding the logic. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Link: https://lore.kernel.org/r/20220303111905.321089-5-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent b3bd0a8 commit bd3d320

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

drivers/block/zram/zram_drv.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec,
14651465
{
14661466
int ret;
14671467
struct page *page = NULL;
1468-
void *src;
14691468
struct bio_vec vec;
14701469

14711470
vec = *bvec;
@@ -1483,11 +1482,9 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec,
14831482
if (ret)
14841483
goto out;
14851484

1486-
src = kmap_atomic(bvec->bv_page);
14871485
dst = kmap_atomic(page);
1488-
memcpy(dst + offset, src + bvec->bv_offset, bvec->bv_len);
1486+
memcpy_from_bvec(dst + offset, bvec);
14891487
kunmap_atomic(dst);
1490-
kunmap_atomic(src);
14911488

14921489
vec.bv_page = page;
14931490
vec.bv_len = PAGE_SIZE;

0 commit comments

Comments
 (0)