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

ceph: don't wait on writeback when there is no more dirty pages

In sync mode, writepages() needs to write all dirty pages. But
it can only write dirty pages associated with the oldest snapc.
To write dirty pages associated with next snapc, it needs to wait
until current writes complete.

If there is no more dirty pages, writepages() should not wait on
writeback. Otherwise, dirty page writeback becomes very slow.
Signed-off-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent af9cc401
...@@ -857,7 +857,7 @@ static int ceph_writepages_start(struct address_space *mapping, ...@@ -857,7 +857,7 @@ static int ceph_writepages_start(struct address_space *mapping,
* in that range can be associated with newer snapc. * in that range can be associated with newer snapc.
* They are not writeable until we write all dirty pages * They are not writeable until we write all dirty pages
* associated with 'snapc' get written */ * associated with 'snapc' get written */
if (index > 0 || wbc->sync_mode != WB_SYNC_NONE) if (index > 0)
should_loop = true; should_loop = true;
dout(" non-head snapc, range whole\n"); dout(" non-head snapc, range whole\n");
} }
...@@ -903,6 +903,10 @@ static int ceph_writepages_start(struct address_space *mapping, ...@@ -903,6 +903,10 @@ static int ceph_writepages_start(struct address_space *mapping,
if (pgsnapc != snapc) { if (pgsnapc != snapc) {
dout("page snapc %p %lld != oldest %p %lld\n", dout("page snapc %p %lld != oldest %p %lld\n",
pgsnapc, pgsnapc->seq, snapc, snapc->seq); pgsnapc, pgsnapc->seq, snapc, snapc->seq);
if (!should_loop &&
!ceph_wbc.head_snapc &&
wbc->sync_mode != WB_SYNC_NONE)
should_loop = true;
unlock_page(page); unlock_page(page);
continue; continue;
} }
......
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