public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: add block plug for .writepages
@ 2011-10-31 15:45 Namjae Jeon
  2011-10-31 16:01 ` Chris Mason
  0 siblings, 1 reply; 5+ messages in thread
From: Namjae Jeon @ 2011-10-31 15:45 UTC (permalink / raw)
  To: chris.mason; +Cc: linux-kernel, Namjae Jeon

Add block plug for btrfs .writepages. Block plug is helpful to reduce block lock contention.

Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
---
 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
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: add block plug for .writepages
  2011-10-31 15:45 [PATCH] btrfs: add block plug for .writepages Namjae Jeon
@ 2011-10-31 16:01 ` Chris Mason
  2011-11-01  5:31   ` NamJae Jeon
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Mason @ 2011-10-31 16:01 UTC (permalink / raw)
  To: Namjae Jeon; +Cc: linux-kernel

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@gmail.com>
> ---
>  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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: add block plug for .writepages
  2011-10-31 16:01 ` Chris Mason
@ 2011-11-01  5:31   ` NamJae Jeon
  2011-11-01  7:14     ` Shaohua Li
  0 siblings, 1 reply; 5+ messages in thread
From: NamJae Jeon @ 2011-11-01  5:31 UTC (permalink / raw)
  To: Chris Mason, Namjae Jeon, linux-kernel

2011/11/1 Chris Mason <chris.mason@oracle.com>:
> 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@gmail.com>
>> ---
>>  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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: add block plug for .writepages
  2011-11-01  5:31   ` NamJae Jeon
@ 2011-11-01  7:14     ` Shaohua Li
  2011-11-01 12:26       ` NamJae Jeon
  0 siblings, 1 reply; 5+ messages in thread
From: Shaohua Li @ 2011-11-01  7:14 UTC (permalink / raw)
  To: NamJae Jeon; +Cc: Chris Mason, linux-kernel

2011/11/1 NamJae Jeon <linkinjeon@gmail.com>:
> 2011/11/1 Chris Mason <chris.mason@oracle.com>:
>> 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@gmail.com>
>>> ---
>>>  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 ?
.readpages are called in readahead, where we already have block
plug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: add block plug for .writepages
  2011-11-01  7:14     ` Shaohua Li
@ 2011-11-01 12:26       ` NamJae Jeon
  0 siblings, 0 replies; 5+ messages in thread
From: NamJae Jeon @ 2011-11-01 12:26 UTC (permalink / raw)
  To: Shaohua Li; +Cc: Chris Mason, linux-kernel

2011/11/1 Shaohua Li <shaohua.li@intel.com>:
> 2011/11/1 NamJae Jeon <linkinjeon@gmail.com>:
>> 2011/11/1 Chris Mason <chris.mason@oracle.com>:
>>> 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@gmail.com>
>>>> ---
>>>>  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 ?
> .readpages are called in readahead, where we already have block
> plug.
Thanks for your reply. I checked it.
block plug in mpage_readpages is not needed also.
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-01 12:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-31 15:45 [PATCH] btrfs: add block plug for .writepages Namjae Jeon
2011-10-31 16:01 ` Chris Mason
2011-11-01  5:31   ` NamJae Jeon
2011-11-01  7:14     ` Shaohua Li
2011-11-01 12:26       ` NamJae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox