linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix page number calculation bug for block layout decode buffer
@ 2012-04-09 23:22 Jim Rees
  2012-04-09 23:25 ` Chuck Lever
  2012-04-10  0:18 ` NeilBrown
  0 siblings, 2 replies; 4+ messages in thread
From: Jim Rees @ 2012-04-09 23:22 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs

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;
 	dprintk("%s max_resp_sz %u max_pages %d\n",
 		__func__, max_resp_sz, max_pages);
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix page number calculation bug for block layout decode buffer
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Chuck Lever @ 2012-04-09 23:25 UTC (permalink / raw)
  To: Jim Rees; +Cc: Trond Myklebust, linux-nfs

Hi-

Since all the layouts (and I'm guessing the non-pNFS path too) seem to need this calculation, would it make sense to create an inline function in a header somewhere?

On Apr 9, 2012, at 7:22 PM, Jim Rees 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;
> 	dprintk("%s max_resp_sz %u max_pages %d\n",
> 		__func__, max_resp_sz, max_pages);
> 
> -- 
> 1.7.5.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Chuck Lever
chuck[dot]lever[at]oracle[dot]com





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix page number calculation bug for block layout decode buffer
  2012-04-09 23:25 ` Chuck Lever
@ 2012-04-10  0:00   ` Fred Isaman
  0 siblings, 0 replies; 4+ messages in thread
From: Fred Isaman @ 2012-04-10  0:00 UTC (permalink / raw)
  To: Chuck Lever; +Cc: Jim Rees, Trond Myklebust, linux-nfs@vger.kernel.org





On Apr 9, 2012, at 7:25 PM, Chuck Lever <chuck.lever@oracle.com> wrote:

> Hi-
> 
> Since all the layouts (and I'm guessing the non-pNFS path too) seem to need this calculation, would it make sense to create an inline function in a header somewhere?
> 

nfs_page_array_len(0, size) would work. 

Fred

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix page number calculation bug for block layout decode buffer
  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:18 ` NeilBrown
  1 sibling, 0 replies; 4+ messages in thread
From: NeilBrown @ 2012-04-10  0:18 UTC (permalink / raw)
  To: Jim Rees; +Cc: Trond Myklebust, linux-nfs

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-10  0:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).