diff mbox series

[1/2] btrfs: Remove unused function btrfs_reada_detach()

Message ID 20210406162404.11746-1-rgoldwyn@suse.de (mailing list archive)
State New, archived
Headers show
Series [1/2] btrfs: Remove unused function btrfs_reada_detach() | expand

Commit Message

Goldwyn Rodrigues April 6, 2021, 4:24 p.m. UTC
From: Goldwyn Rodrigues <rgoldwyn@suse.com>

btrfs_reada_detach() is not called by any function. Remove.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 fs/btrfs/ctree.h | 1 -
 fs/btrfs/reada.c | 9 +--------
 2 files changed, 1 insertion(+), 9 deletions(-)

Comments

Anand Jain April 6, 2021, 11:59 p.m. UTC | #1
On 07/04/2021 00:24, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
> 
> btrfs_reada_detach() is not called by any function. Remove.
> 

  btrfs_reada_detach() was never used.

  commit 48a3b6366f69 (btrfs: make static code static & remove dead code)
  spared it.

  IMO ok to remove btrfs_reada_detach().

  Reviewed-by: Anand Jain <anand.jain@oracle.com>

> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> ---
>   fs/btrfs/ctree.h | 1 -
>   fs/btrfs/reada.c | 9 +--------
>   2 files changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index f2fd73e58ee6..2acbd8919611 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -3700,7 +3700,6 @@ struct reada_control {
>   struct reada_control *btrfs_reada_add(struct btrfs_root *root,
>   			      struct btrfs_key *start, struct btrfs_key *end);
>   int btrfs_reada_wait(void *handle);
> -void btrfs_reada_detach(void *handle);
>   int btree_readahead_hook(struct extent_buffer *eb, int err);
>   void btrfs_reada_remove_dev(struct btrfs_device *dev);
>   void btrfs_reada_undo_remove_dev(struct btrfs_device *dev);
> diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
> index 06713a8fe26b..0d357f8b65bc 100644
> --- a/fs/btrfs/reada.c
> +++ b/fs/btrfs/reada.c
> @@ -24,7 +24,7 @@
>    * To trigger a readahead, btrfs_reada_add must be called. It will start
>    * a read ahead for the given range [start, end) on tree root. The returned
>    * handle can either be used to wait on the readahead to finish
> - * (btrfs_reada_wait), or to send it to the background (btrfs_reada_detach).
> + * (btrfs_reada_wait).
>    *
>    * The read ahead works as follows:
>    * On btrfs_reada_add, the root of the tree is inserted into a radix_tree.
> @@ -1036,13 +1036,6 @@ int btrfs_reada_wait(void *handle)
>   }
>   #endif
>   
> -void btrfs_reada_detach(void *handle)
> -{
> -	struct reada_control *rc = handle;
> -
> -	kref_put(&rc->refcnt, reada_control_release);
> -}
> -
>   /*
>    * Before removing a device (device replace or device remove ioctls), call this
>    * function to wait for all existing readahead requests on the device and to
>
Ritesh Harjani April 7, 2021, 3:53 p.m. UTC | #2
On 21/04/06 11:24AM, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
>
> btrfs_reada_detach() is not called by any function. Remove.
>
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> ---
>  fs/btrfs/ctree.h | 1 -
>  fs/btrfs/reada.c | 9 +--------
>  2 files changed, 1 insertion(+), 9 deletions(-)
>

Although not an expert in this area, but I would hopefully start doing more
reviews in btrfs and hence will be spending more time with it's code.

For this patch seems to be easy and trivial and looks fine to me.
Please feel free to add:-

Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
David Sterba April 23, 2021, 11:19 a.m. UTC | #3
On Tue, Apr 06, 2021 at 11:24:03AM -0500, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
> 
> btrfs_reada_detach() is not called by any function. Remove.
> 
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> ---
>  fs/btrfs/ctree.h | 1 -
>  fs/btrfs/reada.c | 9 +--------
>  2 files changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index f2fd73e58ee6..2acbd8919611 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -3700,7 +3700,6 @@ struct reada_control {
>  struct reada_control *btrfs_reada_add(struct btrfs_root *root,
>  			      struct btrfs_key *start, struct btrfs_key *end);
>  int btrfs_reada_wait(void *handle);
> -void btrfs_reada_detach(void *handle);
>  int btree_readahead_hook(struct extent_buffer *eb, int err);
>  void btrfs_reada_remove_dev(struct btrfs_device *dev);
>  void btrfs_reada_undo_remove_dev(struct btrfs_device *dev);
> diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
> index 06713a8fe26b..0d357f8b65bc 100644
> --- a/fs/btrfs/reada.c
> +++ b/fs/btrfs/reada.c
> @@ -24,7 +24,7 @@
>   * To trigger a readahead, btrfs_reada_add must be called. It will start
>   * a read ahead for the given range [start, end) on tree root. The returned
>   * handle can either be used to wait on the readahead to finish
> - * (btrfs_reada_wait), or to send it to the background (btrfs_reada_detach).
> + * (btrfs_reada_wait).

btrfs_reada_detach is part of public readahead API, providing the
background readahead.
diff mbox series

Patch

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index f2fd73e58ee6..2acbd8919611 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3700,7 +3700,6 @@  struct reada_control {
 struct reada_control *btrfs_reada_add(struct btrfs_root *root,
 			      struct btrfs_key *start, struct btrfs_key *end);
 int btrfs_reada_wait(void *handle);
-void btrfs_reada_detach(void *handle);
 int btree_readahead_hook(struct extent_buffer *eb, int err);
 void btrfs_reada_remove_dev(struct btrfs_device *dev);
 void btrfs_reada_undo_remove_dev(struct btrfs_device *dev);
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index 06713a8fe26b..0d357f8b65bc 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -24,7 +24,7 @@ 
  * To trigger a readahead, btrfs_reada_add must be called. It will start
  * a read ahead for the given range [start, end) on tree root. The returned
  * handle can either be used to wait on the readahead to finish
- * (btrfs_reada_wait), or to send it to the background (btrfs_reada_detach).
+ * (btrfs_reada_wait).
  *
  * The read ahead works as follows:
  * On btrfs_reada_add, the root of the tree is inserted into a radix_tree.
@@ -1036,13 +1036,6 @@  int btrfs_reada_wait(void *handle)
 }
 #endif
 
-void btrfs_reada_detach(void *handle)
-{
-	struct reada_control *rc = handle;
-
-	kref_put(&rc->refcnt, reada_control_release);
-}
-
 /*
  * Before removing a device (device replace or device remove ioctls), call this
  * function to wait for all existing readahead requests on the device and to