[PATCH v1] btrfs: simplify list initialization in btrfs_compr_pool_scan()

Baolin Liu posted 1 patch 2 months, 3 weeks ago
fs/btrfs/compression.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH v1] btrfs: simplify list initialization in btrfs_compr_pool_scan()
Posted by Baolin Liu 2 months, 3 weeks ago
From: Baolin Liu <liubaolin@kylinos.cn>

In btrfs_compr_pool_scan(),use LIST_HEAD() to declare and initialize
the 'remove' list_head in one step instead of using INIT_LIST_HEAD()
separately.

No functional change.

Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
 fs/btrfs/compression.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index bacad18357b3..0da57a3ebe22 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -194,15 +194,13 @@ static unsigned long btrfs_compr_pool_count(struct shrinker *sh, struct shrink_c
 
 static unsigned long btrfs_compr_pool_scan(struct shrinker *sh, struct shrink_control *sc)
 {
-	struct list_head remove;
+	LIST_HEAD(remove);
 	struct list_head *tmp, *next;
 	int freed;
 
 	if (compr_pool.count == 0)
 		return SHRINK_STOP;
 
-	INIT_LIST_HEAD(&remove);
-
 	/* For now, just simply drain the whole list. */
 	spin_lock(&compr_pool.lock);
 	list_splice_init(&compr_pool.list, &remove);
-- 
2.39.2
Re: [PATCH v1] btrfs: simplify list initialization in btrfs_compr_pool_scan()
Posted by David Sterba 2 months, 3 weeks ago
On Tue, Nov 11, 2025 at 08:05:58PM +0800, Baolin Liu wrote:
> From: Baolin Liu <liubaolin@kylinos.cn>
> 
> In btrfs_compr_pool_scan(),use LIST_HEAD() to declare and initialize
> the 'remove' list_head in one step instead of using INIT_LIST_HEAD()
> separately.
> 
> No functional change.
> 
> Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>

Added to for-next, thanks.