linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: bo.li.liu@oracle.com
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/5] Btrfs: wake up the tasks that wait for the io earlier
Date: Fri, 22 Nov 2013 15:28:32 +0800	[thread overview]
Message-ID: <528F07A0.9040602@cn.fujitsu.com> (raw)
In-Reply-To: <20131122043039.GE25977@localhost.localdomain>

On Fri, 22 Nov 2013 12:30:40 +0800, Liu Bo wrote:
> On Thu, Nov 21, 2013 at 09:43:14PM +0800, Miao Xie wrote:
>> The tasks that wait for the IO_DONE flag just care about the io of the dirty
>> pages, so it is better to wake up them immediately after all the pages are
>> written, not the whole process of the io completes.
> 
> This doesn't seem to make sense, the waiters still go to wait and schedule since
> IO_DONE is not set there yet.

I can not understand what you said. We wake up the waiters after IO_DONE is set,
the waiters who wait for IO_DONE flag will not go to wait.

Miao

> 
> -liubo
> 
>>
>> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
>> ---
>>  fs/btrfs/ordered-data.c | 14 ++++++++++----
>>  1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
>> index eb5bac4..1bd7002 100644
>> --- a/fs/btrfs/ordered-data.c
>> +++ b/fs/btrfs/ordered-data.c
>> @@ -348,10 +348,13 @@ int btrfs_dec_test_first_ordered_pending(struct inode *inode,
>>  	if (!uptodate)
>>  		set_bit(BTRFS_ORDERED_IOERR, &entry->flags);
>>  
>> -	if (entry->bytes_left == 0)
>> +	if (entry->bytes_left == 0) {
>>  		ret = test_and_set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags);
>> -	else
>> +		if (waitqueue_active(&entry->wait))
>> +			wake_up(&entry->wait);
>> +	} else {
>>  		ret = 1;
>> +	}
>>  out:
>>  	if (!ret && cached && entry) {
>>  		*cached = entry;
>> @@ -408,10 +411,13 @@ have_entry:
>>  	if (!uptodate)
>>  		set_bit(BTRFS_ORDERED_IOERR, &entry->flags);
>>  
>> -	if (entry->bytes_left == 0)
>> +	if (entry->bytes_left == 0) {
>>  		ret = test_and_set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags);
>> -	else
>> +		if (waitqueue_active(&entry->wait))
>> +			wake_up(&entry->wait);
>> +	} else {
>>  		ret = 1;
>> +	}
>>  out:
>>  	if (!ret && cached && entry) {
>>  		*cached = entry;
>> -- 
>> 1.8.3.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


  reply	other threads:[~2013-11-22  7:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21 13:43 [PATCH 1/5] Btrfs: wake up the tasks that wait for the io earlier Miao Xie
2013-11-21 13:43 ` [PATCH 2/5] Btrfs: just do diry page flush for the inode with compression before direct IO Miao Xie
2013-11-21 13:43 ` [PATCH 3/5] Btrfs: remove the unnecessary flush when preparing the pages Miao Xie
2013-11-21 13:43 ` [PATCH 4/5] Btrfs: remove unnecessary lock in may_commit_transaction() Miao Xie
2013-11-21 13:43 ` [PATCH 5/5] Btrfs: reclaim the reserved metadata space at background Miao Xie
2013-11-22 17:48   ` Josef Bacik
2013-11-22  4:30 ` [PATCH 1/5] Btrfs: wake up the tasks that wait for the io earlier Liu Bo
2013-11-22  7:28   ` Miao Xie [this message]
2013-11-22  8:47     ` Liu Bo

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=528F07A0.9040602@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=bo.li.liu@oracle.com \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).