Skip to content

Commit

Permalink
ceph: refactor readpage_nounlock() to make the logic clearer
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Yan, Zheng <zheng.z.yan@intel.com>
  • Loading branch information
Zhang Zhen authored and Yan, Zheng committed Jun 6, 2014
1 parent ca665e0 commit 23cd573
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions fs/ceph/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 23cd573

Please sign in to comment.