Re: [PATCH] fix page number calculation bug for block layout decode buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon,  9 Apr 2012 19:22:07 -0400 Jim Rees <rees@xxxxxxxxx> wrote:

> Signed-off-by: Jim Rees <rees@xxxxxxxxx>
> Suggested-by: Andy Adamson <andros@xxxxxxxxxx>
> ---
>  fs/nfs/blocklayout/blocklayout.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
> index 48cfac3..576da5b 100644
> --- a/fs/nfs/blocklayout/blocklayout.c
> +++ b/fs/nfs/blocklayout/blocklayout.c
> @@ -872,7 +872,7 @@ nfs4_blk_get_deviceinfo(struct nfs_server *server, const struct nfs_fh *fh,
>  	 * GETDEVICEINFO's maxcount
>  	 */
>  	max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz;
> -	max_pages = max_resp_sz >> PAGE_SHIFT;
> +	max_pages = (max_resp_sz  + PAGE_SIZE - 1) >> PAGE_SHIFT;

        max_pages = DIV_ROUND_UP(max_resp_sz, PAGE_SIZE);

??

compiler should optimise the constant-divide into a shift, and it is more
"obviously correct" this way.

NeilBrown


>  	dprintk("%s max_resp_sz %u max_pages %d\n",
>  		__func__, max_resp_sz, max_pages);
>  

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux