[PATCH] jbd2: remove jbd2_journal_unfile_buffer()

libaokun@huaweicloud.com posted 1 patch 11 months, 1 week ago
fs/jbd2/transaction.c | 15 ---------------
include/linux/jbd2.h  |  1 -
2 files changed, 16 deletions(-)
[PATCH] jbd2: remove jbd2_journal_unfile_buffer()
Posted by libaokun@huaweicloud.com 11 months, 1 week ago
From: Baokun Li <libaokun1@huawei.com>

Since the function jbd2_journal_unfile_buffer() is no longer called
anywhere after commit e5a120aeb57f ("jbd2: remove journal_head from
descriptor buffers"), so let's remove it.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
 fs/jbd2/transaction.c | 15 ---------------
 include/linux/jbd2.h  |  1 -
 2 files changed, 16 deletions(-)

diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 9fe17e290c21..2bc14291a0fb 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -2078,21 +2078,6 @@ static void __jbd2_journal_unfile_buffer(struct journal_head *jh)
 	jh->b_transaction = NULL;
 }
 
-void jbd2_journal_unfile_buffer(journal_t *journal, struct journal_head *jh)
-{
-	struct buffer_head *bh = jh2bh(jh);
-
-	/* Get reference so that buffer cannot be freed before we unlock it */
-	get_bh(bh);
-	spin_lock(&jh->b_state_lock);
-	spin_lock(&journal->j_list_lock);
-	__jbd2_journal_unfile_buffer(jh);
-	spin_unlock(&journal->j_list_lock);
-	spin_unlock(&jh->b_state_lock);
-	jbd2_journal_put_journal_head(jh);
-	__brelse(bh);
-}
-
 /**
  * jbd2_journal_try_to_free_buffers() - try to free page buffers.
  * @journal: journal for operation
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 82ef232935c0..2205c99beff4 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1401,7 +1401,6 @@ JBD2_FEATURE_INCOMPAT_FUNCS(fast_commit,	FAST_COMMIT)
  */
 
 /* Filing buffers */
-extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *);
 extern bool __jbd2_journal_refile_buffer(struct journal_head *);
 extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *);
 extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int);
-- 
2.46.1
Re: [PATCH] jbd2: remove jbd2_journal_unfile_buffer()
Posted by Theodore Ts'o 10 months, 3 weeks ago
On Thu, 06 Mar 2025 14:32:40 +0800, libaokun@huaweicloud.com wrote:
> Since the function jbd2_journal_unfile_buffer() is no longer called
> anywhere after commit e5a120aeb57f ("jbd2: remove journal_head from
> descriptor buffers"), so let's remove it.
> 
> 

Applied, thanks!

[1/1] jbd2: remove jbd2_journal_unfile_buffer()
      commit: a015c4e6d19cf5e589d4ac877fa7cb7f4ee01094

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>
Re: [PATCH] jbd2: remove jbd2_journal_unfile_buffer()
Posted by Zhang Yi 11 months, 1 week ago
On 2025/3/6 14:32, libaokun@huaweicloud.com wrote:
> From: Baokun Li <libaokun1@huawei.com>
> 
> Since the function jbd2_journal_unfile_buffer() is no longer called
> anywhere after commit e5a120aeb57f ("jbd2: remove journal_head from
> descriptor buffers"), so let's remove it.
> 
> Signed-off-by: Baokun Li <libaokun1@huawei.com>

Looks good to me.

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

> ---
>  fs/jbd2/transaction.c | 15 ---------------
>  include/linux/jbd2.h  |  1 -
>  2 files changed, 16 deletions(-)
> 
> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
> index 9fe17e290c21..2bc14291a0fb 100644
> --- a/fs/jbd2/transaction.c
> +++ b/fs/jbd2/transaction.c
> @@ -2078,21 +2078,6 @@ static void __jbd2_journal_unfile_buffer(struct journal_head *jh)
>  	jh->b_transaction = NULL;
>  }
>  
> -void jbd2_journal_unfile_buffer(journal_t *journal, struct journal_head *jh)
> -{
> -	struct buffer_head *bh = jh2bh(jh);
> -
> -	/* Get reference so that buffer cannot be freed before we unlock it */
> -	get_bh(bh);
> -	spin_lock(&jh->b_state_lock);
> -	spin_lock(&journal->j_list_lock);
> -	__jbd2_journal_unfile_buffer(jh);
> -	spin_unlock(&journal->j_list_lock);
> -	spin_unlock(&jh->b_state_lock);
> -	jbd2_journal_put_journal_head(jh);
> -	__brelse(bh);
> -}
> -
>  /**
>   * jbd2_journal_try_to_free_buffers() - try to free page buffers.
>   * @journal: journal for operation
> diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
> index 82ef232935c0..2205c99beff4 100644
> --- a/include/linux/jbd2.h
> +++ b/include/linux/jbd2.h
> @@ -1401,7 +1401,6 @@ JBD2_FEATURE_INCOMPAT_FUNCS(fast_commit,	FAST_COMMIT)
>   */
>  
>  /* Filing buffers */
> -extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *);
>  extern bool __jbd2_journal_refile_buffer(struct journal_head *);
>  extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *);
>  extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int);
Re: [PATCH] jbd2: remove jbd2_journal_unfile_buffer()
Posted by Jan Kara 11 months, 1 week ago
On Thu 06-03-25 14:32:40, libaokun@huaweicloud.com wrote:
> From: Baokun Li <libaokun1@huawei.com>
> 
> Since the function jbd2_journal_unfile_buffer() is no longer called
> anywhere after commit e5a120aeb57f ("jbd2: remove journal_head from
> descriptor buffers"), so let's remove it.
> 
> Signed-off-by: Baokun Li <libaokun1@huawei.com>

Nice! Feel free to add:

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

								Honza
> ---
>  fs/jbd2/transaction.c | 15 ---------------
>  include/linux/jbd2.h  |  1 -
>  2 files changed, 16 deletions(-)
> 
> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
> index 9fe17e290c21..2bc14291a0fb 100644
> --- a/fs/jbd2/transaction.c
> +++ b/fs/jbd2/transaction.c
> @@ -2078,21 +2078,6 @@ static void __jbd2_journal_unfile_buffer(struct journal_head *jh)
>  	jh->b_transaction = NULL;
>  }
>  
> -void jbd2_journal_unfile_buffer(journal_t *journal, struct journal_head *jh)
> -{
> -	struct buffer_head *bh = jh2bh(jh);
> -
> -	/* Get reference so that buffer cannot be freed before we unlock it */
> -	get_bh(bh);
> -	spin_lock(&jh->b_state_lock);
> -	spin_lock(&journal->j_list_lock);
> -	__jbd2_journal_unfile_buffer(jh);
> -	spin_unlock(&journal->j_list_lock);
> -	spin_unlock(&jh->b_state_lock);
> -	jbd2_journal_put_journal_head(jh);
> -	__brelse(bh);
> -}
> -
>  /**
>   * jbd2_journal_try_to_free_buffers() - try to free page buffers.
>   * @journal: journal for operation
> diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
> index 82ef232935c0..2205c99beff4 100644
> --- a/include/linux/jbd2.h
> +++ b/include/linux/jbd2.h
> @@ -1401,7 +1401,6 @@ JBD2_FEATURE_INCOMPAT_FUNCS(fast_commit,	FAST_COMMIT)
>   */
>  
>  /* Filing buffers */
> -extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *);
>  extern bool __jbd2_journal_refile_buffer(struct journal_head *);
>  extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *);
>  extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int);
> -- 
> 2.46.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR