diff mbox series

[03/12] jbd2: don't load superblock in jbd2_journal_check_used_features()

Message ID 20230704134233.110812-4-yi.zhang@huaweicloud.com
State Superseded
Headers show
Series ext4,jbd2: cleanup journal load and initialization process | expand

Commit Message

Zhang Yi July 4, 2023, 1:42 p.m. UTC
From: Zhang Yi <yi.zhang@huawei.com>

Since load_superblock() has been moved to journal_init_common(), the
in-memory superblock structure is initialized and contains valid data
once the file system has a journal_t object, so it's safe to access it,
let's drop the call to journal_get_superblock() from
jbd2_journal_check_used_features() and also drop the setting/clearing of
the veirfy bit of the superblock buffer.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
---
 fs/jbd2/journal.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Jan Kara Aug. 3, 2023, 2:14 p.m. UTC | #1
On Tue 04-07-23 21:42:24, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@huawei.com>
> 
> Since load_superblock() has been moved to journal_init_common(), the
> in-memory superblock structure is initialized and contains valid data
> once the file system has a journal_t object, so it's safe to access it,
> let's drop the call to journal_get_superblock() from
> jbd2_journal_check_used_features() and also drop the setting/clearing of
> the veirfy bit of the superblock buffer.
> 
> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>

Looks good. Feel free to add:

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

								Honza

> ---
>  fs/jbd2/journal.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index b247d374e7a6..c7cdb434966f 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -1361,8 +1361,6 @@ static int journal_get_superblock(journal_t *journal)
>  	bh = journal->j_sb_buffer;
>  
>  	J_ASSERT(bh != NULL);
> -	if (buffer_verified(bh))
> -		return 0;
>  
>  	err = bh_read(bh, 0);
>  	if (err < 0) {
> @@ -1437,7 +1435,6 @@ static int journal_get_superblock(journal_t *journal)
>  			goto out;
>  		}
>  	}
> -	set_buffer_verified(bh);
>  	return 0;
>  
>  out:
> @@ -2224,8 +2221,6 @@ int jbd2_journal_check_used_features(journal_t *journal, unsigned long compat,
>  
>  	if (!compat && !ro && !incompat)
>  		return 1;
> -	if (journal_get_superblock(journal))
> -		return 0;
>  	if (!jbd2_format_support_feature(journal))
>  		return 0;
>  
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index b247d374e7a6..c7cdb434966f 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1361,8 +1361,6 @@  static int journal_get_superblock(journal_t *journal)
 	bh = journal->j_sb_buffer;
 
 	J_ASSERT(bh != NULL);
-	if (buffer_verified(bh))
-		return 0;
 
 	err = bh_read(bh, 0);
 	if (err < 0) {
@@ -1437,7 +1435,6 @@  static int journal_get_superblock(journal_t *journal)
 			goto out;
 		}
 	}
-	set_buffer_verified(bh);
 	return 0;
 
 out:
@@ -2224,8 +2221,6 @@  int jbd2_journal_check_used_features(journal_t *journal, unsigned long compat,
 
 	if (!compat && !ro && !incompat)
 		return 1;
-	if (journal_get_superblock(journal))
-		return 0;
 	if (!jbd2_format_support_feature(journal))
 		return 0;