btrfs: remove SLAB_MEM_SPREAD flag usage

Message ID 20240224134709.829191-1-chengming.zhou@linux.dev
State New
Headers
Series btrfs: remove SLAB_MEM_SPREAD flag usage |

Commit Message

Chengming Zhou Feb. 24, 2024, 1:47 p.m. UTC
  From: Chengming Zhou <zhouchengming@bytedance.com>

The SLAB_MEM_SPREAD flag is already a no-op as of 6.8-rc1, remove
its usage so we can delete it from slab. No functional change.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
 fs/btrfs/backref.c          | 2 +-
 fs/btrfs/ctree.c            | 2 +-
 fs/btrfs/defrag.c           | 2 +-
 fs/btrfs/delayed-inode.c    | 2 +-
 fs/btrfs/delayed-ref.c      | 8 ++++----
 fs/btrfs/extent-io-tree.c   | 2 +-
 fs/btrfs/extent_io.c        | 2 +-
 fs/btrfs/extent_map.c       | 2 +-
 fs/btrfs/free-space-cache.c | 4 ++--
 fs/btrfs/inode.c            | 2 +-
 fs/btrfs/ordered-data.c     | 2 +-
 fs/btrfs/transaction.c      | 2 +-
 12 files changed, 16 insertions(+), 16 deletions(-)
  

Comments

Chengming Zhou Feb. 26, 2024, 3 a.m. UTC | #1
On 2024/2/24 21:47, chengming.zhou@linux.dev wrote:
> From: Chengming Zhou <zhouchengming@bytedance.com>
> 
> The SLAB_MEM_SPREAD flag is already a no-op as of 6.8-rc1, remove
> its usage so we can delete it from slab. No functional change.

Update changelog to make it clearer:

The SLAB_MEM_SPREAD flag used to be implemented in SLAB, which was
removed as of v6.8-rc1, so it became a dead flag since the commit
16a1d968358a ("mm/slab: remove mm/slab.c and slab_def.h"). And the
series[1] went on to mark it obsolete to avoid confusion for users.
Here we can just remove all its users, which has no functional change.

[1] https://lore.kernel.org/all/20240223-slab-cleanup-flags-v2-1-02f1753e8303@suse.cz/

Thanks!

> 
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> ---
>  fs/btrfs/backref.c          | 2 +-
>  fs/btrfs/ctree.c            | 2 +-
>  fs/btrfs/defrag.c           | 2 +-
>  fs/btrfs/delayed-inode.c    | 2 +-
>  fs/btrfs/delayed-ref.c      | 8 ++++----
>  fs/btrfs/extent-io-tree.c   | 2 +-
>  fs/btrfs/extent_io.c        | 2 +-
>  fs/btrfs/extent_map.c       | 2 +-
>  fs/btrfs/free-space-cache.c | 4 ++--
>  fs/btrfs/inode.c            | 2 +-
>  fs/btrfs/ordered-data.c     | 2 +-
>  fs/btrfs/transaction.c      | 2 +-
>  12 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
> index 6514cb1d404a..f2abb9afd04a 100644
> --- a/fs/btrfs/backref.c
> +++ b/fs/btrfs/backref.c
> @@ -200,7 +200,7 @@ int __init btrfs_prelim_ref_init(void)
>  	btrfs_prelim_ref_cache = kmem_cache_create("btrfs_prelim_ref",
>  					sizeof(struct prelim_ref),
>  					0,
> -					SLAB_MEM_SPREAD,
> +					0,
>  					NULL);
>  	if (!btrfs_prelim_ref_cache)
>  		return -ENOMEM;
> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> index bae17dbe71d6..aaf53fd84358 100644
> --- a/fs/btrfs/ctree.c
> +++ b/fs/btrfs/ctree.c
> @@ -5086,7 +5086,7 @@ int btrfs_previous_extent_item(struct btrfs_root *root,
>  
>  int __init btrfs_ctree_init(void)
>  {
> -	btrfs_path_cachep = KMEM_CACHE(btrfs_path, SLAB_MEM_SPREAD);
> +	btrfs_path_cachep = KMEM_CACHE(btrfs_path, 0);
>  	if (!btrfs_path_cachep)
>  		return -ENOMEM;
>  	return 0;
> diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
> index 6d3abfcf92d4..4f9e78a94a0a 100644
> --- a/fs/btrfs/defrag.c
> +++ b/fs/btrfs/defrag.c
> @@ -1516,7 +1516,7 @@ int __init btrfs_auto_defrag_init(void)
>  {
>  	btrfs_inode_defrag_cachep = kmem_cache_create("btrfs_inode_defrag",
>  					sizeof(struct inode_defrag), 0,
> -					SLAB_MEM_SPREAD,
> +					0,
>  					NULL);
>  	if (!btrfs_inode_defrag_cachep)
>  		return -ENOMEM;
> diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
> index 0a7a40d97e91..dd6f566a383f 100644
> --- a/fs/btrfs/delayed-inode.c
> +++ b/fs/btrfs/delayed-inode.c
> @@ -28,7 +28,7 @@ static struct kmem_cache *delayed_node_cache;
>  
>  int __init btrfs_delayed_inode_init(void)
>  {
> -	delayed_node_cache = KMEM_CACHE(btrfs_delayed_node, SLAB_MEM_SPREAD);
> +	delayed_node_cache = KMEM_CACHE(btrfs_delayed_node, 0);
>  	if (!delayed_node_cache)
>  		return -ENOMEM;
>  	return 0;
> diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
> index c90efc20b8b2..7c5377151a1f 100644
> --- a/fs/btrfs/delayed-ref.c
> +++ b/fs/btrfs/delayed-ref.c
> @@ -1308,22 +1308,22 @@ void __cold btrfs_delayed_ref_exit(void)
>  int __init btrfs_delayed_ref_init(void)
>  {
>  	btrfs_delayed_ref_head_cachep = KMEM_CACHE(btrfs_delayed_ref_head,
> -						   SLAB_MEM_SPREAD);
> +						   0);
>  	if (!btrfs_delayed_ref_head_cachep)
>  		goto fail;
>  
>  	btrfs_delayed_tree_ref_cachep = KMEM_CACHE(btrfs_delayed_tree_ref,
> -						   SLAB_MEM_SPREAD);
> +						   0);
>  	if (!btrfs_delayed_tree_ref_cachep)
>  		goto fail;
>  
>  	btrfs_delayed_data_ref_cachep = KMEM_CACHE(btrfs_delayed_data_ref,
> -						   SLAB_MEM_SPREAD);
> +						   0);
>  	if (!btrfs_delayed_data_ref_cachep)
>  		goto fail;
>  
>  	btrfs_delayed_extent_op_cachep = KMEM_CACHE(btrfs_delayed_extent_op,
> -						    SLAB_MEM_SPREAD);
> +						    0);
>  	if (!btrfs_delayed_extent_op_cachep)
>  		goto fail;
>  
> diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c
> index 6b923c0ef4ea..102572e31636 100644
> --- a/fs/btrfs/extent-io-tree.c
> +++ b/fs/btrfs/extent-io-tree.c
> @@ -1884,7 +1884,7 @@ int __init extent_state_init_cachep(void)
>  {
>  	extent_state_cache = kmem_cache_create("btrfs_extent_state",
>  			sizeof(struct extent_state), 0,
> -			SLAB_MEM_SPREAD, NULL);
> +			0, NULL);
>  	if (!extent_state_cache)
>  		return -ENOMEM;
>  
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index bfef67c68221..e779a85e752f 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -147,7 +147,7 @@ int __init extent_buffer_init_cachep(void)
>  {
>  	extent_buffer_cache = kmem_cache_create("btrfs_extent_buffer",
>  			sizeof(struct extent_buffer), 0,
> -			SLAB_MEM_SPREAD, NULL);
> +			0, NULL);
>  	if (!extent_buffer_cache)
>  		return -ENOMEM;
>  
> diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
> index ea08601988de..692d62b2fab2 100644
> --- a/fs/btrfs/extent_map.c
> +++ b/fs/btrfs/extent_map.c
> @@ -16,7 +16,7 @@ int __init extent_map_init(void)
>  {
>  	extent_map_cache = kmem_cache_create("btrfs_extent_map",
>  			sizeof(struct extent_map), 0,
> -			SLAB_MEM_SPREAD, NULL);
> +			0, NULL);
>  	if (!extent_map_cache)
>  		return -ENOMEM;
>  	return 0;
> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
> index d984912dae06..c8a05d5eb9cb 100644
> --- a/fs/btrfs/free-space-cache.c
> +++ b/fs/btrfs/free-space-cache.c
> @@ -4154,13 +4154,13 @@ int btrfs_set_free_space_cache_v1_active(struct btrfs_fs_info *fs_info, bool act
>  
>  int __init btrfs_free_space_init(void)
>  {
> -	btrfs_free_space_cachep = KMEM_CACHE(btrfs_free_space, SLAB_MEM_SPREAD);
> +	btrfs_free_space_cachep = KMEM_CACHE(btrfs_free_space, 0);
>  	if (!btrfs_free_space_cachep)
>  		return -ENOMEM;
>  
>  	btrfs_free_space_bitmap_cachep = kmem_cache_create("btrfs_free_space_bitmap",
>  							PAGE_SIZE, PAGE_SIZE,
> -							SLAB_MEM_SPREAD, NULL);
> +							0, NULL);
>  	if (!btrfs_free_space_bitmap_cachep) {
>  		kmem_cache_destroy(btrfs_free_space_cachep);
>  		return -ENOMEM;
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index df55dd891137..6c4d60746af6 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -8717,7 +8717,7 @@ int __init btrfs_init_cachep(void)
>  {
>  	btrfs_inode_cachep = kmem_cache_create("btrfs_inode",
>  			sizeof(struct btrfs_inode), 0,
> -			SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD | SLAB_ACCOUNT,
> +			SLAB_RECLAIM_ACCOUNT | SLAB_ACCOUNT,
>  			init_once);
>  	if (!btrfs_inode_cachep)
>  		goto fail;
> diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
> index 1ee2fb8dcd6a..b749ba45da2b 100644
> --- a/fs/btrfs/ordered-data.c
> +++ b/fs/btrfs/ordered-data.c
> @@ -1235,7 +1235,7 @@ struct btrfs_ordered_extent *btrfs_split_ordered_extent(
>  
>  int __init ordered_data_init(void)
>  {
> -	btrfs_ordered_extent_cache = KMEM_CACHE(btrfs_ordered_extent, SLAB_MEM_SPREAD);
> +	btrfs_ordered_extent_cache = KMEM_CACHE(btrfs_ordered_extent, 0);
>  	if (!btrfs_ordered_extent_cache)
>  		return -ENOMEM;
>  
> diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
> index ea080ec2f927..2f151c5367ed 100644
> --- a/fs/btrfs/transaction.c
> +++ b/fs/btrfs/transaction.c
> @@ -2672,7 +2672,7 @@ void __cold __btrfs_abort_transaction(struct btrfs_trans_handle *trans,
>  int __init btrfs_transaction_init(void)
>  {
>  	btrfs_trans_handle_cachep = KMEM_CACHE(btrfs_trans_handle,
> -					       SLAB_TEMPORARY | SLAB_MEM_SPREAD);
> +					       SLAB_TEMPORARY);
>  	if (!btrfs_trans_handle_cachep)
>  		return -ENOMEM;
>  	return 0;
  
Johannes Thumshirn Feb. 26, 2024, 8:28 a.m. UTC | #2
With the updated changelog,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
  
David Sterba Feb. 28, 2024, 2:32 p.m. UTC | #3
On Sat, Feb 24, 2024 at 01:47:09PM +0000, chengming.zhou@linux.dev wrote:
> From: Chengming Zhou <zhouchengming@bytedance.com>
> 
> The SLAB_MEM_SPREAD flag is already a no-op as of 6.8-rc1, remove
> its usage so we can delete it from slab. No functional change.
> 
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>

With updated changelog and some formatting adjustments added to
for-next, thanks.
  

Patch

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 6514cb1d404a..f2abb9afd04a 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -200,7 +200,7 @@  int __init btrfs_prelim_ref_init(void)
 	btrfs_prelim_ref_cache = kmem_cache_create("btrfs_prelim_ref",
 					sizeof(struct prelim_ref),
 					0,
-					SLAB_MEM_SPREAD,
+					0,
 					NULL);
 	if (!btrfs_prelim_ref_cache)
 		return -ENOMEM;
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index bae17dbe71d6..aaf53fd84358 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -5086,7 +5086,7 @@  int btrfs_previous_extent_item(struct btrfs_root *root,
 
 int __init btrfs_ctree_init(void)
 {
-	btrfs_path_cachep = KMEM_CACHE(btrfs_path, SLAB_MEM_SPREAD);
+	btrfs_path_cachep = KMEM_CACHE(btrfs_path, 0);
 	if (!btrfs_path_cachep)
 		return -ENOMEM;
 	return 0;
diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
index 6d3abfcf92d4..4f9e78a94a0a 100644
--- a/fs/btrfs/defrag.c
+++ b/fs/btrfs/defrag.c
@@ -1516,7 +1516,7 @@  int __init btrfs_auto_defrag_init(void)
 {
 	btrfs_inode_defrag_cachep = kmem_cache_create("btrfs_inode_defrag",
 					sizeof(struct inode_defrag), 0,
-					SLAB_MEM_SPREAD,
+					0,
 					NULL);
 	if (!btrfs_inode_defrag_cachep)
 		return -ENOMEM;
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 0a7a40d97e91..dd6f566a383f 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -28,7 +28,7 @@  static struct kmem_cache *delayed_node_cache;
 
 int __init btrfs_delayed_inode_init(void)
 {
-	delayed_node_cache = KMEM_CACHE(btrfs_delayed_node, SLAB_MEM_SPREAD);
+	delayed_node_cache = KMEM_CACHE(btrfs_delayed_node, 0);
 	if (!delayed_node_cache)
 		return -ENOMEM;
 	return 0;
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index c90efc20b8b2..7c5377151a1f 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -1308,22 +1308,22 @@  void __cold btrfs_delayed_ref_exit(void)
 int __init btrfs_delayed_ref_init(void)
 {
 	btrfs_delayed_ref_head_cachep = KMEM_CACHE(btrfs_delayed_ref_head,
-						   SLAB_MEM_SPREAD);
+						   0);
 	if (!btrfs_delayed_ref_head_cachep)
 		goto fail;
 
 	btrfs_delayed_tree_ref_cachep = KMEM_CACHE(btrfs_delayed_tree_ref,
-						   SLAB_MEM_SPREAD);
+						   0);
 	if (!btrfs_delayed_tree_ref_cachep)
 		goto fail;
 
 	btrfs_delayed_data_ref_cachep = KMEM_CACHE(btrfs_delayed_data_ref,
-						   SLAB_MEM_SPREAD);
+						   0);
 	if (!btrfs_delayed_data_ref_cachep)
 		goto fail;
 
 	btrfs_delayed_extent_op_cachep = KMEM_CACHE(btrfs_delayed_extent_op,
-						    SLAB_MEM_SPREAD);
+						    0);
 	if (!btrfs_delayed_extent_op_cachep)
 		goto fail;
 
diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c
index 6b923c0ef4ea..102572e31636 100644
--- a/fs/btrfs/extent-io-tree.c
+++ b/fs/btrfs/extent-io-tree.c
@@ -1884,7 +1884,7 @@  int __init extent_state_init_cachep(void)
 {
 	extent_state_cache = kmem_cache_create("btrfs_extent_state",
 			sizeof(struct extent_state), 0,
-			SLAB_MEM_SPREAD, NULL);
+			0, NULL);
 	if (!extent_state_cache)
 		return -ENOMEM;
 
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index bfef67c68221..e779a85e752f 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -147,7 +147,7 @@  int __init extent_buffer_init_cachep(void)
 {
 	extent_buffer_cache = kmem_cache_create("btrfs_extent_buffer",
 			sizeof(struct extent_buffer), 0,
-			SLAB_MEM_SPREAD, NULL);
+			0, NULL);
 	if (!extent_buffer_cache)
 		return -ENOMEM;
 
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index ea08601988de..692d62b2fab2 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -16,7 +16,7 @@  int __init extent_map_init(void)
 {
 	extent_map_cache = kmem_cache_create("btrfs_extent_map",
 			sizeof(struct extent_map), 0,
-			SLAB_MEM_SPREAD, NULL);
+			0, NULL);
 	if (!extent_map_cache)
 		return -ENOMEM;
 	return 0;
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index d984912dae06..c8a05d5eb9cb 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -4154,13 +4154,13 @@  int btrfs_set_free_space_cache_v1_active(struct btrfs_fs_info *fs_info, bool act
 
 int __init btrfs_free_space_init(void)
 {
-	btrfs_free_space_cachep = KMEM_CACHE(btrfs_free_space, SLAB_MEM_SPREAD);
+	btrfs_free_space_cachep = KMEM_CACHE(btrfs_free_space, 0);
 	if (!btrfs_free_space_cachep)
 		return -ENOMEM;
 
 	btrfs_free_space_bitmap_cachep = kmem_cache_create("btrfs_free_space_bitmap",
 							PAGE_SIZE, PAGE_SIZE,
-							SLAB_MEM_SPREAD, NULL);
+							0, NULL);
 	if (!btrfs_free_space_bitmap_cachep) {
 		kmem_cache_destroy(btrfs_free_space_cachep);
 		return -ENOMEM;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index df55dd891137..6c4d60746af6 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8717,7 +8717,7 @@  int __init btrfs_init_cachep(void)
 {
 	btrfs_inode_cachep = kmem_cache_create("btrfs_inode",
 			sizeof(struct btrfs_inode), 0,
-			SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD | SLAB_ACCOUNT,
+			SLAB_RECLAIM_ACCOUNT | SLAB_ACCOUNT,
 			init_once);
 	if (!btrfs_inode_cachep)
 		goto fail;
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 1ee2fb8dcd6a..b749ba45da2b 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -1235,7 +1235,7 @@  struct btrfs_ordered_extent *btrfs_split_ordered_extent(
 
 int __init ordered_data_init(void)
 {
-	btrfs_ordered_extent_cache = KMEM_CACHE(btrfs_ordered_extent, SLAB_MEM_SPREAD);
+	btrfs_ordered_extent_cache = KMEM_CACHE(btrfs_ordered_extent, 0);
 	if (!btrfs_ordered_extent_cache)
 		return -ENOMEM;
 
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index ea080ec2f927..2f151c5367ed 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -2672,7 +2672,7 @@  void __cold __btrfs_abort_transaction(struct btrfs_trans_handle *trans,
 int __init btrfs_transaction_init(void)
 {
 	btrfs_trans_handle_cachep = KMEM_CACHE(btrfs_trans_handle,
-					       SLAB_TEMPORARY | SLAB_MEM_SPREAD);
+					       SLAB_TEMPORARY);
 	if (!btrfs_trans_handle_cachep)
 		return -ENOMEM;
 	return 0;