From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8713C433EF for ; Sat, 22 Jan 2022 06:14:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74B316B00EE; Sat, 22 Jan 2022 01:14:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6FB1D6B00EF; Sat, 22 Jan 2022 01:14:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 611786B00F0; Sat, 22 Jan 2022 01:14:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id 5202F6B00EE for ; Sat, 22 Jan 2022 01:14:55 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 13A3E824C44C for ; Sat, 22 Jan 2022 06:14:55 +0000 (UTC) X-FDA: 79056909750.11.162CBA0 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf09.hostedemail.com (Postfix) with ESMTP id 5AC56140002 for ; Sat, 22 Jan 2022 06:14:54 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A977B81FD1; Sat, 22 Jan 2022 06:14:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5774C004E1; Sat, 22 Jan 2022 06:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1642832092; bh=08c+sz7thFz+5YS6FjBYUmgMvPxISU1wCf/VeduGZe0=; h=Date:From:To:Subject:In-Reply-To:From; b=BDTOQpedoawepFkNu9jhJOMWBXBim7rgreEUQMEcHKZPyGGz72GVNDejvD4XMwdeu 1uBo8UPPNCkFSKy6koUpmchLtDCVofFTuTrmBB5OAq+lMaLhMHV0SrWWBYYkvDr5dR +rE1WdLk+kI5nS0P9DGW6VWL6ksbzWjNyWPhdrLo= Date: Fri, 21 Jan 2022 22:14:51 -0800 From: Andrew Morton To: akpm@linux-foundation.org, ddstreet@ieee.org, geert@linux-m68k.org, hch@lst.de, hughd@google.com, jgross@suse.com, Konrad.wilk@oracle.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, sjenning@redhat.com, torvalds@linux-foundation.org, vitaly.wool@konsulko.com, willy@infradead.org Subject: [patch 62/69] frontswap: simplify frontswap_init Message-ID: <20220122061451.xtrCwshPY%akpm@linux-foundation.org> In-Reply-To: <20220121221021.60533b009c357d660791476e@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Queue-Id: 5AC56140002 X-Stat-Signature: e5bkjcpcg4su6h9eamw6xf6ukwsdhxe5 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=BDTOQped; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam09 X-HE-Tag: 1642832094-290675 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Christoph Hellwig Subject: frontswap: simplify frontswap_init Just use IS_ENABLED() and remove the __frontswap_init indirection. Also remove the unused export. Link: https://lkml.kernel.org/r/20211224062246.1258487-7-hch@lst.de Signed-off-by: Christoph Hellwig Reviewed-by: Juergen Gross Cc: Dan Streetman Cc: Geert Uytterhoeven Cc: Hugh Dickins Cc: Konrad Rzeszutek Wilk Cc: Matthew Wilcox (Oracle) Cc: Seth Jennings Cc: Vitaly Wool Signed-off-by: Andrew Morton --- include/linux/frontswap.h | 9 +-------- mm/frontswap.c | 3 +-- mm/swapfile.c | 3 ++- 3 files changed, 4 insertions(+), 11 deletions(-) --- a/include/linux/frontswap.h~frontswap-simplify-frontswap_init +++ a/include/linux/frontswap.h @@ -26,7 +26,7 @@ struct frontswap_ops { extern void frontswap_register_ops(struct frontswap_ops *ops); extern bool __frontswap_test(struct swap_info_struct *, pgoff_t); -extern void __frontswap_init(unsigned type, unsigned long *map); +extern void frontswap_init(unsigned type, unsigned long *map); extern int __frontswap_store(struct page *page); extern int __frontswap_load(struct page *page); extern void __frontswap_invalidate_page(unsigned, pgoff_t); @@ -107,11 +107,4 @@ static inline void frontswap_invalidate_ __frontswap_invalidate_area(type); } -static inline void frontswap_init(unsigned type, unsigned long *map) -{ -#ifdef CONFIG_FRONTSWAP - __frontswap_init(type, map); -#endif -} - #endif /* _LINUX_FRONTSWAP_H */ --- a/mm/frontswap.c~frontswap-simplify-frontswap_init +++ a/mm/frontswap.c @@ -156,7 +156,7 @@ EXPORT_SYMBOL(frontswap_register_ops); /* * Called when a swap device is swapon'd. */ -void __frontswap_init(unsigned type, unsigned long *map) +void frontswap_init(unsigned type, unsigned long *map) { struct swap_info_struct *sis = swap_info[type]; struct frontswap_ops *ops; @@ -179,7 +179,6 @@ void __frontswap_init(unsigned type, uns for_each_frontswap_ops(ops) ops->init(type); } -EXPORT_SYMBOL(__frontswap_init); bool __frontswap_test(struct swap_info_struct *sis, pgoff_t offset) --- a/mm/swapfile.c~frontswap-simplify-frontswap_init +++ a/mm/swapfile.c @@ -2463,7 +2463,8 @@ static void enable_swap_info(struct swap struct swap_cluster_info *cluster_info, unsigned long *frontswap_map) { - frontswap_init(p->type, frontswap_map); + if (IS_ENABLED(CONFIG_FRONTSWAP)) + frontswap_init(p->type, frontswap_map); spin_lock(&swap_lock); spin_lock(&p->lock); setup_swap_info(p, prio, swap_map, cluster_info); _