Re: [PATCH v3 07/12] ext4: drop ext4_es_delayed_clu()
From: Jan Kara
Date: Wed Sep 04 2024 - 06:25:35 EST
On Tue 13-08-24 20:34:47, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@xxxxxxxxxx>
>
> Since we move ext4_da_update_reserve_space() to ext4_es_insert_extent(),
> no one uses ext4_es_delayed_clu() and __es_delayed_clu(), just drop
> them.
>
> Signed-off-by: Zhang Yi <yi.zhang@xxxxxxxxxx>
Always nice to see code removed :) Feel free to add:
Reviewed-by: Jan Kara <jack@xxxxxxx>
Honza
> ---
> fs/ext4/extents_status.c | 88 ----------------------------------------
> fs/ext4/extents_status.h | 2 -
> 2 files changed, 90 deletions(-)
>
> diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
> index 41adf0d69959..b372b98af366 100644
> --- a/fs/ext4/extents_status.c
> +++ b/fs/ext4/extents_status.c
> @@ -2178,94 +2178,6 @@ void ext4_es_insert_delayed_extent(struct inode *inode, ext4_lblk_t lblk,
> return;
> }
>
> -/*
> - * __es_delayed_clu - count number of clusters containing blocks that
> - * are delayed only
> - *
> - * @inode - file containing block range
> - * @start - logical block defining start of range
> - * @end - logical block defining end of range
> - *
> - * Returns the number of clusters containing only delayed (not delayed
> - * and unwritten) blocks in the range specified by @start and @end. Any
> - * cluster or part of a cluster within the range and containing a delayed
> - * and not unwritten block within the range is counted as a whole cluster.
> - */
> -static unsigned int __es_delayed_clu(struct inode *inode, ext4_lblk_t start,
> - ext4_lblk_t end)
> -{
> - struct ext4_es_tree *tree = &EXT4_I(inode)->i_es_tree;
> - struct extent_status *es;
> - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
> - struct rb_node *node;
> - ext4_lblk_t first_lclu, last_lclu;
> - unsigned long long last_counted_lclu;
> - unsigned int n = 0;
> -
> - /* guaranteed to be unequal to any ext4_lblk_t value */
> - last_counted_lclu = ~0ULL;
> -
> - es = __es_tree_search(&tree->root, start);
> -
> - while (es && (es->es_lblk <= end)) {
> - if (ext4_es_is_delonly(es)) {
> - if (es->es_lblk <= start)
> - first_lclu = EXT4_B2C(sbi, start);
> - else
> - first_lclu = EXT4_B2C(sbi, es->es_lblk);
> -
> - if (ext4_es_end(es) >= end)
> - last_lclu = EXT4_B2C(sbi, end);
> - else
> - last_lclu = EXT4_B2C(sbi, ext4_es_end(es));
> -
> - if (first_lclu == last_counted_lclu)
> - n += last_lclu - first_lclu;
> - else
> - n += last_lclu - first_lclu + 1;
> - last_counted_lclu = last_lclu;
> - }
> - node = rb_next(&es->rb_node);
> - if (!node)
> - break;
> - es = rb_entry(node, struct extent_status, rb_node);
> - }
> -
> - return n;
> -}
> -
> -/*
> - * ext4_es_delayed_clu - count number of clusters containing blocks that
> - * are both delayed and unwritten
> - *
> - * @inode - file containing block range
> - * @lblk - logical block defining start of range
> - * @len - number of blocks in range
> - *
> - * Locking for external use of __es_delayed_clu().
> - */
> -unsigned int ext4_es_delayed_clu(struct inode *inode, ext4_lblk_t lblk,
> - ext4_lblk_t len)
> -{
> - struct ext4_inode_info *ei = EXT4_I(inode);
> - ext4_lblk_t end;
> - unsigned int n;
> -
> - if (len == 0)
> - return 0;
> -
> - end = lblk + len - 1;
> - WARN_ON(end < lblk);
> -
> - read_lock(&ei->i_es_lock);
> -
> - n = __es_delayed_clu(inode, lblk, end);
> -
> - read_unlock(&ei->i_es_lock);
> -
> - return n;
> -}
> -
> /*
> * __revise_pending - makes, cancels, or leaves unchanged pending cluster
> * reservations for a specified block range depending
> diff --git a/fs/ext4/extents_status.h b/fs/ext4/extents_status.h
> index b74d693c1adb..47b3b55a852c 100644
> --- a/fs/ext4/extents_status.h
> +++ b/fs/ext4/extents_status.h
> @@ -252,8 +252,6 @@ extern bool ext4_is_pending(struct inode *inode, ext4_lblk_t lblk);
> extern void ext4_es_insert_delayed_extent(struct inode *inode, ext4_lblk_t lblk,
> ext4_lblk_t len, bool lclu_allocated,
> bool end_allocated);
> -extern unsigned int ext4_es_delayed_clu(struct inode *inode, ext4_lblk_t lblk,
> - ext4_lblk_t len);
> extern void ext4_clear_inode_es(struct inode *inode);
>
> #endif /* _EXT4_EXTENTS_STATUS_H */
> --
> 2.39.2
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR