From patchwork Thu Jun 29 01:41:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13296528 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7BBC2EB64D7 for ; Thu, 29 Jun 2023 01:41:53 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qEgfP-0002CS-Bx; Thu, 29 Jun 2023 01:41:51 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qEgfJ-0002CK-84 for linux-f2fs-devel@lists.sourceforge.net; Thu, 29 Jun 2023 01:41:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Wer01K+4rt8SbDQvmusPjzWzWiDBwFaGar2f1PPe74Y=; b=RQb5hx9BlTzAWjtq2qkDTo/Xdq vUigrHZ+DS1gP3f8xT8vX76ecSAaph7HcnYB0IcR3YUjSpJJx4SMaqS6eZQOloNFjTqdcIYiK9AXI 7zO7A36bz0xalwC4564N8QaMxacrOkqZ22SWgSMlcfqKgiq3EeGvhzgIGEwMlaYYWJzs=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=Wer01K+4rt8SbDQvmusPjzWzWiDBwFaGar2f1PPe74Y=; b=R SeKqmXZSuKZP0CsIMNSdGtXIUmOE0lQI6xvzdYG9vueTkj0074A11GUr4yIrCk4ML/uGkRZM3QN6N HLwIDyXKH1RTP13nWJ+scp7AjzuZH0xCcrF87uEiVd2ls2dSVyrrzIvaVlaYifGqEfy2A9pPEp3iz dkgMic11WvPxjUZY=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qEgfI-000fdP-Sw for linux-f2fs-devel@lists.sourceforge.net; Thu, 29 Jun 2023 01:41:45 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7DD76614B6 for ; Thu, 29 Jun 2023 01:41:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C131CC433C8; Thu, 29 Jun 2023 01:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688002898; bh=L7S8mzMQYGKIhxRcHxSQJwBqPxvW57dJoZChkWhi8UQ=; h=From:To:Cc:Subject:Date:From; b=h30G/Ady3rTuj4pHc4oWRB3blePjJz5XFd/9KEEWRzUxfvNqyc9o1X8gYVmzQ35zY BXqPAVyMc1TT5LcjStHIFg42667UMOGHH4zP/90dwcpi3gYTKxdecpNdM8uVAQi90+ c0TEYq7vvUG88wqKf0unzA53ngGoVo6PtSw9iyNnln9emfTnZuXyhCnDWkK1bLLAkF O3H8upLiPGXvBgPtB8YK1+4MqvhzXG9Q56C/7rPDkYCbx9pNHfuMQSw/tI9chDB62h Oni7IlLkEPtbFaQhAn0vCri36+h72jw3QBkHHRNd1X4QLZBQDoBkq/EDhqk0QInEJN yppxRiS9wJroQ== From: Chao Yu To: jaegeuk@kernel.org Date: Thu, 29 Jun 2023 09:41:34 +0800 Message-Id: <20230629014134.3058318-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Headers-End: 1qEgfI-000fdP-Sw Subject: [f2fs-dev] [PATCH] f2fs: fix compile warning in f2fs_destroy_node_manager() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net fs/f2fs/node.c: In function ‘f2fs_destroy_node_manager’: fs/f2fs/node.c:3390:1: warning: the frame size of 1048 bytes is larger than 1024 bytes [-Wframe-larger-than=] 3390 | } Merging below pointer arrays into common one, and reuse it by cast type. struct nat_entry *natvec[NATVEC_SIZE]; struct nat_entry_set *setvec[SETVEC_SIZE]; Signed-off-by: Chao Yu --- fs/f2fs/node.c | 14 ++++++++------ fs/f2fs/node.h | 3 +-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index dadea6b01888..3e1fa564db8f 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -3062,7 +3062,7 @@ int f2fs_flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc) struct f2fs_nm_info *nm_i = NM_I(sbi); struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_HOT_DATA); struct f2fs_journal *journal = curseg->journal; - struct nat_entry_set *setvec[SETVEC_SIZE]; + struct nat_entry_set *setvec[NAT_VEC_SIZE]; struct nat_entry_set *set, *tmp; unsigned int found; nid_t set_idx = 0; @@ -3095,7 +3095,7 @@ int f2fs_flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc) remove_nats_in_journal(sbi); while ((found = __gang_lookup_nat_set(nm_i, - set_idx, SETVEC_SIZE, setvec))) { + set_idx, NAT_VEC_SIZE, setvec))) { unsigned idx; set_idx = setvec[found - 1]->set + 1; @@ -3316,8 +3316,9 @@ void f2fs_destroy_node_manager(struct f2fs_sb_info *sbi) { struct f2fs_nm_info *nm_i = NM_I(sbi); struct free_nid *i, *next_i; - struct nat_entry *natvec[NATVEC_SIZE]; - struct nat_entry_set *setvec[SETVEC_SIZE]; + void *vec[NAT_VEC_SIZE]; + struct nat_entry **natvec = (struct nat_entry **)vec; + struct nat_entry_set **setvec = (struct nat_entry_set **)vec; nid_t nid = 0; unsigned int found; @@ -3340,7 +3341,7 @@ void f2fs_destroy_node_manager(struct f2fs_sb_info *sbi) /* destroy nat cache */ f2fs_down_write(&nm_i->nat_tree_lock); while ((found = __gang_lookup_nat_cache(nm_i, - nid, NATVEC_SIZE, natvec))) { + nid, NAT_VEC_SIZE, natvec))) { unsigned idx; nid = nat_get_nid(natvec[found - 1]) + 1; @@ -3356,8 +3357,9 @@ void f2fs_destroy_node_manager(struct f2fs_sb_info *sbi) /* destroy nat set cache */ nid = 0; + memset(vec, 0, sizeof(void *) * NAT_VEC_SIZE); while ((found = __gang_lookup_nat_set(nm_i, - nid, SETVEC_SIZE, setvec))) { + nid, NAT_VEC_SIZE, setvec))) { unsigned idx; nid = setvec[found - 1]->set + 1; diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h index 906fb67a99da..5bd16a95eef8 100644 --- a/fs/f2fs/node.h +++ b/fs/f2fs/node.h @@ -35,8 +35,7 @@ #define DEF_RF_NODE_BLOCKS 0 /* vector size for gang look-up from nat cache that consists of radix tree */ -#define NATVEC_SIZE 64 -#define SETVEC_SIZE 32 +#define NAT_VEC_SIZE 32 /* return value for read_node_page */ #define LOCKED_PAGE 1