All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ceph: refactor readpage_nounlock() to make the logic clearer
       [not found] <1401260798-28541-1-git-send-email-zhenzhang.zhang@huawei.com>
@ 2014-05-28  7:09 ` Zhang Zhen
  2014-05-28  9:08   ` Yan, Zheng
  2014-05-28 12:24   ` Alex Elder
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Zhen @ 2014-05-28  7:09 UTC (permalink / raw)
  To: sage, ukernel, elder; +Cc: ceph-devel

If the return value of ceph_osdc_readpages() is not negative,
it is certainly greater than or equal to zero.

Remove the useless condition judgment and redundant braces.

Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
---
 fs/ceph/addr.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index b53278c..6aa2e3f 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -211,18 +211,15 @@ static int readpage_nounlock(struct file *filp, struct page *page)
 		SetPageError(page);
 		ceph_fscache_readpage_cancel(inode, page);
 		goto out;
-	} else {
-		if (err < PAGE_CACHE_SIZE) {
-		/* zero fill remainder of page */
-			zero_user_segment(page, err, PAGE_CACHE_SIZE);
-		} else {
-			flush_dcache_page(page);
-		}
 	}
-	SetPageUptodate(page);
+	if (err < PAGE_CACHE_SIZE)
+		/* zero fill remainder of page */
+		zero_user_segment(page, err, PAGE_CACHE_SIZE);
+	else
+		flush_dcache_page(page);

-	if (err >= 0)
-		ceph_readpage_to_fscache(inode, page);
+	SetPageUptodate(page);
+	ceph_readpage_to_fscache(inode, page);

 out:
 	return err < 0 ? err : 0;
-- 
1.8.1.2


.





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

* Re: [PATCH] ceph: refactor readpage_nounlock() to make the logic clearer
  2014-05-28  7:09 ` [PATCH] ceph: refactor readpage_nounlock() to make the logic clearer Zhang Zhen
@ 2014-05-28  9:08   ` Yan, Zheng
  2014-05-28 12:24   ` Alex Elder
  1 sibling, 0 replies; 3+ messages in thread
From: Yan, Zheng @ 2014-05-28  9:08 UTC (permalink / raw)
  To: Zhang Zhen; +Cc: Sage Weil, Alex Elder, ceph-devel

On Wed, May 28, 2014 at 3:09 PM, Zhang Zhen <zhenzhang.zhang@huawei.com> wrote:
> If the return value of ceph_osdc_readpages() is not negative,
> it is certainly greater than or equal to zero.
>
> Remove the useless condition judgment and redundant braces.
>
> Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
> ---
>  fs/ceph/addr.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index b53278c..6aa2e3f 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -211,18 +211,15 @@ static int readpage_nounlock(struct file *filp, struct page *page)
>                 SetPageError(page);
>                 ceph_fscache_readpage_cancel(inode, page);
>                 goto out;
> -       } else {
> -               if (err < PAGE_CACHE_SIZE) {
> -               /* zero fill remainder of page */
> -                       zero_user_segment(page, err, PAGE_CACHE_SIZE);
> -               } else {
> -                       flush_dcache_page(page);
> -               }
>         }
> -       SetPageUptodate(page);
> +       if (err < PAGE_CACHE_SIZE)
> +               /* zero fill remainder of page */
> +               zero_user_segment(page, err, PAGE_CACHE_SIZE);
> +       else
> +               flush_dcache_page(page);
>
> -       if (err >= 0)
> -               ceph_readpage_to_fscache(inode, page);
> +       SetPageUptodate(page);
> +       ceph_readpage_to_fscache(inode, page);
>
>  out:
>         return err < 0 ? err : 0;
> --

Added to testing branch of ceph-client

Thanks
Yan, Zheng


> 1.8.1.2
>
>
> .
>
>
>
>

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

* Re: [PATCH] ceph: refactor readpage_nounlock() to make the logic clearer
  2014-05-28  7:09 ` [PATCH] ceph: refactor readpage_nounlock() to make the logic clearer Zhang Zhen
  2014-05-28  9:08   ` Yan, Zheng
@ 2014-05-28 12:24   ` Alex Elder
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Elder @ 2014-05-28 12:24 UTC (permalink / raw)
  To: Zhang Zhen, sage, ukernel; +Cc: ceph-devel

On 05/28/2014 02:09 AM, Zhang Zhen wrote:
> If the return value of ceph_osdc_readpages() is not negative,
> it is certainly greater than or equal to zero.
> 
> Remove the useless condition judgment and redundant braces.
> 
> Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>

This looks good.

Reviewed-by: Alex Elder <elder@linaro.org>

> ---
>  fs/ceph/addr.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index b53278c..6aa2e3f 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -211,18 +211,15 @@ static int readpage_nounlock(struct file *filp, struct page *page)
>  		SetPageError(page);
>  		ceph_fscache_readpage_cancel(inode, page);
>  		goto out;
> -	} else {
> -		if (err < PAGE_CACHE_SIZE) {
> -		/* zero fill remainder of page */
> -			zero_user_segment(page, err, PAGE_CACHE_SIZE);
> -		} else {
> -			flush_dcache_page(page);
> -		}
>  	}
> -	SetPageUptodate(page);
> +	if (err < PAGE_CACHE_SIZE)
> +		/* zero fill remainder of page */
> +		zero_user_segment(page, err, PAGE_CACHE_SIZE);
> +	else
> +		flush_dcache_page(page);
> 
> -	if (err >= 0)
> -		ceph_readpage_to_fscache(inode, page);
> +	SetPageUptodate(page);
> +	ceph_readpage_to_fscache(inode, page);
> 
>  out:
>  	return err < 0 ? err : 0;
> 


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

end of thread, other threads:[~2014-05-28 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1401260798-28541-1-git-send-email-zhenzhang.zhang@huawei.com>
2014-05-28  7:09 ` [PATCH] ceph: refactor readpage_nounlock() to make the logic clearer Zhang Zhen
2014-05-28  9:08   ` Yan, Zheng
2014-05-28 12:24   ` Alex Elder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.