[PATCH] btrfs: Remove unused btrfs_is_parity_mirror

linux@treblig.org posted 1 patch 1 month, 3 weeks ago
fs/btrfs/volumes.c | 18 ------------------
fs/btrfs/volumes.h |  2 --
2 files changed, 20 deletions(-)
[PATCH] btrfs: Remove unused btrfs_is_parity_mirror
Posted by linux@treblig.org 1 month, 3 weeks ago
From: "Dr. David Alan Gilbert" <linux@treblig.org>

btrfs_is_parity_mirror() has been unused since commit
4886ff7b50f6 ("btrfs: introduce a new helper to submit write bio for repair")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 fs/btrfs/volumes.c | 18 ------------------
 fs/btrfs/volumes.h |  2 --
 2 files changed, 20 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 8f340ad1d938..7453b4999263 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5841,24 +5841,6 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
 	return len;
 }
 
-int btrfs_is_parity_mirror(struct btrfs_fs_info *fs_info, u64 logical, u64 len)
-{
-	struct btrfs_chunk_map *map;
-	int ret = 0;
-
-	if (!btrfs_fs_incompat(fs_info, RAID56))
-		return 0;
-
-	map = btrfs_get_chunk_map(fs_info, logical, len);
-
-	if (!WARN_ON(IS_ERR(map))) {
-		if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
-			ret = 1;
-		btrfs_free_chunk_map(map);
-	}
-	return ret;
-}
-
 static int find_live_mirror(struct btrfs_fs_info *fs_info,
 			    struct btrfs_chunk_map *map, int first,
 			    int dev_replace_is_ongoing)
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 03d2d60afe0c..715af107ea5d 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -735,8 +735,6 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans);
 void btrfs_rm_dev_replace_remove_srcdev(struct btrfs_device *srcdev);
 void btrfs_rm_dev_replace_free_srcdev(struct btrfs_device *srcdev);
 void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev);
-int btrfs_is_parity_mirror(struct btrfs_fs_info *fs_info,
-			   u64 logical, u64 len);
 unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
 				    u64 logical);
 u64 btrfs_calc_stripe_length(const struct btrfs_chunk_map *map);
-- 
2.46.2
Re: [PATCH] btrfs: Remove unused btrfs_is_parity_mirror
Posted by Qu Wenruo 1 month, 3 weeks ago

在 2024/10/3 23:57, linux@treblig.org 写道:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>
> btrfs_is_parity_mirror() has been unused since commit
> 4886ff7b50f6 ("btrfs: introduce a new helper to submit write bio for repair")
>
> Remove it.
>
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   fs/btrfs/volumes.c | 18 ------------------
>   fs/btrfs/volumes.h |  2 --
>   2 files changed, 20 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 8f340ad1d938..7453b4999263 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -5841,24 +5841,6 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
>   	return len;
>   }
>
> -int btrfs_is_parity_mirror(struct btrfs_fs_info *fs_info, u64 logical, u64 len)
> -{
> -	struct btrfs_chunk_map *map;
> -	int ret = 0;
> -
> -	if (!btrfs_fs_incompat(fs_info, RAID56))
> -		return 0;
> -
> -	map = btrfs_get_chunk_map(fs_info, logical, len);
> -
> -	if (!WARN_ON(IS_ERR(map))) {
> -		if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
> -			ret = 1;
> -		btrfs_free_chunk_map(map);
> -	}
> -	return ret;
> -}
> -
>   static int find_live_mirror(struct btrfs_fs_info *fs_info,
>   			    struct btrfs_chunk_map *map, int first,
>   			    int dev_replace_is_ongoing)
> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
> index 03d2d60afe0c..715af107ea5d 100644
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -735,8 +735,6 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans);
>   void btrfs_rm_dev_replace_remove_srcdev(struct btrfs_device *srcdev);
>   void btrfs_rm_dev_replace_free_srcdev(struct btrfs_device *srcdev);
>   void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev);
> -int btrfs_is_parity_mirror(struct btrfs_fs_info *fs_info,
> -			   u64 logical, u64 len);
>   unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
>   				    u64 logical);
>   u64 btrfs_calc_stripe_length(const struct btrfs_chunk_map *map);
[PATCH] btrfs: Remove unused btrfs_try_tree_write_lock
Posted by linux@treblig.org 1 month, 3 weeks ago
From: "Dr. David Alan Gilbert" <linux@treblig.org>

btrfs_try_tree_write_lock() is unused since commit
50b21d7a066f ("btrfs: submit a writeback bio per extent_buffer")

Remove it (and it's associated trace).

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 fs/btrfs/locking.c           | 15 ---------------
 fs/btrfs/locking.h           |  1 -
 include/trace/events/btrfs.h |  1 -
 3 files changed, 17 deletions(-)

diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
index 6a0b7abb5bd9..9a7a7b723305 100644
--- a/fs/btrfs/locking.c
+++ b/fs/btrfs/locking.c
@@ -161,21 +161,6 @@ int btrfs_try_tree_read_lock(struct extent_buffer *eb)
 	return 0;
 }
 
-/*
- * Try-lock for write.
- *
- * Return 1 if the rwlock has been taken, 0 otherwise
- */
-int btrfs_try_tree_write_lock(struct extent_buffer *eb)
-{
-	if (down_write_trylock(&eb->lock)) {
-		btrfs_set_eb_lock_owner(eb, current->pid);
-		trace_btrfs_try_tree_write_lock(eb);
-		return 1;
-	}
-	return 0;
-}
-
 /*
  * Release read lock.
  */
diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h
index 3c15c75e0582..46c8be2afab1 100644
--- a/fs/btrfs/locking.h
+++ b/fs/btrfs/locking.h
@@ -180,7 +180,6 @@ static inline void btrfs_tree_read_lock(struct extent_buffer *eb)
 
 void btrfs_tree_read_unlock(struct extent_buffer *eb);
 int btrfs_try_tree_read_lock(struct extent_buffer *eb);
-int btrfs_try_tree_write_lock(struct extent_buffer *eb);
 struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root);
 struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root);
 struct extent_buffer *btrfs_try_read_lock_root_node(struct btrfs_root *root);
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index bf60ad50011e..9b8d41a00234 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -2341,7 +2341,6 @@ DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock_blocking);
 DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_read);
 DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_write);
 DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock);
-DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock);
 DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic);
 
 DECLARE_EVENT_CLASS(btrfs__space_info_update,
-- 
2.46.2
Re: [PATCH] btrfs: Remove unused btrfs_try_tree_write_lock
Posted by Qu Wenruo 1 month, 3 weeks ago

在 2024/10/3 23:57, linux@treblig.org 写道:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>
> btrfs_try_tree_write_lock() is unused since commit
> 50b21d7a066f ("btrfs: submit a writeback bio per extent_buffer")
>
> Remove it (and it's associated trace).
>
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   fs/btrfs/locking.c           | 15 ---------------
>   fs/btrfs/locking.h           |  1 -
>   include/trace/events/btrfs.h |  1 -
>   3 files changed, 17 deletions(-)
>
> diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
> index 6a0b7abb5bd9..9a7a7b723305 100644
> --- a/fs/btrfs/locking.c
> +++ b/fs/btrfs/locking.c
> @@ -161,21 +161,6 @@ int btrfs_try_tree_read_lock(struct extent_buffer *eb)
>   	return 0;
>   }
>
> -/*
> - * Try-lock for write.
> - *
> - * Return 1 if the rwlock has been taken, 0 otherwise
> - */
> -int btrfs_try_tree_write_lock(struct extent_buffer *eb)
> -{
> -	if (down_write_trylock(&eb->lock)) {
> -		btrfs_set_eb_lock_owner(eb, current->pid);
> -		trace_btrfs_try_tree_write_lock(eb);
> -		return 1;
> -	}
> -	return 0;
> -}
> -
>   /*
>    * Release read lock.
>    */
> diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h
> index 3c15c75e0582..46c8be2afab1 100644
> --- a/fs/btrfs/locking.h
> +++ b/fs/btrfs/locking.h
> @@ -180,7 +180,6 @@ static inline void btrfs_tree_read_lock(struct extent_buffer *eb)
>
>   void btrfs_tree_read_unlock(struct extent_buffer *eb);
>   int btrfs_try_tree_read_lock(struct extent_buffer *eb);
> -int btrfs_try_tree_write_lock(struct extent_buffer *eb);
>   struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root);
>   struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root);
>   struct extent_buffer *btrfs_try_read_lock_root_node(struct btrfs_root *root);
> diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
> index bf60ad50011e..9b8d41a00234 100644
> --- a/include/trace/events/btrfs.h
> +++ b/include/trace/events/btrfs.h
> @@ -2341,7 +2341,6 @@ DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock_blocking);
>   DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_read);
>   DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_write);
>   DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock);
> -DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock);
>   DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic);
>
>   DECLARE_EVENT_CLASS(btrfs__space_info_update,
Re: [PATCH] btrfs: Remove unused btrfs_try_tree_write_lock
Posted by Christoph Hellwig 1 month, 3 weeks ago
On Thu, Oct 03, 2024 at 03:27:27PM +0100, linux@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> 
> btrfs_try_tree_write_lock() is unused since commit
> 50b21d7a066f ("btrfs: submit a writeback bio per extent_buffer")
> 
> Remove it (and it's associated trace).

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>