Re: [PATCH] btrfs: add block plug for .writepages

From: NamJae Jeon
Date: Tue Nov 01 2011 - 01:31:41 EST


2011/11/1 Chris Mason <chris.mason@xxxxxxxxxx>:
> On Tue, Nov 01, 2011 at 12:45:07AM +0900, Namjae Jeon wrote:
>> Add block plug for btrfs .writepages. Block plug is helpful to reduce block lock contention.
>>
>> Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxx>
>> ---
>> Âfs/btrfs/extent_io.c | Â Â4 ++++
>> Â1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
>> index d418164..8f2d6bd 100644
>> --- a/fs/btrfs/extent_io.c
>> +++ b/fs/btrfs/extent_io.c
>> @@ -2388,6 +2388,7 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
>> Â Â Â pgoff_t end; Â Â Â Â Â Â/* Inclusive */
>> Â Â Â int scanned = 0;
>> Â Â Â int tag;
>> + Â Â struct blk_plug plug;
>>
>> Â Â Â pagevec_init(&pvec, 0);
>> Â Â Â if (wbc->range_cyclic) {
>> @@ -2405,6 +2406,8 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
>> Âretry:
>> Â Â Â if (wbc->sync_mode == WB_SYNC_ALL)
>> Â Â Â Â Â Â Â tag_pages_for_writeback(mapping, index, end);
>> +
>> + Â Â blk_start_plug(&plug);
>> Â Â Â while (!done && !nr_to_write_done && (index <= end) &&
>> Â Â Â Â Â Â Â(nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag,
>> Â Â Â Â Â Â Â Â Â Â Â min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
>> @@ -2468,6 +2471,7 @@ retry:
>> Â Â Â Â Â Â Â pagevec_release(&pvec);
>> Â Â Â Â Â Â Â cond_resched();
>> Â Â Â }
>> + Â Â blk_finish_plug(&plug);
>> Â Â Â if (!scanned && !done) {
>> Â Â Â Â Â Â Â /*
>> Â Â Â Â Â Â Â Â* We hit the last page and there is more work to be done: wrap
>
> Thanks for the patch, but we actually do this at a lower level in btrfs.
> The actual IO can be done to multiple block devices, so we try to plug
> for each device individually.
>
> -chris
>
>
Hi. Chris.

I got your point. pending bio is operated by worker_loop thread.
But Is block plug needed in extent_readpages ?

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/