From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: dhowells@redhat.com, linux-cachefs@redhat.com
Cc: jlayton@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] cachefiles: fix calculation of the number of needed blocks
Date: Tue, 14 Feb 2023 16:48:26 +0800 [thread overview]
Message-ID: <20230214084826.79561-1-jefflexu@linux.alibaba.com> (raw)
The number of needed blocks shall be measured with block size rather
than PAGE_SIZE.
Fixes: 047487c947e8 ("cachefiles: Implement the I/O routines")
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
---
fs/cachefiles/io.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/cachefiles/io.c b/fs/cachefiles/io.c
index 175a25fcade8..09605891cf85 100644
--- a/fs/cachefiles/io.c
+++ b/fs/cachefiles/io.c
@@ -565,7 +565,7 @@ int __cachefiles_prepare_write(struct cachefiles_object *object,
* space, we need to see if it's fully allocated. If it's not, we may
* want to cull it.
*/
- if (cachefiles_has_space(cache, 0, *_len / PAGE_SIZE,
+ if (cachefiles_has_space(cache, 0, *_len >> cache->bshift,
cachefiles_has_space_check) == 0)
return 0; /* Enough space to simply overwrite the whole block */
@@ -597,7 +597,7 @@ int __cachefiles_prepare_write(struct cachefiles_object *object,
return ret;
check_space:
- return cachefiles_has_space(cache, 0, *_len / PAGE_SIZE,
+ return cachefiles_has_space(cache, 0, *_len >> cache->bshift,
cachefiles_has_space_for_write);
}
--
2.19.1.6.gb485710b
reply other threads:[~2023-02-14 8:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230214084826.79561-1-jefflexu@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=dhowells@redhat.com \
--cc=jlayton@kernel.org \
--cc=linux-cachefs@redhat.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®