From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Phillip Lougher <phillip@squashfs.org.uk>,
Andrew Morton <akpm@linux-foundation.org>
Cc: <hch@lst.de>, <linux-kernel@vger.kernel.org>, <kernel@axis.com>,
"Vincent Whitchurch" <vincent.whitchurch@axis.com>
Subject: [PATCH mm-nonmm-unstable v2 2/2] squashfs: fix page indices
Date: Fri, 26 May 2023 15:57:31 +0200 [thread overview]
Message-ID: <20230526-squashfs-cache-fixup-v2-2-6fb7723c3647@axis.com> (raw)
In-Reply-To: <20230526-squashfs-cache-fixup-v2-0-6fb7723c3647@axis.com>
The page cache functions want the page index as an argument but we're
currently passing in the byte address.
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---
fs/squashfs/block.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
index f2412e5fc84b..6aa9c2e1e8eb 100644
--- a/fs/squashfs/block.c
+++ b/fs/squashfs/block.c
@@ -142,7 +142,8 @@ static int squashfs_bio_read_cached(struct bio *fullbio,
if (head_to_cache) {
int ret = add_to_page_cache_lru(head_to_cache, cache_mapping,
- read_start, GFP_NOIO);
+ read_start >> PAGE_SHIFT,
+ GFP_NOIO);
if (!ret) {
SetPageUptodate(head_to_cache);
@@ -153,7 +154,8 @@ static int squashfs_bio_read_cached(struct bio *fullbio,
if (tail_to_cache) {
int ret = add_to_page_cache_lru(tail_to_cache, cache_mapping,
- read_end - PAGE_SIZE, GFP_NOIO);
+ (read_end >> PAGE_SHIFT) - 1,
+ GFP_NOIO);
if (!ret) {
SetPageUptodate(tail_to_cache);
@@ -192,7 +194,7 @@ static int squashfs_bio_read(struct super_block *sb, u64 index, int length,
if (cache_mapping)
page = find_get_page(cache_mapping,
- read_start + i * PAGE_SIZE);
+ (read_start >> PAGE_SHIFT) + i);
if (!page)
page = alloc_page(GFP_NOIO);
--
2.34.1
next prev parent reply other threads:[~2023-05-26 13:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 13:57 [PATCH mm-nonmm-unstable v2 0/2] squashfs: fixups for caching Vincent Whitchurch
2023-05-26 13:57 ` [PATCH mm-nonmm-unstable v2 1/2] squashfs: fix page update race Vincent Whitchurch
2023-05-26 17:59 ` Phillip Lougher
2023-06-29 10:57 ` Vincent Whitchurch
2023-05-26 13:57 ` Vincent Whitchurch [this message]
2023-05-26 14:02 ` [PATCH mm-nonmm-unstable v2 2/2] squashfs: fix page indices Christoph Hellwig
2023-05-26 17:59 ` Phillip Lougher
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=20230526-squashfs-cache-fixup-v2-2-6fb7723c3647@axis.com \
--to=vincent.whitchurch@axis.com \
--cc=akpm@linux-foundation.org \
--cc=hch@lst.de \
--cc=kernel@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=phillip@squashfs.org.uk \
/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
all inboxes | Powered by JetHome®