Commit 29a424f2 authored by Dave Kleikamp's avatar Dave Kleikamp

JFS: clear PAGECACHE_TAG_DIRTY for no-write pages

When JFS decides to drop a dirty metapage, it simply clears the META_dirty
bit and leave alone the PG_dirty and PAGECACHE_TAG_DIRTY bits.

When such no-write page goes to metapage_writepage(), the `relic'
PAGECACHE_TAG_DIRTY tag should be cleared, to prevent pdflush from
repeatedly trying to sync them.  This is done through
set_page_writeback(), so call it should be called in all cases.  If
no I/O is initiated, end_page_writeback() should be called immediately.

This is how __block_write_full_page() does things.
Signed-off-by: default avatarDave Kleikamp <shaggy@linux.vnet.ibm.com>
CC: Fengguang Wu <wfg@mail.ustc.edu.cn>
parent b8c9a187
...@@ -360,6 +360,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) ...@@ -360,6 +360,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
struct metapage *mp; struct metapage *mp;
int redirty = 0; int redirty = 0;
sector_t lblock; sector_t lblock;
int nr_underway = 0;
sector_t pblock; sector_t pblock;
sector_t next_block = 0; sector_t next_block = 0;
sector_t page_start; sector_t page_start;
...@@ -371,6 +372,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) ...@@ -371,6 +372,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
(PAGE_CACHE_SHIFT - inode->i_blkbits); (PAGE_CACHE_SHIFT - inode->i_blkbits);
BUG_ON(!PageLocked(page)); BUG_ON(!PageLocked(page));
BUG_ON(PageWriteback(page)); BUG_ON(PageWriteback(page));
set_page_writeback(page);
for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) { for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) {
mp = page_to_mp(page, offset); mp = page_to_mp(page, offset);
...@@ -413,11 +415,10 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) ...@@ -413,11 +415,10 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
if (!bio->bi_size) if (!bio->bi_size)
goto dump_bio; goto dump_bio;
submit_bio(WRITE, bio); submit_bio(WRITE, bio);
nr_underway++;
bio = NULL; bio = NULL;
} else { } else
set_page_writeback(page);
inc_io(page); inc_io(page);
}
xlen = (PAGE_CACHE_SIZE - offset) >> inode->i_blkbits; xlen = (PAGE_CACHE_SIZE - offset) >> inode->i_blkbits;
pblock = metapage_get_blocks(inode, lblock, &xlen); pblock = metapage_get_blocks(inode, lblock, &xlen);
if (!pblock) { if (!pblock) {
...@@ -449,12 +450,16 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) ...@@ -449,12 +450,16 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
goto dump_bio; goto dump_bio;
submit_bio(WRITE, bio); submit_bio(WRITE, bio);
nr_underway++;
} }
if (redirty) if (redirty)
redirty_page_for_writepage(wbc, page); redirty_page_for_writepage(wbc, page);
unlock_page(page); unlock_page(page);
if (nr_underway == 0)
end_page_writeback(page);
return 0; return 0;
add_failed: add_failed:
/* We should never reach here, since we're only adding one vec */ /* We should never reach here, since we're only adding one vec */
......
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