ext4: remove unused ext4 journal callback
authorKemeng Shi <shikemeng@huaweicloud.com>
Wed, 18 Dec 2024 14:54:12 +0000 (22:54 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 10 Feb 2025 12:48:24 +0000 (07:48 -0500)
Remove unused ext4 journal callback.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20241218145414.1422946-2-shikemeng@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/ext4_jbd2.h
fs/ext4/super.c

index 0c77697d5e90d075364bb67dbc281a7fde89ea9d..3f2596c9e5f254613e048f088f42573e2be296fa 100644 (file)
 #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,
index a50e5c31b937820ce6d178c28800e380da3f5bed..957b19b53d5b601df539f276a45887471e7b105f 100644 (file)
@@ -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);
 }
 
 /*