Skip to content

Commit 29a424f

Browse files
author
Dave Kleikamp
committed
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: Dave Kleikamp <[email protected]> CC: Fengguang Wu <[email protected]>
1 parent b8c9a18 commit 29a424f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

fs/jfs/jfs_metapage.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
360360
struct metapage *mp;
361361
int redirty = 0;
362362
sector_t lblock;
363+
int nr_underway = 0;
363364
sector_t pblock;
364365
sector_t next_block = 0;
365366
sector_t page_start;
@@ -371,6 +372,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
371372
(PAGE_CACHE_SHIFT - inode->i_blkbits);
372373
BUG_ON(!PageLocked(page));
373374
BUG_ON(PageWriteback(page));
375+
set_page_writeback(page);
374376

375377
for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) {
376378
mp = page_to_mp(page, offset);
@@ -413,11 +415,10 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
413415
if (!bio->bi_size)
414416
goto dump_bio;
415417
submit_bio(WRITE, bio);
418+
nr_underway++;
416419
bio = NULL;
417-
} else {
418-
set_page_writeback(page);
420+
} else
419421
inc_io(page);
420-
}
421422
xlen = (PAGE_CACHE_SIZE - offset) >> inode->i_blkbits;
422423
pblock = metapage_get_blocks(inode, lblock, &xlen);
423424
if (!pblock) {
@@ -449,12 +450,16 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
449450
goto dump_bio;
450451

451452
submit_bio(WRITE, bio);
453+
nr_underway++;
452454
}
453455
if (redirty)
454456
redirty_page_for_writepage(wbc, page);
455457

456458
unlock_page(page);
457459

460+
if (nr_underway == 0)
461+
end_page_writeback(page);
462+
458463
return 0;
459464
add_failed:
460465
/* We should never reach here, since we're only adding one vec */

0 commit comments

Comments
 (0)