diff mbox

Subject: [PATCH] SQUASHME: Move a check from nfs_pageio_do_add_request to nfs_generic_pg_test

Message ID 4DDEA75E.2090709@panasas.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boaz Harrosh May 26, 2011, 7:17 p.m. UTC
desc->pg_bsize is negotiated with the MDS. But if we are doing
pnfs-IO it is not relevant.

While at it cleanup nfs_pageio_do_add_request() in light of the
less things it needs to do.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/nfs/pagelist.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

Comments

Boaz Harrosh May 26, 2011, 7:58 p.m. UTC | #1
On 05/26/2011 10:17 PM, Boaz Harrosh wrote:
> 
> desc->pg_bsize is negotiated with the MDS. But if we are doing
> pnfs-IO it is not relevant.
> 
> While at it cleanup nfs_pageio_do_add_request() in light of the
> less things it needs to do.
> 
> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
> ---
>  fs/nfs/pagelist.c |   28 ++++++++++++++--------------
>  1 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
> index c795660..130b683 100644
> --- a/fs/nfs/pagelist.c
> +++ b/fs/nfs/pagelist.c
> @@ -206,6 +206,16 @@ nfs_wait_on_request(struct nfs_page *req)
>  
>  static bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *prev, struct nfs_page *req)
>  {
> +	/*
> +	* FIXME: ideally we should be able to coalesce all requests
> +	* that are not block boundary aligned, but currently this
> +	* is problematic for the case of bsize < PAGE_CACHE_SIZE,
> +	* since nfs_flush_multi and nfs_pagein_multi assume you
> +	* can have only one struct nfs_page.
> +	*/
> +	if (desc->pg_bsize < PAGE_SIZE)
> +		return 0;
> +
>  	return desc->pg_count + req->wb_bytes <= desc->pg_bsize;
>  }
>  
> @@ -278,29 +288,19 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev,
>  static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc,
>  				     struct nfs_page *req)
>  {
> -	size_t newlen = req->wb_bytes;
> -
>  	if (desc->pg_count != 0) {
>  		struct nfs_page *prev;
>  
> -		/*
> -		 * FIXME: ideally we should be able to coalesce all requests
> -		 * that are not block boundary aligned, but currently this
> -		 * is problematic for the case of bsize < PAGE_CACHE_SIZE,
> -		 * since nfs_flush_multi and nfs_pagein_multi assume you
> -		 * can have only one struct nfs_page.
> -		 */
> -		if (desc->pg_bsize < PAGE_SIZE)
> -			return 0;
> -		newlen += desc->pg_count;
> +		desc->pg_count += req->wb_bytes;

- 		desc->pg_count += req->wb_bytes;

>  		prev = nfs_list_entry(desc->pg_list.prev);
>  		if (!nfs_can_coalesce_requests(prev, req, desc))
>  			return 0;

+ 		desc->pg_count += req->wb_bytes;

> -	} else
> +	} else {
>  		desc->pg_base = req->wb_pgbase;
> +		desc->pg_count = req->wb_bytes;
> +	}
>  	nfs_list_remove_request(req);
>  	nfs_list_add_request(req, &desc->pg_list);
> -	desc->pg_count = newlen;
>  	return 1;
>  }
>  

Benny please move the addition to after the  nfs_can_coalesce_requests() call

Thanks
Boaz
--
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
Trond Myklebust May 26, 2011, 8:11 p.m. UTC | #2
On Thu, 2011-05-26 at 22:58 +0300, Boaz Harrosh wrote: 
> On 05/26/2011 10:17 PM, Boaz Harrosh wrote:
> > 
> > desc->pg_bsize is negotiated with the MDS. But if we are doing
> > pnfs-IO it is not relevant.
> > 
> > While at it cleanup nfs_pageio_do_add_request() in light of the
> > less things it needs to do.
> > 
> > Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
> > ---
> >  fs/nfs/pagelist.c |   28 ++++++++++++++--------------
> >  1 files changed, 14 insertions(+), 14 deletions(-)
> > 
> > diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
> > index c795660..130b683 100644
> > --- a/fs/nfs/pagelist.c
> > +++ b/fs/nfs/pagelist.c
> > @@ -206,6 +206,16 @@ nfs_wait_on_request(struct nfs_page *req)
> >  
> >  static bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *prev, struct nfs_page *req)
> >  {
> > +	/*
> > +	* FIXME: ideally we should be able to coalesce all requests
> > +	* that are not block boundary aligned, but currently this
> > +	* is problematic for the case of bsize < PAGE_CACHE_SIZE,
> > +	* since nfs_flush_multi and nfs_pagein_multi assume you
> > +	* can have only one struct nfs_page.
> > +	*/
> > +	if (desc->pg_bsize < PAGE_SIZE)
> > +		return 0;
> > +
> >  	return desc->pg_count + req->wb_bytes <= desc->pg_bsize;
> >  }
> >  
> > @@ -278,29 +288,19 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev,
> >  static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc,
> >  				     struct nfs_page *req)
> >  {
> > -	size_t newlen = req->wb_bytes;
> > -
> >  	if (desc->pg_count != 0) {
> >  		struct nfs_page *prev;
> >  
> > -		/*
> > -		 * FIXME: ideally we should be able to coalesce all requests
> > -		 * that are not block boundary aligned, but currently this
> > -		 * is problematic for the case of bsize < PAGE_CACHE_SIZE,
> > -		 * since nfs_flush_multi and nfs_pagein_multi assume you
> > -		 * can have only one struct nfs_page.
> > -		 */
> > -		if (desc->pg_bsize < PAGE_SIZE)
> > -			return 0;
> > -		newlen += desc->pg_count;
> > +		desc->pg_count += req->wb_bytes;
> 
> - 		desc->pg_count += req->wb_bytes;
> 
> >  		prev = nfs_list_entry(desc->pg_list.prev);
> >  		if (!nfs_can_coalesce_requests(prev, req, desc))
> >  			return 0;
> 
> + 		desc->pg_count += req->wb_bytes;
> 
> > -	} else
> > +	} else {
> >  		desc->pg_base = req->wb_pgbase;
> > +		desc->pg_count = req->wb_bytes;
> > +	}
> >  	nfs_list_remove_request(req);
> >  	nfs_list_add_request(req, &desc->pg_list);
> > -	desc->pg_count = newlen;

Wait. Why not just replace this line with

desc->pg_count += req->wb_bytes;

That should always be correct.
Boaz Harrosh May 27, 2011, 7:22 a.m. UTC | #3
On 05/26/2011 11:11 PM, Trond Myklebust wrote:
> On Thu, 2011-05-26 at 22:58 +0300, Boaz Harrosh wrote: 
>> On 05/26/2011 10:17 PM, Boaz Harrosh wrote:
>>>
>>> desc->pg_bsize is negotiated with the MDS. But if we are doing
>>> pnfs-IO it is not relevant.
>>>
>>> While at it cleanup nfs_pageio_do_add_request() in light of the
>>> less things it needs to do.
>>>
>>> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
>>> ---
>>>  fs/nfs/pagelist.c |   28 ++++++++++++++--------------
>>>  1 files changed, 14 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
>>> index c795660..130b683 100644
>>> --- a/fs/nfs/pagelist.c
>>> +++ b/fs/nfs/pagelist.c
>>> @@ -206,6 +206,16 @@ nfs_wait_on_request(struct nfs_page *req)
>>>  
>>>  static bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *prev, struct nfs_page *req)
>>>  {
>>> +	/*
>>> +	* FIXME: ideally we should be able to coalesce all requests
>>> +	* that are not block boundary aligned, but currently this
>>> +	* is problematic for the case of bsize < PAGE_CACHE_SIZE,
>>> +	* since nfs_flush_multi and nfs_pagein_multi assume you
>>> +	* can have only one struct nfs_page.
>>> +	*/
>>> +	if (desc->pg_bsize < PAGE_SIZE)
>>> +		return 0;
>>> +
>>>  	return desc->pg_count + req->wb_bytes <= desc->pg_bsize;
>>>  }
>>>  
>>> @@ -278,29 +288,19 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev,
>>>  static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc,
>>>  				     struct nfs_page *req)
>>>  {
>>> -	size_t newlen = req->wb_bytes;
>>> -
>>>  	if (desc->pg_count != 0) {
>>>  		struct nfs_page *prev;
>>>  
>>> -		/*
>>> -		 * FIXME: ideally we should be able to coalesce all requests
>>> -		 * that are not block boundary aligned, but currently this
>>> -		 * is problematic for the case of bsize < PAGE_CACHE_SIZE,
>>> -		 * since nfs_flush_multi and nfs_pagein_multi assume you
>>> -		 * can have only one struct nfs_page.
>>> -		 */
>>> -		if (desc->pg_bsize < PAGE_SIZE)
>>> -			return 0;
>>> -		newlen += desc->pg_count;
>>> +		desc->pg_count += req->wb_bytes;
>>
>> - 		desc->pg_count += req->wb_bytes;
>>
>>>  		prev = nfs_list_entry(desc->pg_list.prev);
>>>  		if (!nfs_can_coalesce_requests(prev, req, desc))
>>>  			return 0;
>>
>> + 		desc->pg_count += req->wb_bytes;
>>
>>> -	} else
>>> +	} else {
>>>  		desc->pg_base = req->wb_pgbase;
>>> +		desc->pg_count = req->wb_bytes;
>>> +	}
>>>  	nfs_list_remove_request(req);
>>>  	nfs_list_add_request(req, &desc->pg_list);
>>> -	desc->pg_count = newlen;
> 
> Wait. Why not just replace this line with
> 
> desc->pg_count += req->wb_bytes;
> 
> That should always be correct.
> 
Sure, OK, since desc->pg_count should be zero.
Benny could you make the change before you submit/squash.

Thanks
Boaz
--
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
diff mbox

Patch

diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index c795660..130b683 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -206,6 +206,16 @@  nfs_wait_on_request(struct nfs_page *req)
 
 static bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *prev, struct nfs_page *req)
 {
+	/*
+	* FIXME: ideally we should be able to coalesce all requests
+	* that are not block boundary aligned, but currently this
+	* is problematic for the case of bsize < PAGE_CACHE_SIZE,
+	* since nfs_flush_multi and nfs_pagein_multi assume you
+	* can have only one struct nfs_page.
+	*/
+	if (desc->pg_bsize < PAGE_SIZE)
+		return 0;
+
 	return desc->pg_count + req->wb_bytes <= desc->pg_bsize;
 }
 
@@ -278,29 +288,19 @@  static bool nfs_can_coalesce_requests(struct nfs_page *prev,
 static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc,
 				     struct nfs_page *req)
 {
-	size_t newlen = req->wb_bytes;
-
 	if (desc->pg_count != 0) {
 		struct nfs_page *prev;
 
-		/*
-		 * FIXME: ideally we should be able to coalesce all requests
-		 * that are not block boundary aligned, but currently this
-		 * is problematic for the case of bsize < PAGE_CACHE_SIZE,
-		 * since nfs_flush_multi and nfs_pagein_multi assume you
-		 * can have only one struct nfs_page.
-		 */
-		if (desc->pg_bsize < PAGE_SIZE)
-			return 0;
-		newlen += desc->pg_count;
+		desc->pg_count += req->wb_bytes;
 		prev = nfs_list_entry(desc->pg_list.prev);
 		if (!nfs_can_coalesce_requests(prev, req, desc))
 			return 0;
-	} else
+	} else {
 		desc->pg_base = req->wb_pgbase;
+		desc->pg_count = req->wb_bytes;
+	}
 	nfs_list_remove_request(req);
 	nfs_list_add_request(req, &desc->pg_list);
-	desc->pg_count = newlen;
 	return 1;
 }