ext4: remove unused member 'i_unwritten' from 'ext4_inode_info'
authorBaokun Li <libaokun1@huawei.com>
Wed, 22 Jan 2025 11:05:32 +0000 (19:05 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 13 Mar 2025 14:08:09 +0000 (10:08 -0400)
After commit 378f32bab371 ("ext4: introduce direct I/O write using iomap
infrastructure"), no one cares about the value of i_unwritten, so there
is no need to maintain this variable, remove it, and clean up the
associated logic.

Suggested-by: Zhang Yi <yi.zhang@huawei.com>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://patch.msgid.link/20250122110533.4116662-9-libaokun@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/ext4.h
fs/ext4/inode.c
fs/ext4/super.c

index a59d8297e7b9f47a7c70f4fef011df36ad3ce6f8..1a1f0df49995a8c245c78acd037f103e6fe5f644 100644 (file)
@@ -1063,7 +1063,6 @@ struct ext4_inode_info {
 
        /* Number of ongoing updates on this inode */
        atomic_t  i_fc_updates;
-       atomic_t i_unwritten; /* Nr. of inflight conversions pending */
 
        /* Fast commit wait queue for this inode */
        wait_queue_head_t i_fc_wait;
@@ -3792,34 +3791,19 @@ static inline void set_bitmap_uptodate(struct buffer_head *bh)
        set_bit(BH_BITMAP_UPTODATE, &(bh)->b_state);
 }
 
-/* For ioend & aio unwritten conversion wait queues */
-#define EXT4_WQ_HASH_SZ                37
-#define ext4_ioend_wq(v)   (&ext4__ioend_wq[((unsigned long)(v)) %\
-                                           EXT4_WQ_HASH_SZ])
-extern wait_queue_head_t ext4__ioend_wq[EXT4_WQ_HASH_SZ];
-
 extern int ext4_resize_begin(struct super_block *sb);
 extern int ext4_resize_end(struct super_block *sb, bool update_backups);
 
-static inline void ext4_set_io_unwritten_flag(struct inode *inode,
-                                             struct ext4_io_end *io_end)
+static inline void ext4_set_io_unwritten_flag(struct ext4_io_end *io_end)
 {
-       if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) {
+       if (!(io_end->flag & EXT4_IO_END_UNWRITTEN))
                io_end->flag |= EXT4_IO_END_UNWRITTEN;
-               atomic_inc(&EXT4_I(inode)->i_unwritten);
-       }
 }
 
 static inline void ext4_clear_io_unwritten_flag(ext4_io_end_t *io_end)
 {
-       struct inode *inode = io_end->inode;
-
-       if (io_end->flag & EXT4_IO_END_UNWRITTEN) {
+       if (io_end->flag & EXT4_IO_END_UNWRITTEN)
                io_end->flag &= ~EXT4_IO_END_UNWRITTEN;
-               /* Wake up anyone waiting on unwritten extent conversion */
-               if (atomic_dec_and_test(&EXT4_I(inode)->i_unwritten))
-                       wake_up_all(ext4_ioend_wq(inode));
-       }
 }
 
 extern const struct iomap_ops ext4_iomap_ops;
index debc9197e8212d4403863b36dcc325c30cd19aac..66b89500128a8bd446878d9a1cb22e74741e7d36 100644 (file)
@@ -2226,7 +2226,7 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
                        mpd->io_submit.io_end->handle = handle->h_rsv_handle;
                        handle->h_rsv_handle = NULL;
                }
-               ext4_set_io_unwritten_flag(inode, mpd->io_submit.io_end);
+               ext4_set_io_unwritten_flag(mpd->io_submit.io_end);
        }
 
        BUG_ON(map->m_len == 0);
index 53173950c22989419edb1ffe605a1a7907ba24e8..46572529c68b088dcb5ec3bc236b7b5d25e3fd9b 100644 (file)
@@ -1411,7 +1411,6 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
        spin_lock_init(&ei->i_completed_io_lock);
        ei->i_sync_tid = 0;
        ei->i_datasync_tid = 0;
-       atomic_set(&ei->i_unwritten, 0);
        INIT_WORK(&ei->i_rsv_conversion_work, ext4_end_io_rsv_work);
        ext4_fc_init_inode(&ei->vfs_inode);
        mutex_init(&ei->i_fc_lock);
@@ -7391,12 +7390,9 @@ static struct file_system_type ext4_fs_type = {
 };
 MODULE_ALIAS_FS("ext4");
 
-/* Shared across all ext4 file systems */
-wait_queue_head_t ext4__ioend_wq[EXT4_WQ_HASH_SZ];
-
 static int __init ext4_init_fs(void)
 {
-       int i, err;
+       int err;
 
        ratelimit_state_init(&ext4_mount_msg_ratelimit, 30 * HZ, 64);
        ext4_li_info = NULL;
@@ -7404,9 +7400,6 @@ static int __init ext4_init_fs(void)
        /* Build-time check for flags consistency */
        ext4_check_flag_values();
 
-       for (i = 0; i < EXT4_WQ_HASH_SZ; i++)
-               init_waitqueue_head(&ext4__ioend_wq[i]);
-
        err = ext4_init_es();
        if (err)
                return err;