Skip to content

Commit

Permalink
cifs: fix up get_numpages
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff Layton committed Mar 23, 2012
1 parent 35ebb41 commit a7103b9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions fs/cifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a7103b9

Please sign in to comment.