diff options
author | Zhang Zhen <zhenzhang.zhang@huawei.com> | 2014-05-28 15:09:55 +0800 |
---|---|---|
committer | Yan, Zheng <zheng.z.yan@intel.com> | 2014-06-06 09:29:56 +0800 |
commit | 23cd573b46c1f90645023ca2989bc041a0fcf38c (patch) | |
tree | 0ca41212c75a6b3e48b0fdcae31817b58cbb56c4 /fs/ceph | |
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>
Diffstat (limited to 'fs/ceph')
-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 b53278c9fd9..6aa2e3ffd22 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; |