public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: remove unreachable discard code
@ 2024-03-09  0:09 Keith Busch
  2024-03-09  2:58 ` Zhang Yi
  0 siblings, 1 reply; 2+ messages in thread
From: Keith Busch @ 2024-03-09  0:09 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, adilger.kernel, jack, Keith Busch

From: Keith Busch <kbusch@kernel.org>

There are no more ext4_issue_discard() users that track their own bio.
Remove the unused parameter and the dead code that handles it.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 fs/ext4/mballoc.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index e4f7cf9d89c45..6314a2b000fd8 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3829,8 +3829,7 @@ void ext4_mb_release(struct super_block *sb)
 }
 
 static inline int ext4_issue_discard(struct super_block *sb,
-		ext4_group_t block_group, ext4_grpblk_t cluster, int count,
-		struct bio **biop)
+		ext4_group_t block_group, ext4_grpblk_t cluster, int count)
 {
 	ext4_fsblk_t discard_block;
 
@@ -3839,13 +3838,7 @@ static inline int ext4_issue_discard(struct super_block *sb,
 	count = EXT4_C2B(EXT4_SB(sb), count);
 	trace_ext4_discard_blocks(sb,
 			(unsigned long long) discard_block, count);
-	if (biop) {
-		return __blkdev_issue_discard(sb->s_bdev,
-			(sector_t)discard_block << (sb->s_blocksize_bits - 9),
-			(sector_t)count << (sb->s_blocksize_bits - 9),
-			GFP_NOFS, biop);
-	} else
-		return sb_issue_discard(sb, discard_block, count, GFP_NOFS, 0);
+	return sb_issue_discard(sb, discard_block, count, GFP_NOFS, 0);
 }
 
 static void ext4_free_data_in_buddy(struct super_block *sb,
@@ -6487,7 +6480,7 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode,
 	} else {
 		if (test_opt(sb, DISCARD)) {
 			err = ext4_issue_discard(sb, block_group, bit,
-						 count_clusters, NULL);
+						 count_clusters);
 			if (err && err != -EOPNOTSUPP)
 				ext4_msg(sb, KERN_WARNING, "discard request in"
 					 " group:%u block:%d count:%lu failed"
@@ -6738,7 +6731,7 @@ __acquires(bitlock)
 	 */
 	mb_mark_used(e4b, &ex);
 	ext4_unlock_group(sb, group);
-	ret = ext4_issue_discard(sb, group, start, count, NULL);
+	ret = ext4_issue_discard(sb, group, start, count);
 	ext4_lock_group(sb, group);
 	mb_free_blocks(NULL, e4b, start, ex.fe_len);
 	return ret;
-- 
2.34.1


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

* Re: [PATCH] ext4: remove unreachable discard code
  2024-03-09  0:09 [PATCH] ext4: remove unreachable discard code Keith Busch
@ 2024-03-09  2:58 ` Zhang Yi
  0 siblings, 0 replies; 2+ messages in thread
From: Zhang Yi @ 2024-03-09  2:58 UTC (permalink / raw)
  To: Keith Busch, linux-ext4; +Cc: tytso, adilger.kernel, jack, Keith Busch

On 2024/3/9 8:09, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> There are no more ext4_issue_discard() users that track their own bio.
> Remove the unused parameter and the dead code that handles it.
> 
> Signed-off-by: Keith Busch <kbusch@kernel.org>

Hello Keith!

Wenchao Hao has already submitted the same patch.

https://lore.kernel.org/linux-ext4/20240226081731.3224470-1-haowenchao2@huawei.com/

Thanks,
Yi.

> ---
>  fs/ext4/mballoc.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index e4f7cf9d89c45..6314a2b000fd8 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -3829,8 +3829,7 @@ void ext4_mb_release(struct super_block *sb)
>  }
>  
>  static inline int ext4_issue_discard(struct super_block *sb,
> -		ext4_group_t block_group, ext4_grpblk_t cluster, int count,
> -		struct bio **biop)
> +		ext4_group_t block_group, ext4_grpblk_t cluster, int count)
>  {
>  	ext4_fsblk_t discard_block;
>  
> @@ -3839,13 +3838,7 @@ static inline int ext4_issue_discard(struct super_block *sb,
>  	count = EXT4_C2B(EXT4_SB(sb), count);
>  	trace_ext4_discard_blocks(sb,
>  			(unsigned long long) discard_block, count);
> -	if (biop) {
> -		return __blkdev_issue_discard(sb->s_bdev,
> -			(sector_t)discard_block << (sb->s_blocksize_bits - 9),
> -			(sector_t)count << (sb->s_blocksize_bits - 9),
> -			GFP_NOFS, biop);
> -	} else
> -		return sb_issue_discard(sb, discard_block, count, GFP_NOFS, 0);
> +	return sb_issue_discard(sb, discard_block, count, GFP_NOFS, 0);
>  }
>  
>  static void ext4_free_data_in_buddy(struct super_block *sb,
> @@ -6487,7 +6480,7 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode,
>  	} else {
>  		if (test_opt(sb, DISCARD)) {
>  			err = ext4_issue_discard(sb, block_group, bit,
> -						 count_clusters, NULL);
> +						 count_clusters);
>  			if (err && err != -EOPNOTSUPP)
>  				ext4_msg(sb, KERN_WARNING, "discard request in"
>  					 " group:%u block:%d count:%lu failed"
> @@ -6738,7 +6731,7 @@ __acquires(bitlock)
>  	 */
>  	mb_mark_used(e4b, &ex);
>  	ext4_unlock_group(sb, group);
> -	ret = ext4_issue_discard(sb, group, start, count, NULL);
> +	ret = ext4_issue_discard(sb, group, start, count);
>  	ext4_lock_group(sb, group);
>  	mb_free_blocks(NULL, e4b, start, ex.fe_len);
>  	return ret;
> 

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

end of thread, other threads:[~2024-03-09  2:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-09  0:09 [PATCH] ext4: remove unreachable discard code Keith Busch
2024-03-09  2:58 ` Zhang Yi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox