lkml.org 
[lkml]   [2022]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/6] jbd2: Refactor wait logic for transaction updates into a common function
On Thu 13-01-22 08:56:28, Ritesh Harjani wrote:
> No functionality change as such in this patch. This only refactors the
> common piece of code which waits for t_updates to finish into a common
> function named as jbd2_journal_wait_updates(journal_t *)
>
> Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>

Just one nit, otherwise. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

> @@ -1757,6 +1757,35 @@ static inline unsigned long jbd2_log_space_left(journal_t *journal)
> return max_t(long, free, 0);
> }
>
> +/*
> + * Waits for any outstanding t_updates to finish.
> + * This is called with write j_state_lock held.
> + */
> +static inline void jbd2_journal_wait_updates(journal_t *journal)
> +{
> + transaction_t *commit_transaction = journal->j_running_transaction;
> +
> + if (!commit_transaction)
> + return;
> +
> + spin_lock(&commit_transaction->t_handle_lock);
> + while (atomic_read(&commit_transaction->t_updates)) {
> + DEFINE_WAIT(wait);
> +
> + prepare_to_wait(&journal->j_wait_updates, &wait,
> + TASK_UNINTERRUPTIBLE);
> + if (atomic_read(&commit_transaction->t_updates)) {
> + spin_unlock(&commit_transaction->t_handle_lock);
> + write_unlock(&journal->j_state_lock);
> + schedule();
> + write_lock(&journal->j_state_lock);
> + spin_lock(&commit_transaction->t_handle_lock);
> + }
> + finish_wait(&journal->j_wait_updates, &wait);
> + }
> + spin_unlock(&commit_transaction->t_handle_lock);
> +}
> +

I don't think making this inline makes sence. Neither the commit code nor
jbd2_journal_lock_updates() are so hot that it would warrant this large
inline function...

Honza

--
Jan Kara <jack@suse.com>
SUSE Labs, CR

\
 
 \ /
  Last update: 2022-01-13 12:31    [W:0.225 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site