public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: libaokun@huaweicloud.com
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu,
	adilger.kernel@dilger.ca, jack@suse.cz,
	linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
	yangerkun@huawei.com, Baokun Li <libaokun1@huawei.com>
Subject: Re: [PATCH 4/5] ext4: remove unused member 'i_unwritten' from 'ext4_inode_info'
Date: Fri, 20 Dec 2024 12:05:46 +0100	[thread overview]
Message-ID: <20241220110546.f57xhsbrw2e67ki7@quack3> (raw)
In-Reply-To: <20241220060757.1781418-5-libaokun@huaweicloud.com>

On Fri 20-12-24 14:07:56, libaokun@huaweicloud.com wrote:
> From: Baokun Li <libaokun1@huawei.com>
> 
> 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>

Good spotting! Feel free to add:

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

								Honza

> ---
>  fs/ext4/ext4.h  | 22 +++-------------------
>  fs/ext4/inode.c |  2 +-
>  fs/ext4/super.c |  9 +--------
>  3 files changed, 5 insertions(+), 28 deletions(-)
> 
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 9da0e32af02a..203a900fd789 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -1059,7 +1059,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;
> @@ -3786,34 +3785,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;
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 7c54ae5fcbd4..36b1f9fb690a 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -2225,7 +2225,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);
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index a50e5c31b937..853997655e40 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -1426,7 +1426,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);
> @@ -7381,12 +7380,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;
> @@ -7394,9 +7390,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;
> -- 
> 2.46.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2024-12-20 11:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-20  6:07 [PATCH 0/5] ext4: fix issues caused by data write-back failures libaokun
2024-12-20  6:07 ` [PATCH 1/5] ext4: replace opencoded ext4_end_io_end() in ext4_put_io_end() libaokun
2024-12-20 10:22   ` Markus Elfring
2024-12-20 10:26   ` Jan Kara
2024-12-20  6:07 ` [PATCH 2/5] ext4: do not convert the unwritten extents if data writeback fails libaokun
2024-12-20 10:28   ` Jan Kara
2024-12-20  6:07 ` [PATCH 3/5] ext4: abort journal on data writeback failure if in data_err=abort mode libaokun
2024-12-20 10:36   ` Jan Kara
2024-12-20 13:39     ` Baokun Li
2025-01-06 14:32       ` Jan Kara
2025-01-08  3:43         ` Baokun Li
2025-01-08 13:43           ` Jan Kara
2025-01-08 14:44             ` Baokun Li
2025-01-08 15:28               ` Jan Kara
2025-01-09  2:45                 ` Baokun Li
2024-12-20  6:07 ` [PATCH 4/5] ext4: remove unused member 'i_unwritten' from 'ext4_inode_info' libaokun
2024-12-20 11:05   ` Jan Kara [this message]
2024-12-20  6:07 ` [PATCH 5/5] ext4: pack holes in ext4_inode_info libaokun
2024-12-20 11:06   ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241220110546.f57xhsbrw2e67ki7@quack3 \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=libaokun1@huawei.com \
    --cc=libaokun@huaweicloud.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox