All of lore.kernel.org
 help / color / mirror / Atom feed
From: Goldwyn Rodrigues <rgoldwyn@suse.de>
To: linux-btrfs@vger.kernel.org
Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: [PATCH 2/2] btrfs: Use reada_control pointer instead of void pointer
Date: Tue,  6 Apr 2021 11:24:04 -0500	[thread overview]
Message-ID: <20210406162404.11746-2-rgoldwyn@suse.de> (raw)
In-Reply-To: <20210406162404.11746-1-rgoldwyn@suse.de>

From: Goldwyn Rodrigues <rgoldwyn@suse.com>

Since struct reada_control is defined in ctree.h,
Use struct reada_control pointer as a function argument for
btrfs_reada_wait() instead of a void pointer in order
to avoid type-casting within the function.

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

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 2acbd8919611..8bf434a4f014 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3699,7 +3699,7 @@ 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);
+int btrfs_reada_wait(struct reada_control *rc);
 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 0d357f8b65bc..9bfa47cd3920 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -998,9 +998,8 @@ struct reada_control *btrfs_reada_add(struct btrfs_root *root,
 }
 
 #ifdef DEBUG
-int btrfs_reada_wait(void *handle)
+int btrfs_reada_wait(struct reada_control *rc)
 {
-	struct reada_control *rc = handle;
 	struct btrfs_fs_info *fs_info = rc->fs_info;
 
 	while (atomic_read(&rc->elems)) {
@@ -1018,9 +1017,8 @@ int btrfs_reada_wait(void *handle)
 	return 0;
 }
 #else
-int btrfs_reada_wait(void *handle)
+int btrfs_reada_wait(struct reada_control *rc)
 {
-	struct reada_control *rc = handle;
 	struct btrfs_fs_info *fs_info = rc->fs_info;
 
 	while (atomic_read(&rc->elems)) {
-- 
2.30.2


  reply	other threads:[~2021-04-06 16:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06 16:24 [PATCH 1/2] btrfs: Remove unused function btrfs_reada_detach() Goldwyn Rodrigues
2021-04-06 16:24 ` Goldwyn Rodrigues [this message]
2021-04-07  4:40   ` [PATCH 2/2] btrfs: Use reada_control pointer instead of void pointer Anand Jain
2021-04-07 15:49   ` riteshh
2021-04-23 11:28     ` David Sterba
2021-04-06 23:59 ` [PATCH 1/2] btrfs: Remove unused function btrfs_reada_detach() Anand Jain
2021-04-07 15:53 ` riteshh
2021-04-23 11:19 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210406162404.11746-2-rgoldwyn@suse.de \
    --to=rgoldwyn@suse.de \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=rgoldwyn@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.