Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Joanne Koong and committed by
Miklos Szeredi
dcfd95cb 25307ca5

+2 -2
+1 -1
fs/fuse/dev.c
··· 1884 1884 else if (num > file_size - pos) 1885 1885 num = file_size - pos; 1886 1886 1887 - num_pages = (num + offset + PAGE_SIZE - 1) >> PAGE_SHIFT; 1887 + num_pages = DIV_ROUND_UP(num + offset, PAGE_SIZE); 1888 1888 num_pages = min(num_pages, fc->max_pages); 1889 1889 num = min(num, num_pages << PAGE_SHIFT); 1890 1890
+1 -1
fs/fuse/file.c
··· 2176 2176 WARN_ON(!ap->num_folios); 2177 2177 2178 2178 /* Reached max pages */ 2179 - if ((bytes + PAGE_SIZE - 1) >> PAGE_SHIFT > fc->max_pages) 2179 + if (DIV_ROUND_UP(bytes, PAGE_SIZE) > fc->max_pages) 2180 2180 return true; 2181 2181 2182 2182 if (bytes > max_bytes)