diff mbox series

[6/9] jbd2: use bh_in instead of jh2bh(jh_in) to simplify code

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

Commit Message

Kemeng Shi May 6, 2024, 2:17 p.m. UTC
We save jh2bh(jh_in) to bh_in, so use bh_in directly instead of
jh2bh(jh_in) to simplify the code.

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

Comments

Zhang Yi May 7, 2024, 1:13 p.m. UTC | #1
On 2024/5/6 22:17, Kemeng Shi wrote:
> We save jh2bh(jh_in) to bh_in, so use bh_in directly instead of
> jh2bh(jh_in) to simplify the code.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>

Looks good to me.

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

> ---
>  fs/jbd2/journal.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index 87f558bd2e8a..01e33b643e4d 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -363,8 +363,8 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
>  		new_folio = virt_to_folio(jh_in->b_frozen_data);
>  		new_offset = offset_in_folio(new_folio, jh_in->b_frozen_data);
>  	} else {
> -		new_folio = jh2bh(jh_in)->b_folio;
> -		new_offset = offset_in_folio(new_folio, jh2bh(jh_in)->b_data);
> +		new_folio = bh_in->b_folio;
> +		new_offset = offset_in_folio(new_folio, bh_in->b_data);
>  	}
>  
>  	mapped_data = kmap_local_folio(new_folio, new_offset);
>
Jan Kara May 12, 2024, 11:14 a.m. UTC | #2
On Mon 06-05-24 22:17:58, Kemeng Shi wrote:
> We save jh2bh(jh_in) to bh_in, so use bh_in directly instead of
> jh2bh(jh_in) to simplify the code.
> 
> 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 | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index 87f558bd2e8a..01e33b643e4d 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -363,8 +363,8 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
>  		new_folio = virt_to_folio(jh_in->b_frozen_data);
>  		new_offset = offset_in_folio(new_folio, jh_in->b_frozen_data);
>  	} else {
> -		new_folio = jh2bh(jh_in)->b_folio;
> -		new_offset = offset_in_folio(new_folio, jh2bh(jh_in)->b_data);
> +		new_folio = bh_in->b_folio;
> +		new_offset = offset_in_folio(new_folio, bh_in->b_data);
>  	}
>  
>  	mapped_data = kmap_local_folio(new_folio, new_offset);
> -- 
> 2.30.0
>
diff mbox series

Patch

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 87f558bd2e8a..01e33b643e4d 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -363,8 +363,8 @@  int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
 		new_folio = virt_to_folio(jh_in->b_frozen_data);
 		new_offset = offset_in_folio(new_folio, jh_in->b_frozen_data);
 	} else {
-		new_folio = jh2bh(jh_in)->b_folio;
-		new_offset = offset_in_folio(new_folio, jh2bh(jh_in)->b_data);
+		new_folio = bh_in->b_folio;
+		new_offset = offset_in_folio(new_folio, bh_in->b_data);
 	}
 
 	mapped_data = kmap_local_folio(new_folio, new_offset);