]> git.baikalelectronics.ru Git - kernel.git/commitdiff
squashfs: use bvec_virt
authorChristoph Hellwig <hch@lst.de>
Wed, 4 Aug 2021 09:56:25 +0000 (11:56 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 16 Aug 2021 16:50:32 +0000 (10:50 -0600)
Use bvec_virt instead of open coding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20210804095634.460779-7-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/squashfs/block.c
fs/squashfs/lz4_wrapper.c
fs/squashfs/lzo_wrapper.c
fs/squashfs/xz_wrapper.c
fs/squashfs/zlib_wrapper.c
fs/squashfs/zstd_wrapper.c

index 855f0e87066dc9d26483e9b61f5d6bda4ddcf0e2..2db8bcf7ff8595119e73712b377483cb7a575e2c 100644 (file)
@@ -49,8 +49,7 @@ static int copy_bio_to_actor(struct bio *bio,
 
                bytes_to_copy = min_t(int, bytes_to_copy,
                                      req_length - copied_bytes);
-               memcpy(actor_addr + actor_offset,
-                      page_address(bvec->bv_page) + bvec->bv_offset + offset,
+               memcpy(actor_addr + actor_offset, bvec_virt(bvec) + offset,
                       bytes_to_copy);
 
                actor_offset += bytes_to_copy;
@@ -177,7 +176,7 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length,
                        goto out_free_bio;
                }
                /* Extract the length of the metadata block */
-               data = page_address(bvec->bv_page) + bvec->bv_offset;
+               data = bvec_virt(bvec);
                length = data[offset];
                if (offset < bvec->bv_len - 1) {
                        length |= data[offset + 1] << 8;
@@ -186,7 +185,7 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length,
                                res = -EIO;
                                goto out_free_bio;
                        }
-                       data = page_address(bvec->bv_page) + bvec->bv_offset;
+                       data = bvec_virt(bvec);
                        length |= data[0] << 8;
                }
                bio_free_pages(bio);
index 233d5582fbeec6a3a54e577fc35219790d5fcf46..b685b6238316c7f65ba6e187606479f337476e6a 100644 (file)
@@ -101,7 +101,7 @@ static int lz4_uncompress(struct squashfs_sb_info *msblk, void *strm,
        while (bio_next_segment(bio, &iter_all)) {
                int avail = min(bytes, ((int)bvec->bv_len) - offset);
 
-               data = page_address(bvec->bv_page) + bvec->bv_offset;
+               data = bvec_virt(bvec);
                memcpy(buff, data + offset, avail);
                buff += avail;
                bytes -= avail;
index 97bb7d92ddcdf18f282f8a42646feaa8979a07b2..cb510a631968364b247674ed62746363ebcf9d28 100644 (file)
@@ -76,7 +76,7 @@ static int lzo_uncompress(struct squashfs_sb_info *msblk, void *strm,
        while (bio_next_segment(bio, &iter_all)) {
                int avail = min(bytes, ((int)bvec->bv_len) - offset);
 
-               data = page_address(bvec->bv_page) + bvec->bv_offset;
+               data = bvec_virt(bvec);
                memcpy(buff, data + offset, avail);
                buff += avail;
                bytes -= avail;
index e80419aed862b4a3042e4bb8e5162cf0249d294a..68f6d09bb3a2bc0388b3c34bd303107c5d0968ee 100644 (file)
@@ -146,7 +146,7 @@ static int squashfs_xz_uncompress(struct squashfs_sb_info *msblk, void *strm,
                        }
 
                        avail = min(length, ((int)bvec->bv_len) - offset);
-                       data = page_address(bvec->bv_page) + bvec->bv_offset;
+                       data = bvec_virt(bvec);
                        length -= avail;
                        stream->buf.in = data + offset;
                        stream->buf.in_size = avail;
index bcb881ec47f226e1147b961e722543ef1ae17bbf..a20e9042146bd6f7424104ba66a26b6c8cbde9c0 100644 (file)
@@ -76,7 +76,7 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void *strm,
                        }
 
                        avail = min(length, ((int)bvec->bv_len) - offset);
-                       data = page_address(bvec->bv_page) + bvec->bv_offset;
+                       data = bvec_virt(bvec);
                        length -= avail;
                        stream->next_in = data + offset;
                        stream->avail_in = avail;
index b7cb1faa652d54ef51a93d661cd7744ea44b4ed0..0015cf8b55820b9b18faee1545ec2cd64f5a9b6e 100644 (file)
@@ -94,7 +94,7 @@ static int zstd_uncompress(struct squashfs_sb_info *msblk, void *strm,
                        }
 
                        avail = min(length, ((int)bvec->bv_len) - offset);
-                       data = page_address(bvec->bv_page) + bvec->bv_offset;
+                       data = bvec_virt(bvec);
                        length -= avail;
                        in_buf.src = data + offset;
                        in_buf.size = avail;