lkml.org 
[lkml]   [2009]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] block_write_full_page: switch synchronous writes to use WRITE_SYNC_PLUG
On Tue, Apr 07, 2009 at 04:09:44PM -0700, Andrew Morton wrote:
> >
> > The upstream callers of block_write_full_page() which wait for the
> > writes to finish call wait_on_buffer(), wait_on_writeback_range()
> > (which ultimately calls sync_page(), which calls
> > blk_run_backing_dev(), which will unplug the device queue), and so on.
>
> <sob>

No question, this stuff needs to be better documented; the codepaths
involved is scattered between files in block/, fs/, and mm/
directories, and it's not well documented as *all* what a filesystem
developer is supposed to do.

> > const unsigned blocksize = 1 << inode->i_blkbits;
> > int nr_underway = 0;
> > - int write_op = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE);
> > + int write_op = (wbc->sync_mode == WB_SYNC_ALL ?
> > + WRITE_SYNC_PLUG : WRITE);
> >
> > BUG_ON(!PageLocked(page));
>
> So how does WRITE_SYNC_PLUG differ from WRITE, and what effect does
> this change have upon kernel behaviour?

The difference between WRITE_SYNC_PLUG and WRITE is that from the
perspective of the I/O scheduler, they are prioritized as
"synchronous" operations. Some I/O schedulers, such as AS and CFQ,
prioritize synchronous writes and put them in the same bucket as
synchronous reads, and above asynchronous writes.

Currently, we are using WRITE_SYNC, which has the implicit unplug if
wbc->sync_mode is WB_SYNC_ALL. WRITE_SYNC_PLUG removes the implicit
unplug, which was the issue that you had expressed concern.

- Ted


\
 
 \ /
  Last update: 2009-04-08 01:51    [from the cache]
©2003-2011 Jasper Spaans