summaryrefslogtreecommitdiff
path: root/fs/ceph/addr.c
diff options
context:
space:
mode:
authorMilosz Tanski <milosz@adfin.com>2013-08-09 20:59:55 +0400
committerSage Weil <sage@inktank.com>2013-08-15 22:12:02 +0400
commitb150f5c1c759d551da9146435d3dc9df5f7e15ef (patch)
tree1b8ec894d8997a741012600f39b3805a3b73a6dc /fs/ceph/addr.c
parentee3e542fec6e69bc9fb668698889a37d93950ddf (diff)
downloadlinux-b150f5c1c759d551da9146435d3dc9df5f7e15ef.tar.xz
ceph: cleanup the logic in ceph_invalidatepage
The invalidatepage code bails if it encounters a non-zero page offset. The current logic that does is non-obvious with multiple if statements. This should be logically and functionally equivalent. Signed-off-by: Milosz Tanski <milosz@adfin.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'fs/ceph/addr.c')
-rw-r--r--fs/ceph/addr.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 722585cd5c7e..cb78ce81d6a6 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -151,6 +151,13 @@ static void ceph_invalidatepage(struct page *page, unsigned int offset,
struct ceph_snap_context *snapc = page_snap_context(page);
inode = page->mapping->host;
+ ci = ceph_inode(inode);
+
+ if (offset != 0 || length != PAGE_CACHE_SIZE) {
+ dout("%p invalidatepage %p idx %lu partial dirty page %u~%u\n",
+ inode, page, page->index, offset, length);
+ return;
+ }
/*
* We can get non-dirty pages here due to races between
@@ -160,21 +167,15 @@ static void ceph_invalidatepage(struct page *page, unsigned int offset,
if (!PageDirty(page))
pr_err("%p invalidatepage %p page not dirty\n", inode, page);
- if (offset == 0 && length == PAGE_CACHE_SIZE)
- ClearPageChecked(page);
+ ClearPageChecked(page);
- ci = ceph_inode(inode);
- if (offset == 0 && length == PAGE_CACHE_SIZE) {
- dout("%p invalidatepage %p idx %lu full dirty page\n",
- inode, page, page->index);
- ceph_put_wrbuffer_cap_refs(ci, 1, snapc);
- ceph_put_snap_context(snapc);
- page->private = 0;
- ClearPagePrivate(page);
- } else {
- dout("%p invalidatepage %p idx %lu partial dirty page %u(%u)\n",
- inode, page, page->index, offset, length);
- }
+ dout("%p invalidatepage %p idx %lu full dirty page\n",
+ inode, page, page->index);
+
+ ceph_put_wrbuffer_cap_refs(ci, 1, snapc);
+ ceph_put_snap_context(snapc);
+ page->private = 0;
+ ClearPagePrivate(page);
}
/* just a sanity check */