Re: [PATCH] ceph: refactor readpage_nounlock() to make the logic clearer

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

 



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@xxxxxxxxxx>

This looks good.

Reviewed-by: Alex Elder <elder@xxxxxxxxxx>

> ---
>  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;
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux