diff options
author | Milosz Tanski <milosz@adfin.com> | 2013-08-09 12:59:55 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-15 14:12:02 -0400 |
commit | b150f5c1c759d551da9146435d3dc9df5f7e15ef (patch) | |
tree | 1b8ec894d8997a741012600f39b3805a3b73a6dc /fs/ceph/addr.c | |
parent | ee3e542fec6e69bc9fb668698889a37d93950ddf (diff) |
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.c | 29 |
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, | |||
151 | struct ceph_snap_context *snapc = page_snap_context(page); | 151 | struct ceph_snap_context *snapc = page_snap_context(page); |
152 | 152 | ||
153 | inode = page->mapping->host; | 153 | inode = page->mapping->host; |
154 | ci = ceph_inode(inode); | ||
155 | |||
156 | if (offset != 0 || length != PAGE_CACHE_SIZE) { | ||
157 | dout("%p invalidatepage %p idx %lu partial dirty page %u~%u\n", | ||
158 | inode, page, page->index, offset, length); | ||
159 | return; | ||
160 | } | ||
154 | 161 | ||
155 | /* | 162 | /* |
156 | * We can get non-dirty pages here due to races between | 163 | * 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, | |||
160 | if (!PageDirty(page)) | 167 | if (!PageDirty(page)) |
161 | pr_err("%p invalidatepage %p page not dirty\n", inode, page); | 168 | pr_err("%p invalidatepage %p page not dirty\n", inode, page); |
162 | 169 | ||
163 | if (offset == 0 && length == PAGE_CACHE_SIZE) | 170 | ClearPageChecked(page); |
164 | ClearPageChecked(page); | ||
165 | 171 | ||
166 | ci = ceph_inode(inode); | 172 | dout("%p invalidatepage %p idx %lu full dirty page\n", |
167 | if (offset == 0 && length == PAGE_CACHE_SIZE) { | 173 | inode, page, page->index); |
168 | dout("%p invalidatepage %p idx %lu full dirty page\n", | 174 | |
169 | inode, page, page->index); | 175 | ceph_put_wrbuffer_cap_refs(ci, 1, snapc); |
170 | ceph_put_wrbuffer_cap_refs(ci, 1, snapc); | 176 | ceph_put_snap_context(snapc); |
171 | ceph_put_snap_context(snapc); | 177 | page->private = 0; |
172 | page->private = 0; | 178 | ClearPagePrivate(page); |
173 | ClearPagePrivate(page); | ||
174 | } else { | ||
175 | dout("%p invalidatepage %p idx %lu partial dirty page %u(%u)\n", | ||
176 | inode, page, page->index, offset, length); | ||
177 | } | ||
178 | } | 179 | } |
179 | 180 | ||
180 | /* just a sanity check */ | 181 | /* just a sanity check */ |