[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <AE779190-182F-472B-8E91-678ABEFF8506@dilger.ca>
Date: Fri, 29 Mar 2019 15:52:27 -0600
From: Andreas Dilger <adilger@...ger.ca>
To: Jan Kara <jack@...e.cz>
Cc: Liu Song <fishland@...yun.com>, tytso@....edu, jack@...e.com,
linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org,
liu.song11@....com.cn
Subject: Re: [PATCH] jbd2: do not start commit when t_updates does not back to
zero
On Mar 29, 2019, at 3:25 PM, Jan Kara <jack@...e.cz> wrote:
>
> On Sun 24-03-19 11:38:35, Liu Song wrote:
>> When t_updates back to zero, it guaranteed wake up process which
>> waiting on j_wait_updates. If we triggered a commit start without
>> considered t_updates, the commit thread wakes up and find t_updates
>> is not zero, it have to wait on it once again. So, add checking code
>> to avoid this happen.
>>
>> Signed-off-by: Liu Song <liu.song11@....com.cn>
>
> Do I understand correctly that this is a performance improvement? If yes,
> did you measure any benefit of the patch? Because I have some doubts that
> t_updates == 0 case is very common.
In the past there have been times when periodic journal commits keep a disk
from spinning down, but I don't know if that is the case here...
Cheers, Andreas
>> ---
>> fs/jbd2/transaction.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
>> index 79a028a7a579..e0499fd73b1e 100644
>> --- a/fs/jbd2/transaction.c
>> +++ b/fs/jbd2/transaction.c
>> @@ -144,12 +144,13 @@ static void wait_transaction_locked(journal_t *journal)
>> __releases(journal->j_state_lock)
>> {
>> DEFINE_WAIT(wait);
>> - int need_to_start;
>> + int need_to_start = 0;
>> tid_t tid = journal->j_running_transaction->t_tid;
>>
>> prepare_to_wait(&journal->j_wait_transaction_locked, &wait,
>> TASK_UNINTERRUPTIBLE);
>> - need_to_start = !tid_geq(journal->j_commit_request, tid);
>> + if (!atomic_read(&journal->j_running_transaction->t_updates))
>> + need_to_start = !tid_geq(journal->j_commit_request, tid);
>> read_unlock(&journal->j_state_lock);
>> if (need_to_start)
>> jbd2_log_start_commit(journal, tid);
>> --
>> 2.19.1
>>
>>
> --
> Jan Kara <jack@...e.com>
> SUSE Labs, CR
Cheers, Andreas
Download attachment "signature.asc" of type "application/pgp-signature" (874 bytes)
Powered by blists - more mailing lists