Commit 43986881 authored by Yan, Zheng's avatar Yan, Zheng Committed by Ilya Dryomov

ceph: cleanup writepage_nounlock()

Signed-off-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent fa71fefb
...@@ -530,7 +530,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc) ...@@ -530,7 +530,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
long writeback_stat; long writeback_stat;
u64 truncate_size; u64 truncate_size;
u32 truncate_seq; u32 truncate_seq;
int err = 0, len = PAGE_SIZE; int err, len = PAGE_SIZE;
dout("writepage %p idx %lu\n", page, page->index); dout("writepage %p idx %lu\n", page, page->index);
...@@ -543,7 +543,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc) ...@@ -543,7 +543,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
snapc = page_snap_context(page); snapc = page_snap_context(page);
if (snapc == NULL) { if (snapc == NULL) {
dout("writepage %p page %p not dirty?\n", inode, page); dout("writepage %p page %p not dirty?\n", inode, page);
goto out; return 0;
} }
oldest = get_oldest_context(inode, &snap_size, oldest = get_oldest_context(inode, &snap_size,
&truncate_size, &truncate_seq); &truncate_size, &truncate_seq);
...@@ -554,7 +554,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc) ...@@ -554,7 +554,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
WARN_ON(!(current->flags & PF_MEMALLOC)); WARN_ON(!(current->flags & PF_MEMALLOC));
ceph_put_snap_context(oldest); ceph_put_snap_context(oldest);
redirty_page_for_writepage(wbc, page); redirty_page_for_writepage(wbc, page);
goto out; return 0;
} }
ceph_put_snap_context(oldest); ceph_put_snap_context(oldest);
...@@ -564,8 +564,9 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc) ...@@ -564,8 +564,9 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
/* is this a partial page at end of file? */ /* is this a partial page at end of file? */
if (page_off >= snap_size) { if (page_off >= snap_size) {
dout("%p page eof %llu\n", page, snap_size); dout("%p page eof %llu\n", page, snap_size);
goto out; return 0;
} }
if (snap_size < page_off + len) if (snap_size < page_off + len)
len = snap_size - page_off; len = snap_size - page_off;
...@@ -592,7 +593,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc) ...@@ -592,7 +593,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
dout("writepage interrupted page %p\n", page); dout("writepage interrupted page %p\n", page);
redirty_page_for_writepage(wbc, page); redirty_page_for_writepage(wbc, page);
end_page_writeback(page); end_page_writeback(page);
goto out; return err;
} }
dout("writepage setting page/mapping error %d %p\n", dout("writepage setting page/mapping error %d %p\n",
err, page); err, page);
...@@ -608,7 +609,6 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc) ...@@ -608,7 +609,6 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
end_page_writeback(page); end_page_writeback(page);
ceph_put_wrbuffer_cap_refs(ci, 1, snapc); ceph_put_wrbuffer_cap_refs(ci, 1, snapc);
ceph_put_snap_context(snapc); /* page's reference */ ceph_put_snap_context(snapc); /* page's reference */
out:
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment