From: Christoph Hellwig Date: Wed, 9 Apr 2025 11:10:42 +0000 (+0200) Subject: btrfs: use bvec_kmap_local() in btrfs_decompress_buf2page() X-Git-Tag: block-6.16-20250606~42^2~112 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=8d243aa9a85d66d5b5c423adae3f837954f72513;p=linux-block.git btrfs: use bvec_kmap_local() in btrfs_decompress_buf2page() This removes the last direct poke into bvec internals in btrfs. Reviewed-by: Josef Bacik Signed-off-by: Christoph Hellwig Reviewed-by: Qu Wenruo Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index d0ed078e5334..b359ba41e7bd 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -1198,6 +1198,7 @@ int btrfs_decompress_buf2page(const char *buf, u32 buf_len, u32 copy_start; /* Offset inside the full decompressed extent */ u32 bvec_offset; + void *kaddr; bvec = bio_iter_iovec(orig_bio, orig_bio->bi_iter); /* @@ -1220,10 +1221,12 @@ int btrfs_decompress_buf2page(const char *buf, u32 buf_len, * @buf + @buf_len. */ ASSERT(copy_start - decompressed < buf_len); - memcpy_to_page(bvec.bv_page, bvec.bv_offset, - buf + copy_start - decompressed, copy_len); - cur_offset += copy_len; + kaddr = bvec_kmap_local(&bvec); + memcpy(kaddr, buf + copy_start - decompressed, copy_len); + kunmap_local(kaddr); + + cur_offset += copy_len; bio_advance(orig_bio, copy_len); /* Finished the bio */ if (!orig_bio->bi_iter.bi_size)