Re: [PATCH] jfs: clear PAGECACHE_TAG_DIRTY for no-write pages

Peter Zijlstra
2007-12-28T11:34:11Z

On Fri, 2007-12-28 at 16:03 +0800, Fengguang Wu wrote:
> Andrew,
>
> This patch fixed the 'pdflush stuck in D state' bug
> http://bugzilla.kernel.org/show_bug.cgi?id=9291
> and should be pushed to mainline ASAP.
> ---
>
> 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.
>
> Also, avoid the redirty when a bio submission is planned.
>
> Tested-by: Markus Rehbach <Markus.Rehbach@gmx.de>
> Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
> ---

> +++ b/fs/jfs/jfs_metapage.c

> @@ -449,9 +450,15 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
> goto dump_bio;
>
> submit_bio(WRITE, bio);
> - }
> - if (redirty)
> + } else if (redirty) {
> redirty_page_for_writepage(wbc, page);
> + } else {
> + write_lock_irq(&mapping->tree_lock);
> + radix_tree_tag_clear(&mapping->page_tree,
> + page_index(page),
> + PAGECACHE_TAG_DIRTY);
> + write_unlock_irq(&mapping->tree_lock);
> + }

I'm not liking this open-coded tag_clear, although I currently fail to
come up with a nice solution.