From: Christoph Hellwig <hch@infradead.org>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.cz>, Dave Chinner <david@fromorbit.com>,
LKML <linux-kernel@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 3/6] writeback: make nr_to_write a per-file limit
Date: Wed, 4 May 2011 12:18:16 -0400 [thread overview]
Message-ID: <20110504161816.GA8147@infradead.org> (raw)
In-Reply-To: <20110504155100.GA29029@localhost>
> - move MAX_WRITEBACK_PAGES and wb_writeback_work definitions to writeback.h
I think it would be a good idea to keep this in fs/fs-writeback.c, which
means we'd need a small writeback_inodes_wb wrapper for
balance_dirty_pages and bdi_flush_io. But IIRC your tree already has
__writeback_inodes_wb for use in wb_writeback, so writeback_inodes_wb
could be that wrapper.
> + long write_chunk = MAX_WRITEBACK_PAGES;
> + long wrote = 0;
> + bool inode_cleaned = false;
> +
> + /*
> + * WB_SYNC_ALL mode does livelock avoidance by syncing dirty
> + * inodes/pages in one big loop. Setting wbc.nr_to_write=LONG_MAX
> + * here avoids calling into writeback_inodes_wb() more than once.
> + *
> + * The intended call sequence for WB_SYNC_ALL writeback is:
> + *
> + * wb_writeback()
> + * writeback_sb_inodes() <== called only once
> + * write_cache_pages() <== called once for each inode
> + * (quickly) tag currently dirty pages
> + * (maybe slowly) sync all tagged pages
> + */
> + if (work->sync_mode == WB_SYNC_ALL || work->tagged_sync)
> + write_chunk = LONG_MAX;
I think this would be easier to read if kept as and if / else clause
with the MAX_WRITEBACK_PAGES usage.
> + write_chunk = min(write_chunk, work->nr_pages);
Or in fact done here - for the WB_SYNC_ALL case LONG_MAX should
always be larger than work->nr_pages, so the whole thing could be
simplified to:
if (work->sync_mode == WB_SYNC_ALL || work->tagged_sync)
write_chunk = LONG_MAX;
else
write_chunk = min(MAX_WRITEBACK_PAGES, work->nr_pages);
Other notes:
- older_than_this in writeback_control shouldn't be needed anymore
- is the early return for the mis-matching sb in writeback_sb_inodes
handled correctly? Before it had the special 0 return value, and
I'm not quite sure how that fits into your new enum scheme.
next prev parent reply other threads:[~2011-05-04 16:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-04 9:17 [PATCH 0/6] writeback fixes and trace events Wu Fengguang
2011-05-04 9:17 ` [PATCH 1/6] writeback: add bdi_dirty_limit() kernel-doc Wu Fengguang
2011-05-04 9:17 ` [PATCH 2/6] writeback: skip balance_dirty_pages() for in-memory fs Wu Fengguang
2011-05-04 9:17 ` [PATCH 3/6] writeback: make nr_to_write a per-file limit Wu Fengguang
2011-05-04 9:42 ` Christoph Hellwig
2011-05-04 11:52 ` Wu Fengguang
2011-05-04 15:51 ` Wu Fengguang
2011-05-04 16:18 ` Christoph Hellwig [this message]
2011-05-05 10:47 ` Wu Fengguang
2011-05-04 9:17 ` [PATCH 4/6] writeback: trace event writeback_single_inode Wu Fengguang
2011-05-04 9:17 ` [PATCH 5/6] writeback: trace event writeback_queue_io Wu Fengguang
2011-05-05 16:37 ` [PATCH 5/6] writeback: trace event writeback_queue_io (v2) Wu Fengguang
2011-05-05 17:26 ` Jan Kara
2011-05-04 9:17 ` [PATCH 6/6] writeback: convert to relative older_than_this in trace events Wu Fengguang
2011-05-04 22:23 ` Jan Kara
2011-05-05 12:33 ` Wu Fengguang
2011-05-04 9:46 ` [PATCH 0/6] writeback fixes and " Christoph Hellwig
2011-05-04 9:56 ` Wu Fengguang
2011-05-04 10:06 ` Dave Chinner
2011-05-04 11:18 ` Christoph Hellwig
2011-05-04 13:12 ` Theodore Tso
2011-05-04 22:31 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110504161816.GA8147@infradead.org \
--to=hch@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=fengguang.wu@intel.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox