linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Minor cleanups to ext4 and jbd2
@ 2024-12-17 12:03 Kemeng Shi
  2024-12-17 12:03 ` [PATCH 1/3] ext4: remove unused ext4 journal callback Kemeng Shi
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Kemeng Shi @ 2024-12-17 12:03 UTC (permalink / raw)
  To: tytso, adilger.kernel, jack
  Cc: dennis.lamerice, linux-doc, linux-kernel, linux-ext4

Patch 1 remove unused ext4 journal callback
patch 2 remove transaction->t_private_list which is only used by ext4
journal callback
Patch 3 remove unneeded forward declaration of
ext4_destroy_lazyinit_thread().

More details can be found in respective patches. Thanks.

Kemeng Shi (3):
  ext4: remove unused ext4 journal callback
  jbd2: remove unused transaction->t_private_list
  ext4: remove unneeded forward declaration

 Documentation/filesystems/journalling.rst |  2 -
 fs/ext4/ext4_jbd2.h                       | 84 -----------------------
 fs/ext4/super.c                           | 15 ----
 fs/jbd2/transaction.c                     |  1 -
 include/linux/jbd2.h                      |  6 --
 5 files changed, 108 deletions(-)

-- 
2.30.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/3] ext4: remove unused ext4 journal callback
  2024-12-17 12:03 [PATCH 0/3] Minor cleanups to ext4 and jbd2 Kemeng Shi
@ 2024-12-17 12:03 ` Kemeng Shi
  2024-12-18  3:40   ` Zhang Yi
  2024-12-18 11:35   ` Jan Kara
  2024-12-17 12:03 ` [PATCH 2/3] jbd2: remove unused transaction->t_private_list Kemeng Shi
  2024-12-17 12:03 ` [PATCH 3/3] ext4: remove unneeded forward declaration Kemeng Shi
  2 siblings, 2 replies; 11+ messages in thread
From: Kemeng Shi @ 2024-12-17 12:03 UTC (permalink / raw)
  To: tytso, adilger.kernel, jack
  Cc: dennis.lamerice, linux-doc, linux-kernel, linux-ext4

Remove unused ext4 journal callback.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 fs/ext4/ext4_jbd2.h | 84 ---------------------------------------------
 fs/ext4/super.c     | 14 --------
 2 files changed, 98 deletions(-)

diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index 0c77697d5e90..3f2596c9e5f2 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -122,90 +122,6 @@
 #define EXT4_HT_EXT_CONVERT     11
 #define EXT4_HT_MAX             12
 
-/**
- *   struct ext4_journal_cb_entry - Base structure for callback information.
- *
- *   This struct is a 'seed' structure for a using with your own callback
- *   structs. If you are using callbacks you must allocate one of these
- *   or another struct of your own definition which has this struct
- *   as it's first element and pass it to ext4_journal_callback_add().
- */
-struct ext4_journal_cb_entry {
-	/* list information for other callbacks attached to the same handle */
-	struct list_head jce_list;
-
-	/*  Function to call with this callback structure */
-	void (*jce_func)(struct super_block *sb,
-			 struct ext4_journal_cb_entry *jce, int error);
-
-	/* user data goes here */
-};
-
-/**
- * ext4_journal_callback_add: add a function to call after transaction commit
- * @handle: active journal transaction handle to register callback on
- * @func: callback function to call after the transaction has committed:
- *        @sb: superblock of current filesystem for transaction
- *        @jce: returned journal callback data
- *        @rc: journal state at commit (0 = transaction committed properly)
- * @jce: journal callback data (internal and function private data struct)
- *
- * The registered function will be called in the context of the journal thread
- * after the transaction for which the handle was created has completed.
- *
- * No locks are held when the callback function is called, so it is safe to
- * call blocking functions from within the callback, but the callback should
- * not block or run for too long, or the filesystem will be blocked waiting for
- * the next transaction to commit. No journaling functions can be used, or
- * there is a risk of deadlock.
- *
- * There is no guaranteed calling order of multiple registered callbacks on
- * the same transaction.
- */
-static inline void _ext4_journal_callback_add(handle_t *handle,
-			struct ext4_journal_cb_entry *jce)
-{
-	/* Add the jce to transaction's private list */
-	list_add_tail(&jce->jce_list, &handle->h_transaction->t_private_list);
-}
-
-static inline void ext4_journal_callback_add(handle_t *handle,
-			void (*func)(struct super_block *sb,
-				     struct ext4_journal_cb_entry *jce,
-				     int rc),
-			struct ext4_journal_cb_entry *jce)
-{
-	struct ext4_sb_info *sbi =
-			EXT4_SB(handle->h_transaction->t_journal->j_private);
-
-	/* Add the jce to transaction's private list */
-	jce->jce_func = func;
-	spin_lock(&sbi->s_md_lock);
-	_ext4_journal_callback_add(handle, jce);
-	spin_unlock(&sbi->s_md_lock);
-}
-
-
-/**
- * ext4_journal_callback_del: delete a registered callback
- * @handle: active journal transaction handle on which callback was registered
- * @jce: registered journal callback entry to unregister
- * Return true if object was successfully removed
- */
-static inline bool ext4_journal_callback_try_del(handle_t *handle,
-					     struct ext4_journal_cb_entry *jce)
-{
-	bool deleted;
-	struct ext4_sb_info *sbi =
-			EXT4_SB(handle->h_transaction->t_journal->j_private);
-
-	spin_lock(&sbi->s_md_lock);
-	deleted = !list_empty(&jce->jce_list);
-	list_del_init(&jce->jce_list);
-	spin_unlock(&sbi->s_md_lock);
-	return deleted;
-}
-
 int
 ext4_mark_iloc_dirty(handle_t *handle,
 		     struct inode *inode,
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index a09f4621b10d..8dfda41dabaa 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -502,25 +502,11 @@ static void ext4_maybe_update_superblock(struct super_block *sb)
 static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn)
 {
 	struct super_block		*sb = journal->j_private;
-	struct ext4_sb_info		*sbi = EXT4_SB(sb);
-	int				error = is_journal_aborted(journal);
-	struct ext4_journal_cb_entry	*jce;
 
 	BUG_ON(txn->t_state == T_FINISHED);
 
 	ext4_process_freed_data(sb, txn->t_tid);
 	ext4_maybe_update_superblock(sb);
-
-	spin_lock(&sbi->s_md_lock);
-	while (!list_empty(&txn->t_private_list)) {
-		jce = list_entry(txn->t_private_list.next,
-				 struct ext4_journal_cb_entry, jce_list);
-		list_del_init(&jce->jce_list);
-		spin_unlock(&sbi->s_md_lock);
-		jce->jce_func(sb, jce, error);
-		spin_lock(&sbi->s_md_lock);
-	}
-	spin_unlock(&sbi->s_md_lock);
 }
 
 /*
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/3] jbd2: remove unused transaction->t_private_list
  2024-12-17 12:03 [PATCH 0/3] Minor cleanups to ext4 and jbd2 Kemeng Shi
  2024-12-17 12:03 ` [PATCH 1/3] ext4: remove unused ext4 journal callback Kemeng Shi
@ 2024-12-17 12:03 ` Kemeng Shi
  2024-12-17 18:02   ` Matthew Wilcox
  2024-12-18 11:36   ` Jan Kara
  2024-12-17 12:03 ` [PATCH 3/3] ext4: remove unneeded forward declaration Kemeng Shi
  2 siblings, 2 replies; 11+ messages in thread
From: Kemeng Shi @ 2024-12-17 12:03 UTC (permalink / raw)
  To: tytso, adilger.kernel, jack
  Cc: dennis.lamerice, linux-doc, linux-kernel, linux-ext4

After we remove ext4 journal callback, transaction->t_private_list is
not used anymore. Just remove unused transaction->t_private_list.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 Documentation/filesystems/journalling.rst | 2 --
 fs/jbd2/transaction.c                     | 1 -
 include/linux/jbd2.h                      | 6 ------
 3 files changed, 9 deletions(-)

diff --git a/Documentation/filesystems/journalling.rst b/Documentation/filesystems/journalling.rst
index 0254f7d57429..74f6aa2e1009 100644
--- a/Documentation/filesystems/journalling.rst
+++ b/Documentation/filesystems/journalling.rst
@@ -112,8 +112,6 @@ so that you can do some of your own management. You ask the journalling
 layer for calling the callback by simply setting
 ``journal->j_commit_callback`` function pointer and that function is
 called after each transaction commit. You can also use
-``transaction->t_private_list`` for attaching entries to a transaction
-that need processing when the transaction commits.
 
 JBD2 also provides a way to block all transaction updates via
 jbd2_journal_lock_updates() /
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 66513c18ca29..9fe17e290c21 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -92,7 +92,6 @@ static void jbd2_get_transaction(journal_t *journal,
 	atomic_set(&transaction->t_outstanding_revokes, 0);
 	atomic_set(&transaction->t_handle_count, 0);
 	INIT_LIST_HEAD(&transaction->t_inode_list);
-	INIT_LIST_HEAD(&transaction->t_private_list);
 
 	/* Set up the commit timer for the new transaction. */
 	journal->j_commit_timer.expires = round_jiffies_up(transaction->t_expires);
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 50f7ea8714bf..90c802e48e23 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -700,12 +700,6 @@ struct transaction_s
 
 	/* Disk flush needs to be sent to fs partition [no locking] */
 	int			t_need_data_flush;
-
-	/*
-	 * For use by the filesystem to store fs-specific data
-	 * structures associated with the transaction
-	 */
-	struct list_head	t_private_list;
 };
 
 struct transaction_run_stats_s {
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/3] ext4: remove unneeded forward declaration
  2024-12-17 12:03 [PATCH 0/3] Minor cleanups to ext4 and jbd2 Kemeng Shi
  2024-12-17 12:03 ` [PATCH 1/3] ext4: remove unused ext4 journal callback Kemeng Shi
  2024-12-17 12:03 ` [PATCH 2/3] jbd2: remove unused transaction->t_private_list Kemeng Shi
@ 2024-12-17 12:03 ` Kemeng Shi
  2024-12-18  3:43   ` Zhang Yi
  2024-12-18 11:37   ` Jan Kara
  2 siblings, 2 replies; 11+ messages in thread
From: Kemeng Shi @ 2024-12-17 12:03 UTC (permalink / raw)
  To: tytso, adilger.kernel, jack
  Cc: dennis.lamerice, linux-doc, linux-kernel, linux-ext4

Remove unneeded forward declaration of ext4_destroy_lazyinit_thread().

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 fs/ext4/super.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 8dfda41dabaa..d294cd43d3f2 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -79,7 +79,6 @@ static int ext4_unfreeze(struct super_block *sb);
 static int ext4_freeze(struct super_block *sb);
 static inline int ext2_feature_set_ok(struct super_block *sb);
 static inline int ext3_feature_set_ok(struct super_block *sb);
-static void ext4_destroy_lazyinit_thread(void);
 static void ext4_unregister_li_request(struct super_block *sb);
 static void ext4_clear_request_list(void);
 static struct inode *ext4_get_journal_inode(struct super_block *sb,
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] jbd2: remove unused transaction->t_private_list
  2024-12-17 12:03 ` [PATCH 2/3] jbd2: remove unused transaction->t_private_list Kemeng Shi
@ 2024-12-17 18:02   ` Matthew Wilcox
  2024-12-18  3:26     ` Kemeng Shi
  2024-12-18 11:36   ` Jan Kara
  1 sibling, 1 reply; 11+ messages in thread
From: Matthew Wilcox @ 2024-12-17 18:02 UTC (permalink / raw)
  To: Kemeng Shi
  Cc: tytso, adilger.kernel, jack, dennis.lamerice, linux-doc,
	linux-kernel, linux-ext4

On Tue, Dec 17, 2024 at 08:03:55PM +0800, Kemeng Shi wrote:
> +++ b/Documentation/filesystems/journalling.rst
> @@ -112,8 +112,6 @@ so that you can do some of your own management. You ask the journalling
>  layer for calling the callback by simply setting
>  ``journal->j_commit_callback`` function pointer and that function is
>  called after each transaction commit. You can also use
> -``transaction->t_private_list`` for attaching entries to a transaction
> -that need processing when the transaction commits.

I think this also needs:

-called after each transaction commit. You can also use
+called after each transaction commit.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] jbd2: remove unused transaction->t_private_list
  2024-12-17 18:02   ` Matthew Wilcox
@ 2024-12-18  3:26     ` Kemeng Shi
  0 siblings, 0 replies; 11+ messages in thread
From: Kemeng Shi @ 2024-12-18  3:26 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: tytso, adilger.kernel, jack, dennis.lamerice, linux-doc,
	linux-kernel, linux-ext4



on 12/18/2024 2:02 AM, Matthew Wilcox wrote:
> On Tue, Dec 17, 2024 at 08:03:55PM +0800, Kemeng Shi wrote:
>> +++ b/Documentation/filesystems/journalling.rst
>> @@ -112,8 +112,6 @@ so that you can do some of your own management. You ask the journalling
>>  layer for calling the callback by simply setting
>>  ``journal->j_commit_callback`` function pointer and that function is
>>  called after each transaction commit. You can also use
>> -``transaction->t_private_list`` for attaching entries to a transaction
>> -that need processing when the transaction commits.
> 
> I think this also needs:
> 
> -called after each transaction commit. You can also use
> +called after each transaction commit.
> 
Sure, thanks for correcting. Will fix in next version.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] ext4: remove unused ext4 journal callback
  2024-12-17 12:03 ` [PATCH 1/3] ext4: remove unused ext4 journal callback Kemeng Shi
@ 2024-12-18  3:40   ` Zhang Yi
  2024-12-18 11:35   ` Jan Kara
  1 sibling, 0 replies; 11+ messages in thread
From: Zhang Yi @ 2024-12-18  3:40 UTC (permalink / raw)
  To: Kemeng Shi
  Cc: dennis.lamerice, linux-doc, linux-kernel, linux-ext4, tytso,
	adilger.kernel, jack

On 2024/12/17 20:03, Kemeng Shi wrote:
> Remove unused ext4 journal callback.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>

Looks good to me.

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

> ---
>  fs/ext4/ext4_jbd2.h | 84 ---------------------------------------------
>  fs/ext4/super.c     | 14 --------
>  2 files changed, 98 deletions(-)
> 
> diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
> index 0c77697d5e90..3f2596c9e5f2 100644
> --- a/fs/ext4/ext4_jbd2.h
> +++ b/fs/ext4/ext4_jbd2.h
> @@ -122,90 +122,6 @@
>  #define EXT4_HT_EXT_CONVERT     11
>  #define EXT4_HT_MAX             12
>  
> -/**
> - *   struct ext4_journal_cb_entry - Base structure for callback information.
> - *
> - *   This struct is a 'seed' structure for a using with your own callback
> - *   structs. If you are using callbacks you must allocate one of these
> - *   or another struct of your own definition which has this struct
> - *   as it's first element and pass it to ext4_journal_callback_add().
> - */
> -struct ext4_journal_cb_entry {
> -	/* list information for other callbacks attached to the same handle */
> -	struct list_head jce_list;
> -
> -	/*  Function to call with this callback structure */
> -	void (*jce_func)(struct super_block *sb,
> -			 struct ext4_journal_cb_entry *jce, int error);
> -
> -	/* user data goes here */
> -};
> -
> -/**
> - * ext4_journal_callback_add: add a function to call after transaction commit
> - * @handle: active journal transaction handle to register callback on
> - * @func: callback function to call after the transaction has committed:
> - *        @sb: superblock of current filesystem for transaction
> - *        @jce: returned journal callback data
> - *        @rc: journal state at commit (0 = transaction committed properly)
> - * @jce: journal callback data (internal and function private data struct)
> - *
> - * The registered function will be called in the context of the journal thread
> - * after the transaction for which the handle was created has completed.
> - *
> - * No locks are held when the callback function is called, so it is safe to
> - * call blocking functions from within the callback, but the callback should
> - * not block or run for too long, or the filesystem will be blocked waiting for
> - * the next transaction to commit. No journaling functions can be used, or
> - * there is a risk of deadlock.
> - *
> - * There is no guaranteed calling order of multiple registered callbacks on
> - * the same transaction.
> - */
> -static inline void _ext4_journal_callback_add(handle_t *handle,
> -			struct ext4_journal_cb_entry *jce)
> -{
> -	/* Add the jce to transaction's private list */
> -	list_add_tail(&jce->jce_list, &handle->h_transaction->t_private_list);
> -}
> -
> -static inline void ext4_journal_callback_add(handle_t *handle,
> -			void (*func)(struct super_block *sb,
> -				     struct ext4_journal_cb_entry *jce,
> -				     int rc),
> -			struct ext4_journal_cb_entry *jce)
> -{
> -	struct ext4_sb_info *sbi =
> -			EXT4_SB(handle->h_transaction->t_journal->j_private);
> -
> -	/* Add the jce to transaction's private list */
> -	jce->jce_func = func;
> -	spin_lock(&sbi->s_md_lock);
> -	_ext4_journal_callback_add(handle, jce);
> -	spin_unlock(&sbi->s_md_lock);
> -}
> -
> -
> -/**
> - * ext4_journal_callback_del: delete a registered callback
> - * @handle: active journal transaction handle on which callback was registered
> - * @jce: registered journal callback entry to unregister
> - * Return true if object was successfully removed
> - */
> -static inline bool ext4_journal_callback_try_del(handle_t *handle,
> -					     struct ext4_journal_cb_entry *jce)
> -{
> -	bool deleted;
> -	struct ext4_sb_info *sbi =
> -			EXT4_SB(handle->h_transaction->t_journal->j_private);
> -
> -	spin_lock(&sbi->s_md_lock);
> -	deleted = !list_empty(&jce->jce_list);
> -	list_del_init(&jce->jce_list);
> -	spin_unlock(&sbi->s_md_lock);
> -	return deleted;
> -}
> -
>  int
>  ext4_mark_iloc_dirty(handle_t *handle,
>  		     struct inode *inode,
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index a09f4621b10d..8dfda41dabaa 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -502,25 +502,11 @@ static void ext4_maybe_update_superblock(struct super_block *sb)
>  static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn)
>  {
>  	struct super_block		*sb = journal->j_private;
> -	struct ext4_sb_info		*sbi = EXT4_SB(sb);
> -	int				error = is_journal_aborted(journal);
> -	struct ext4_journal_cb_entry	*jce;
>  
>  	BUG_ON(txn->t_state == T_FINISHED);
>  
>  	ext4_process_freed_data(sb, txn->t_tid);
>  	ext4_maybe_update_superblock(sb);
> -
> -	spin_lock(&sbi->s_md_lock);
> -	while (!list_empty(&txn->t_private_list)) {
> -		jce = list_entry(txn->t_private_list.next,
> -				 struct ext4_journal_cb_entry, jce_list);
> -		list_del_init(&jce->jce_list);
> -		spin_unlock(&sbi->s_md_lock);
> -		jce->jce_func(sb, jce, error);
> -		spin_lock(&sbi->s_md_lock);
> -	}
> -	spin_unlock(&sbi->s_md_lock);
>  }
>  
>  /*


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] ext4: remove unneeded forward declaration
  2024-12-17 12:03 ` [PATCH 3/3] ext4: remove unneeded forward declaration Kemeng Shi
@ 2024-12-18  3:43   ` Zhang Yi
  2024-12-18 11:37   ` Jan Kara
  1 sibling, 0 replies; 11+ messages in thread
From: Zhang Yi @ 2024-12-18  3:43 UTC (permalink / raw)
  To: Kemeng Shi
  Cc: dennis.lamerice, linux-doc, linux-kernel, linux-ext4, tytso,
	adilger.kernel, jack

On 2024/12/17 20:03, Kemeng Shi wrote:
> Remove unneeded forward declaration of ext4_destroy_lazyinit_thread().
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>

Looks good to me.

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

> ---
>  fs/ext4/super.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 8dfda41dabaa..d294cd43d3f2 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -79,7 +79,6 @@ static int ext4_unfreeze(struct super_block *sb);
>  static int ext4_freeze(struct super_block *sb);
>  static inline int ext2_feature_set_ok(struct super_block *sb);
>  static inline int ext3_feature_set_ok(struct super_block *sb);
> -static void ext4_destroy_lazyinit_thread(void);
>  static void ext4_unregister_li_request(struct super_block *sb);
>  static void ext4_clear_request_list(void);
>  static struct inode *ext4_get_journal_inode(struct super_block *sb,


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] ext4: remove unused ext4 journal callback
  2024-12-17 12:03 ` [PATCH 1/3] ext4: remove unused ext4 journal callback Kemeng Shi
  2024-12-18  3:40   ` Zhang Yi
@ 2024-12-18 11:35   ` Jan Kara
  1 sibling, 0 replies; 11+ messages in thread
From: Jan Kara @ 2024-12-18 11:35 UTC (permalink / raw)
  To: Kemeng Shi
  Cc: tytso, adilger.kernel, jack, dennis.lamerice, linux-doc,
	linux-kernel, linux-ext4

On Tue 17-12-24 20:03:54, Kemeng Shi wrote:
> Remove unused ext4 journal callback.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>

Looks good to me. Feel free to add:

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

								Honza

> ---
>  fs/ext4/ext4_jbd2.h | 84 ---------------------------------------------
>  fs/ext4/super.c     | 14 --------
>  2 files changed, 98 deletions(-)
> 
> diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
> index 0c77697d5e90..3f2596c9e5f2 100644
> --- a/fs/ext4/ext4_jbd2.h
> +++ b/fs/ext4/ext4_jbd2.h
> @@ -122,90 +122,6 @@
>  #define EXT4_HT_EXT_CONVERT     11
>  #define EXT4_HT_MAX             12
>  
> -/**
> - *   struct ext4_journal_cb_entry - Base structure for callback information.
> - *
> - *   This struct is a 'seed' structure for a using with your own callback
> - *   structs. If you are using callbacks you must allocate one of these
> - *   or another struct of your own definition which has this struct
> - *   as it's first element and pass it to ext4_journal_callback_add().
> - */
> -struct ext4_journal_cb_entry {
> -	/* list information for other callbacks attached to the same handle */
> -	struct list_head jce_list;
> -
> -	/*  Function to call with this callback structure */
> -	void (*jce_func)(struct super_block *sb,
> -			 struct ext4_journal_cb_entry *jce, int error);
> -
> -	/* user data goes here */
> -};
> -
> -/**
> - * ext4_journal_callback_add: add a function to call after transaction commit
> - * @handle: active journal transaction handle to register callback on
> - * @func: callback function to call after the transaction has committed:
> - *        @sb: superblock of current filesystem for transaction
> - *        @jce: returned journal callback data
> - *        @rc: journal state at commit (0 = transaction committed properly)
> - * @jce: journal callback data (internal and function private data struct)
> - *
> - * The registered function will be called in the context of the journal thread
> - * after the transaction for which the handle was created has completed.
> - *
> - * No locks are held when the callback function is called, so it is safe to
> - * call blocking functions from within the callback, but the callback should
> - * not block or run for too long, or the filesystem will be blocked waiting for
> - * the next transaction to commit. No journaling functions can be used, or
> - * there is a risk of deadlock.
> - *
> - * There is no guaranteed calling order of multiple registered callbacks on
> - * the same transaction.
> - */
> -static inline void _ext4_journal_callback_add(handle_t *handle,
> -			struct ext4_journal_cb_entry *jce)
> -{
> -	/* Add the jce to transaction's private list */
> -	list_add_tail(&jce->jce_list, &handle->h_transaction->t_private_list);
> -}
> -
> -static inline void ext4_journal_callback_add(handle_t *handle,
> -			void (*func)(struct super_block *sb,
> -				     struct ext4_journal_cb_entry *jce,
> -				     int rc),
> -			struct ext4_journal_cb_entry *jce)
> -{
> -	struct ext4_sb_info *sbi =
> -			EXT4_SB(handle->h_transaction->t_journal->j_private);
> -
> -	/* Add the jce to transaction's private list */
> -	jce->jce_func = func;
> -	spin_lock(&sbi->s_md_lock);
> -	_ext4_journal_callback_add(handle, jce);
> -	spin_unlock(&sbi->s_md_lock);
> -}
> -
> -
> -/**
> - * ext4_journal_callback_del: delete a registered callback
> - * @handle: active journal transaction handle on which callback was registered
> - * @jce: registered journal callback entry to unregister
> - * Return true if object was successfully removed
> - */
> -static inline bool ext4_journal_callback_try_del(handle_t *handle,
> -					     struct ext4_journal_cb_entry *jce)
> -{
> -	bool deleted;
> -	struct ext4_sb_info *sbi =
> -			EXT4_SB(handle->h_transaction->t_journal->j_private);
> -
> -	spin_lock(&sbi->s_md_lock);
> -	deleted = !list_empty(&jce->jce_list);
> -	list_del_init(&jce->jce_list);
> -	spin_unlock(&sbi->s_md_lock);
> -	return deleted;
> -}
> -
>  int
>  ext4_mark_iloc_dirty(handle_t *handle,
>  		     struct inode *inode,
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index a09f4621b10d..8dfda41dabaa 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -502,25 +502,11 @@ static void ext4_maybe_update_superblock(struct super_block *sb)
>  static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn)
>  {
>  	struct super_block		*sb = journal->j_private;
> -	struct ext4_sb_info		*sbi = EXT4_SB(sb);
> -	int				error = is_journal_aborted(journal);
> -	struct ext4_journal_cb_entry	*jce;
>  
>  	BUG_ON(txn->t_state == T_FINISHED);
>  
>  	ext4_process_freed_data(sb, txn->t_tid);
>  	ext4_maybe_update_superblock(sb);
> -
> -	spin_lock(&sbi->s_md_lock);
> -	while (!list_empty(&txn->t_private_list)) {
> -		jce = list_entry(txn->t_private_list.next,
> -				 struct ext4_journal_cb_entry, jce_list);
> -		list_del_init(&jce->jce_list);
> -		spin_unlock(&sbi->s_md_lock);
> -		jce->jce_func(sb, jce, error);
> -		spin_lock(&sbi->s_md_lock);
> -	}
> -	spin_unlock(&sbi->s_md_lock);
>  }
>  
>  /*
> -- 
> 2.30.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] jbd2: remove unused transaction->t_private_list
  2024-12-17 12:03 ` [PATCH 2/3] jbd2: remove unused transaction->t_private_list Kemeng Shi
  2024-12-17 18:02   ` Matthew Wilcox
@ 2024-12-18 11:36   ` Jan Kara
  1 sibling, 0 replies; 11+ messages in thread
From: Jan Kara @ 2024-12-18 11:36 UTC (permalink / raw)
  To: Kemeng Shi
  Cc: tytso, adilger.kernel, jack, dennis.lamerice, linux-doc,
	linux-kernel, linux-ext4

On Tue 17-12-24 20:03:55, Kemeng Shi wrote:
> After we remove ext4 journal callback, transaction->t_private_list is
> not used anymore. Just remove unused transaction->t_private_list.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>

After the doc fixup feel free to add:

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

								Honza

> ---
>  Documentation/filesystems/journalling.rst | 2 --
>  fs/jbd2/transaction.c                     | 1 -
>  include/linux/jbd2.h                      | 6 ------
>  3 files changed, 9 deletions(-)
> 
> diff --git a/Documentation/filesystems/journalling.rst b/Documentation/filesystems/journalling.rst
> index 0254f7d57429..74f6aa2e1009 100644
> --- a/Documentation/filesystems/journalling.rst
> +++ b/Documentation/filesystems/journalling.rst
> @@ -112,8 +112,6 @@ so that you can do some of your own management. You ask the journalling
>  layer for calling the callback by simply setting
>  ``journal->j_commit_callback`` function pointer and that function is
>  called after each transaction commit. You can also use
> -``transaction->t_private_list`` for attaching entries to a transaction
> -that need processing when the transaction commits.
>  
>  JBD2 also provides a way to block all transaction updates via
>  jbd2_journal_lock_updates() /
> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
> index 66513c18ca29..9fe17e290c21 100644
> --- a/fs/jbd2/transaction.c
> +++ b/fs/jbd2/transaction.c
> @@ -92,7 +92,6 @@ static void jbd2_get_transaction(journal_t *journal,
>  	atomic_set(&transaction->t_outstanding_revokes, 0);
>  	atomic_set(&transaction->t_handle_count, 0);
>  	INIT_LIST_HEAD(&transaction->t_inode_list);
> -	INIT_LIST_HEAD(&transaction->t_private_list);
>  
>  	/* Set up the commit timer for the new transaction. */
>  	journal->j_commit_timer.expires = round_jiffies_up(transaction->t_expires);
> diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
> index 50f7ea8714bf..90c802e48e23 100644
> --- a/include/linux/jbd2.h
> +++ b/include/linux/jbd2.h
> @@ -700,12 +700,6 @@ struct transaction_s
>  
>  	/* Disk flush needs to be sent to fs partition [no locking] */
>  	int			t_need_data_flush;
> -
> -	/*
> -	 * For use by the filesystem to store fs-specific data
> -	 * structures associated with the transaction
> -	 */
> -	struct list_head	t_private_list;
>  };
>  
>  struct transaction_run_stats_s {
> -- 
> 2.30.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] ext4: remove unneeded forward declaration
  2024-12-17 12:03 ` [PATCH 3/3] ext4: remove unneeded forward declaration Kemeng Shi
  2024-12-18  3:43   ` Zhang Yi
@ 2024-12-18 11:37   ` Jan Kara
  1 sibling, 0 replies; 11+ messages in thread
From: Jan Kara @ 2024-12-18 11:37 UTC (permalink / raw)
  To: Kemeng Shi
  Cc: tytso, adilger.kernel, jack, dennis.lamerice, linux-doc,
	linux-kernel, linux-ext4

On Tue 17-12-24 20:03:56, Kemeng Shi wrote:
> Remove unneeded forward declaration of ext4_destroy_lazyinit_thread().
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>

Looks good. Feel free to add:

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

								Honza

> ---
>  fs/ext4/super.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 8dfda41dabaa..d294cd43d3f2 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -79,7 +79,6 @@ static int ext4_unfreeze(struct super_block *sb);
>  static int ext4_freeze(struct super_block *sb);
>  static inline int ext2_feature_set_ok(struct super_block *sb);
>  static inline int ext3_feature_set_ok(struct super_block *sb);
> -static void ext4_destroy_lazyinit_thread(void);
>  static void ext4_unregister_li_request(struct super_block *sb);
>  static void ext4_clear_request_list(void);
>  static struct inode *ext4_get_journal_inode(struct super_block *sb,
> -- 
> 2.30.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-12-18 11:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-17 12:03 [PATCH 0/3] Minor cleanups to ext4 and jbd2 Kemeng Shi
2024-12-17 12:03 ` [PATCH 1/3] ext4: remove unused ext4 journal callback Kemeng Shi
2024-12-18  3:40   ` Zhang Yi
2024-12-18 11:35   ` Jan Kara
2024-12-17 12:03 ` [PATCH 2/3] jbd2: remove unused transaction->t_private_list Kemeng Shi
2024-12-17 18:02   ` Matthew Wilcox
2024-12-18  3:26     ` Kemeng Shi
2024-12-18 11:36   ` Jan Kara
2024-12-17 12:03 ` [PATCH 3/3] ext4: remove unneeded forward declaration Kemeng Shi
2024-12-18  3:43   ` Zhang Yi
2024-12-18 11:37   ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).