diff mbox series

[8/9] jbd2: remove dead check of JBD2_UNMOUNT in kjournald2

Message ID 20240506141801.1165315-9-shikemeng@huaweicloud.com
State Superseded
Headers show
Series A fix and some cleanups to jbd2 | expand

Commit Message

Kemeng Shi May 6, 2024, 2:18 p.m. UTC
We always set JBD2_UNMOUNT with j_state_lock held in journal_kill_thread.
In kjournald2, we check JBD2_UNMOUNT flag two times under the same
j_state_lock. Then the second check is unnecessary.
Also see comment in struct journal_s about lock rule of j_flags.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 fs/jbd2/journal.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Zhang Yi May 9, 2024, 12:02 p.m. UTC | #1
On 2024/5/6 22:18, Kemeng Shi wrote:
> We always set JBD2_UNMOUNT with j_state_lock held in journal_kill_thread.
> In kjournald2, we check JBD2_UNMOUNT flag two times under the same
> j_state_lock. Then the second check is unnecessary.
> Also see comment in struct journal_s about lock rule of j_flags.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>

Looks good to me.

Reviewed-by: Zhang Yi <yi.zhang@huawei.com>

> ---
>  fs/jbd2/journal.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index e8f592fbd6e1..ce9004f40ffb 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -228,8 +228,6 @@ static int kjournald2(void *arg)
>  		if (transaction && time_after_eq(jiffies,
>  						transaction->t_expires))
>  			should_sleep = 0;
> -		if (journal->j_flags & JBD2_UNMOUNT)
> -			should_sleep = 0;
>  		if (should_sleep) {
>  			write_unlock(&journal->j_state_lock);
>  			schedule();
>
Jan Kara May 12, 2024, 11:24 a.m. UTC | #2
On Mon 06-05-24 22:18:00, Kemeng Shi wrote:
> We always set JBD2_UNMOUNT with j_state_lock held in journal_kill_thread.
> In kjournald2, we check JBD2_UNMOUNT flag two times under the same
> j_state_lock. Then the second check is unnecessary.
> Also see comment in struct journal_s about lock rule of j_flags.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>

Looks good. Feel free to add:

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

								Honza

> ---
>  fs/jbd2/journal.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index e8f592fbd6e1..ce9004f40ffb 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -228,8 +228,6 @@ static int kjournald2(void *arg)
>  		if (transaction && time_after_eq(jiffies,
>  						transaction->t_expires))
>  			should_sleep = 0;
> -		if (journal->j_flags & JBD2_UNMOUNT)
> -			should_sleep = 0;
>  		if (should_sleep) {
>  			write_unlock(&journal->j_state_lock);
>  			schedule();
> -- 
> 2.30.0
>
diff mbox series

Patch

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index e8f592fbd6e1..ce9004f40ffb 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -228,8 +228,6 @@  static int kjournald2(void *arg)
 		if (transaction && time_after_eq(jiffies,
 						transaction->t_expires))
 			should_sleep = 0;
-		if (journal->j_flags & JBD2_UNMOUNT)
-			should_sleep = 0;
 		if (should_sleep) {
 			write_unlock(&journal->j_state_lock);
 			schedule();