diff options
author | Zhang Zhen <zhenzhang.zhang@huawei.com> | 2014-05-28 03:09:55 -0400 |
---|---|---|
committer | Yan, Zheng <zheng.z.yan@intel.com> | 2014-06-05 21:29:56 -0400 |
commit | 23cd573b46c1f90645023ca2989bc041a0fcf38c (patch) | |
tree | 0ca41212c75a6b3e48b0fdcae31817b58cbb56c4 | |
parent | ca665e0282ece4f8121ab4de474351f291fa8c2d (diff) |
ceph: refactor readpage_nounlock() to make the logic clearer
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>
-rw-r--r-- | fs/ceph/addr.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index b53278c9fd97..6aa2e3ffd224 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) | |||
211 | SetPageError(page); | 211 | SetPageError(page); |
212 | ceph_fscache_readpage_cancel(inode, page); | 212 | ceph_fscache_readpage_cancel(inode, page); |
213 | goto out; | 213 | goto out; |
214 | } else { | ||
215 | if (err < PAGE_CACHE_SIZE) { | ||
216 | /* zero fill remainder of page */ | ||
217 | zero_user_segment(page, err, PAGE_CACHE_SIZE); | ||
218 | } else { | ||
219 | flush_dcache_page(page); | ||
220 | } | ||
221 | } | 214 | } |
222 | SetPageUptodate(page); | 215 | if (err < PAGE_CACHE_SIZE) |
216 | /* zero fill remainder of page */ | ||
217 | zero_user_segment(page, err, PAGE_CACHE_SIZE); | ||
218 | else | ||
219 | flush_dcache_page(page); | ||
223 | 220 | ||
224 | if (err >= 0) | 221 | SetPageUptodate(page); |
225 | ceph_readpage_to_fscache(inode, page); | 222 | ceph_readpage_to_fscache(inode, page); |
226 | 223 | ||
227 | out: | 224 | out: |
228 | return err < 0 ? err : 0; | 225 | return err < 0 ? err : 0; |