提交 af6f029d 编写于 作者: A Aneesh Kumar K.V 提交者: Theodore Ts'o

ext4: Use tag dirty lookup during mpage_da_submit_io

This enables us to drop the range_cont writeback mode
use from ext4_da_writepages.
Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
上级 8a0aba73
...@@ -1656,17 +1656,23 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd) ...@@ -1656,17 +1656,23 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd)
while (index <= end) { while (index <= end) {
/* XXX: optimize tail */ /* XXX: optimize tail */
nr_pages = pagevec_lookup(&pvec, mapping, index, PAGEVEC_SIZE); /*
* We can use PAGECACHE_TAG_DIRTY lookup here because
* even though we have cleared the dirty flag on the page
* We still keep the page in the radix tree with tag
* PAGECACHE_TAG_DIRTY. See clear_page_dirty_for_io.
* The PAGECACHE_TAG_DIRTY is cleared in set_page_writeback
* which is called via the below writepage callback.
*/
nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
PAGECACHE_TAG_DIRTY,
min(end - index,
(pgoff_t)PAGEVEC_SIZE-1) + 1);
if (nr_pages == 0) if (nr_pages == 0)
break; break;
for (i = 0; i < nr_pages; i++) { for (i = 0; i < nr_pages; i++) {
struct page *page = pvec.pages[i]; struct page *page = pvec.pages[i];
index = page->index;
if (index > end)
break;
index++;
err = mapping->a_ops->writepage(page, mpd->wbc); err = mapping->a_ops->writepage(page, mpd->wbc);
if (!err) if (!err)
mpd->pages_written++; mpd->pages_written++;
...@@ -2361,7 +2367,6 @@ static int ext4_da_writepages(struct address_space *mapping, ...@@ -2361,7 +2367,6 @@ static int ext4_da_writepages(struct address_space *mapping,
struct writeback_control *wbc) struct writeback_control *wbc)
{ {
handle_t *handle = NULL; handle_t *handle = NULL;
loff_t range_start = 0;
struct mpage_da_data mpd; struct mpage_da_data mpd;
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
int needed_blocks, ret = 0, nr_to_writebump = 0; int needed_blocks, ret = 0, nr_to_writebump = 0;
...@@ -2386,14 +2391,7 @@ static int ext4_da_writepages(struct address_space *mapping, ...@@ -2386,14 +2391,7 @@ static int ext4_da_writepages(struct address_space *mapping,
wbc->nr_to_write = sbi->s_mb_stream_request; wbc->nr_to_write = sbi->s_mb_stream_request;
} }
if (!wbc->range_cyclic)
/*
* If range_cyclic is not set force range_cont
* and save the old writeback_index
*/
wbc->range_cont = 1;
range_start = wbc->range_start;
pages_skipped = wbc->pages_skipped; pages_skipped = wbc->pages_skipped;
mpd.wbc = wbc; mpd.wbc = wbc;
...@@ -2452,9 +2450,8 @@ static int ext4_da_writepages(struct address_space *mapping, ...@@ -2452,9 +2450,8 @@ static int ext4_da_writepages(struct address_space *mapping,
wbc->nr_to_write = to_write; wbc->nr_to_write = to_write;
} }
if (wbc->range_cont && (pages_skipped != wbc->pages_skipped)) { if (!wbc->range_cyclic && (pages_skipped != wbc->pages_skipped)) {
/* We skipped pages in this loop */ /* We skipped pages in this loop */
wbc->range_start = range_start;
wbc->nr_to_write = to_write + wbc->nr_to_write = to_write +
wbc->pages_skipped - pages_skipped; wbc->pages_skipped - pages_skipped;
wbc->pages_skipped = pages_skipped; wbc->pages_skipped = pages_skipped;
...@@ -2463,7 +2460,6 @@ static int ext4_da_writepages(struct address_space *mapping, ...@@ -2463,7 +2460,6 @@ static int ext4_da_writepages(struct address_space *mapping,
out_writepages: out_writepages:
wbc->nr_to_write = to_write - nr_to_writebump; wbc->nr_to_write = to_write - nr_to_writebump;
wbc->range_start = range_start;
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册