From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Richard Weinberger <richard@nod.at>,
Anton Ivanov <anton.ivanov@cambridgegreys.com>,
Geoff Levand <geoff@infradead.org>,
Ilya Dryomov <idryomov@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>, Song Liu <song@kernel.org>,
Mike Snitzer <snitzer@redhat.com>, Coly Li <colyli@suse.de>,
Stefan Haberland <sth@linux.ibm.com>,
Jan Hoeppner <hoeppner@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Phillip Lougher <phillip@squashfs.org.uk>,
linux-block@vger.kernel.org, dm-devel@redhat.com,
linux-um@lists.infradead.org, ceph-devel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
linux-raid@vger.kernel.org, linux-bcache@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org,
linux-scsi@vger.kernel.org
Subject: [PATCH 06/15] squashfs: use bvec_virt
Date: Wed, 4 Aug 2021 11:56:25 +0200 [thread overview]
Message-ID: <20210804095634.460779-7-hch@lst.de> (raw)
In-Reply-To: <20210804095634.460779-1-hch@lst.de>
Use bvec_virt instead of open coding it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/squashfs/block.c | 7 +++----
fs/squashfs/lz4_wrapper.c | 2 +-
fs/squashfs/lzo_wrapper.c | 2 +-
fs/squashfs/xz_wrapper.c | 2 +-
fs/squashfs/zlib_wrapper.c | 2 +-
fs/squashfs/zstd_wrapper.c | 2 +-
6 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
index 855f0e87066d..2db8bcf7ff85 100644
--- a/fs/squashfs/block.c
+++ b/fs/squashfs/block.c
@@ -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);
diff --git a/fs/squashfs/lz4_wrapper.c b/fs/squashfs/lz4_wrapper.c
index 233d5582fbee..b685b6238316 100644
--- a/fs/squashfs/lz4_wrapper.c
+++ b/fs/squashfs/lz4_wrapper.c
@@ -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;
diff --git a/fs/squashfs/lzo_wrapper.c b/fs/squashfs/lzo_wrapper.c
index 97bb7d92ddcd..cb510a631968 100644
--- a/fs/squashfs/lzo_wrapper.c
+++ b/fs/squashfs/lzo_wrapper.c
@@ -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;
diff --git a/fs/squashfs/xz_wrapper.c b/fs/squashfs/xz_wrapper.c
index e80419aed862..68f6d09bb3a2 100644
--- a/fs/squashfs/xz_wrapper.c
+++ b/fs/squashfs/xz_wrapper.c
@@ -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;
diff --git a/fs/squashfs/zlib_wrapper.c b/fs/squashfs/zlib_wrapper.c
index bcb881ec47f2..a20e9042146b 100644
--- a/fs/squashfs/zlib_wrapper.c
+++ b/fs/squashfs/zlib_wrapper.c
@@ -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;
diff --git a/fs/squashfs/zstd_wrapper.c b/fs/squashfs/zstd_wrapper.c
index b7cb1faa652d..0015cf8b5582 100644
--- a/fs/squashfs/zstd_wrapper.c
+++ b/fs/squashfs/zstd_wrapper.c
@@ -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;
--
2.30.2
next prev parent reply other threads:[~2021-08-04 10:03 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-04 9:56 add a bvec_virt helper Christoph Hellwig
2021-08-04 9:56 ` [PATCH 01/15] bvec: " Christoph Hellwig
2021-08-05 6:19 ` Chaitanya Kulkarni
2021-08-06 2:38 ` Martin K. Petersen
2021-08-04 9:56 ` [PATCH 02/15] block: use bvec_virt in bio_integrity_{process,free} Christoph Hellwig
2021-08-05 6:19 ` Chaitanya Kulkarni
2021-08-06 2:38 ` Martin K. Petersen
2021-08-04 9:56 ` [PATCH 03/15] dm: make EBS depend on !HIGHMEM Christoph Hellwig
2021-08-04 9:56 ` [PATCH 04/15] dm-ebs: use bvec_virt Christoph Hellwig
2021-08-04 9:56 ` [PATCH 05/15] dm-integrity: " Christoph Hellwig
2021-08-04 9:56 ` Christoph Hellwig [this message]
2021-08-04 9:56 ` [PATCH 07/15] rbd: " Christoph Hellwig
2021-08-05 12:01 ` Jeff Layton
2021-08-04 9:56 ` [PATCH 08/15] virtio_blk: " Christoph Hellwig
2021-08-05 14:17 ` Stefan Hajnoczi
2021-08-04 9:56 ` [PATCH 09/15] bcache: " Christoph Hellwig
2021-08-04 17:05 ` Coly Li
2021-08-04 9:56 ` [PATCH 10/15] sd: " Christoph Hellwig
2021-08-05 16:31 ` [dm-devel] " Bart Van Assche
2021-08-06 2:43 ` Martin K. Petersen
2021-08-04 9:56 ` [PATCH 11/15] ubd: " Christoph Hellwig
2021-08-04 10:10 ` Anton Ivanov
2021-08-04 9:56 ` [PATCH 12/15] ps3vram: " Christoph Hellwig
2021-08-04 9:56 ` [PATCH 13/15] dasd: " Christoph Hellwig
2021-08-04 20:20 ` Stefan Haberland
2021-08-04 9:56 ` [PATCH 14/15] dcssblk: " Christoph Hellwig
2021-08-04 9:56 ` [PATCH 15/15] nvme: " Christoph Hellwig
2021-08-04 14:33 ` Keith Busch
2021-08-16 12:38 ` add a bvec_virt helper Christoph Hellwig
2021-08-16 16:51 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210804095634.460779-7-hch@lst.de \
--to=hch@lst.de \
--cc=anton.ivanov@cambridgegreys.com \
--cc=axboe@kernel.dk \
--cc=ceph-devel@vger.kernel.org \
--cc=colyli@suse.de \
--cc=dm-devel@redhat.com \
--cc=geoff@infradead.org \
--cc=hoeppner@linux.ibm.com \
--cc=idryomov@gmail.com \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-raid@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=martin.petersen@oracle.com \
--cc=pbonzini@redhat.com \
--cc=phillip@squashfs.org.uk \
--cc=richard@nod.at \
--cc=snitzer@redhat.com \
--cc=song@kernel.org \
--cc=stefanha@redhat.com \
--cc=sth@linux.ibm.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).