From patchwork Tue Apr 6 16:24:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 12185569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16E10C433B4 for ; Tue, 6 Apr 2021 16:24:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0A15613CC for ; Tue, 6 Apr 2021 16:24:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237971AbhDFQYX (ORCPT ); Tue, 6 Apr 2021 12:24:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:49922 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234971AbhDFQYW (ORCPT ); Tue, 6 Apr 2021 12:24:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7DAC1AD9F; Tue, 6 Apr 2021 16:24:13 +0000 (UTC) From: Goldwyn Rodrigues To: linux-btrfs@vger.kernel.org Cc: Goldwyn Rodrigues Subject: [PATCH 1/2] btrfs: Remove unused function btrfs_reada_detach() Date: Tue, 6 Apr 2021 11:24:03 -0500 Message-Id: <20210406162404.11746-1-rgoldwyn@suse.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Goldwyn Rodrigues btrfs_reada_detach() is not called by any function. Remove. Signed-off-by: Goldwyn Rodrigues Reviewed-by: Ritesh Harjani --- 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 From patchwork Tue Apr 6 16:24:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 12185571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ADADC433ED for ; Tue, 6 Apr 2021 16:24:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 212B6613CC for ; Tue, 6 Apr 2021 16:24:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243933AbhDFQYZ (ORCPT ); Tue, 6 Apr 2021 12:24:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:49952 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234971AbhDFQYY (ORCPT ); Tue, 6 Apr 2021 12:24:24 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D87D6AD7C; Tue, 6 Apr 2021 16:24:15 +0000 (UTC) From: Goldwyn Rodrigues To: linux-btrfs@vger.kernel.org Cc: Goldwyn Rodrigues Subject: [PATCH 2/2] btrfs: Use reada_control pointer instead of void pointer Date: Tue, 6 Apr 2021 11:24:04 -0500 Message-Id: <20210406162404.11746-2-rgoldwyn@suse.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210406162404.11746-1-rgoldwyn@suse.de> References: <20210406162404.11746-1-rgoldwyn@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Goldwyn Rodrigues 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 Reviewed-by: Anand Jain --- 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)) {