summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-03-23 14:40:56 -0400
committerJeff Layton <jlayton@redhat.com>2012-03-23 14:40:56 -0400
commita7103b99e4cc00b9d40f6bad77389f9e2341820a (patch)
tree0456964af499d3bca9becbfae4b7df1ffc36d8f3 /fs
parent35ebb4155f2f9d5580679d368aea81a5933db481 (diff)
downloadlinux-stable-a7103b99e4cc00b9d40f6bad77389f9e2341820a.tar.gz
linux-stable-a7103b99e4cc00b9d40f6bad77389f9e2341820a.tar.bz2
linux-stable-a7103b99e4cc00b9d40f6bad77389f9e2341820a.zip
cifs: fix up get_numpages
Use DIV_ROUND_UP. Also, PAGE_SIZE is more appropriate here since these aren't pagecache pages. Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/file.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 70bd5464ffdf..5633202b199c 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2071,9 +2071,7 @@ size_t get_numpages(const size_t wsize, const size_t len, size_t *cur_len)
size_t clen;
clen = min_t(const size_t, len, wsize);
- num_pages = clen / PAGE_CACHE_SIZE;
- if (clen % PAGE_CACHE_SIZE)
- num_pages++;
+ num_pages = DIV_ROUND_UP(clen, PAGE_SIZE);
if (cur_len)
*cur_len = clen;