[linux-cifs] Re: [PATCH v1 6/8] cifs: fix up get_numpages


2012/2/3 Jeff Layton :
> Use DIV_ROUND_UP. Also, PAGE_SIZE is more appropriate here since these
> aren't pagecache pages.
>
> Signed-off-by: Jeff Layton 
> ---
> fs/cifs/file.c |  4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index 6afa40f..264e99c 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -2027,9 +2027,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;
> --
> 1.7.7.6
>

Reviewed-by: Pavel Shilovsky 

-- 
Best regards,
Pavel Shilovsky.

This message from: http://www.mailbrowse.com/linux-cifs/5485.html
Previous message: Re: [linux-cifs-client] [PATCH] cifs: hard mount option behaviour implementation
Next message:Re: [PATCH v1 7/8] cifs: abstract out function to marshal up the iovec array for async writes