summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoanne Koong <joannelkoong@gmail.com>2026-01-20 14:44:48 -0800
committerMiklos Szeredi <mszeredi@redhat.com>2026-03-03 17:43:33 +0100
commitdcfd95cb5076c9ef421c19b9b22b3e01f03ce68e (patch)
treeb5a2ea55b3bbe40b9177eb5773ed026691dcb643
parent25307ca50b815c14a21f82fc5b10e8a621af32ad (diff)
fuse: use DIV_ROUND_UP() for page count calculations
Use DIV_ROUND_UP() instead of manually computing round-up division calculations. Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Horst Birthelmer <hbirthelmer@ddn.com> Signed-off-by: Joanne Koong <joannelkoong@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-rw-r--r--fs/fuse/dev.c2
-rw-r--r--fs/fuse/file.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 18622bf805d6..2c16b94357d5 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1884,7 +1884,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode,
else if (num > file_size - pos)
num = file_size - pos;
- num_pages = (num + offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
+ num_pages = DIV_ROUND_UP(num + offset, PAGE_SIZE);
num_pages = min(num_pages, fc->max_pages);
num = min(num, num_pages << PAGE_SHIFT);
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index c61d80e0a70d..7294bd347412 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2176,7 +2176,7 @@ static bool fuse_folios_need_send(struct fuse_conn *fc, loff_t pos,
WARN_ON(!ap->num_folios);
/* Reached max pages */
- if ((bytes + PAGE_SIZE - 1) >> PAGE_SHIFT > fc->max_pages)
+ if (DIV_ROUND_UP(bytes, PAGE_SIZE) > fc->max_pages)
return true;
if (bytes > max_bytes)