linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Jim Rees <rees@umich.edu>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH] fix page number calculation bug for block layout decode buffer
Date: Tue, 10 Apr 2012 10:18:44 +1000	[thread overview]
Message-ID: <20120410101844.62c09f57@notabene.brown> (raw)
In-Reply-To: <1334013727-1931-1-git-send-email-rees@umich.edu>

[-- Attachment #1: Type: text/plain, Size: 1087 bytes --]

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

> Signed-off-by: Jim Rees <rees@umich.edu>
> Suggested-by: Andy Adamson <andros@netapp.com>
> ---
>  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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      parent reply	other threads:[~2012-04-10  0:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-09 23:22 [PATCH] fix page number calculation bug for block layout decode buffer Jim Rees
2012-04-09 23:25 ` Chuck Lever
2012-04-10  0:00   ` Fred Isaman
2012-04-10  0:18 ` NeilBrown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120410101844.62c09f57@notabene.brown \
    --to=neilb@suse.de \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=rees@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).