From patchwork Fri Dec 24 06:22:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12698827 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 7F5EFC433F5 for ; Fri, 24 Dec 2021 06:23:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 18F156B0082; Fri, 24 Dec 2021 01:23:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 140846B0083; Fri, 24 Dec 2021 01:23:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02DAE6B0085; Fri, 24 Dec 2021 01:23:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id E8AB26B0082 for ; Fri, 24 Dec 2021 01:23:18 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A780F181AC9C6 for ; Fri, 24 Dec 2021 06:23:18 +0000 (UTC) X-FDA: 78951695676.30.76B921D Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf11.hostedemail.com (Postfix) with ESMTP id 85B9E40023 for ; Fri, 24 Dec 2021 06:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=1ZA6SbMtIHpmSD0II079fJIJ8zd661EOD54iGaKR13c=; b=nfoKrj8qAYckW193hrhVZo4674 9t5WMiw29Yd6EfitSJSdem40ZKZWiaV5q2CEXPw1HHBAfnfeE2uTQVD8gUn4AWMN486HAb1sTNvM/ uyFnUg0gneXMJfiWDvmwmFWBtHmjXYuAX8pBluqJ2xzJksC+AkyYBwSQcrKhnAZ9yX3jH7SkjARLs kx2QOY2TCUS8RuWeLbYXoDOo/QgElzWBvMCbxB5ZSz2EFzvkkyd9nfhOYHQ6Tg0d6gbfUTCFLc7wm BM+20rz5nzM3Hsb4vxMjKBIQRslyr/OZTe2Gf5sOJcCkMyxUl9ARVrAtfPKyWlc5IscuIe2eW7xBp va6bhs3g==; Received: from p4fdb0b85.dip0.t-ipconnect.de ([79.219.11.133] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0dys-00Dn24-QW; Fri, 24 Dec 2021 06:23:07 +0000 From: Christoph Hellwig To: Andrew Morton , Konrad Rzeszutek Wilk Cc: Hugh Dickins , Seth Jennings , Dan Streetman , Vitaly Wool , Matthew Wilcox , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 06/13] frontswap: simplify frontswap_init Date: Fri, 24 Dec 2021 07:22:39 +0100 Message-Id: <20211224062246.1258487-7-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211224062246.1258487-1-hch@lst.de> References: <20211224062246.1258487-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Stat-Signature: dhqkdff7uhjeupzc9gq4ifbzrcp3toos X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 85B9E40023 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=nfoKrj8q; spf=none (imf11.hostedemail.com: domain of BATV+afcec93cc8ffef6ccdbc+6697+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+afcec93cc8ffef6ccdbc+6697+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none X-HE-Tag: 1640326995-250064 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: Just use IS_ENABLED() and remove the __frontswap_init indirection. Also remove the unused export. Signed-off-by: Christoph Hellwig --- include/linux/frontswap.h | 9 +-------- mm/frontswap.c | 3 +-- mm/swapfile.c | 3 ++- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/include/linux/frontswap.h b/include/linux/frontswap.h index 5205c2977b208..73d7beb44f2b7 100644 --- a/include/linux/frontswap.h +++ b/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_area(unsigned type) __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 */ diff --git a/mm/frontswap.c b/mm/frontswap.c index af8f68d0e5cc0..132d6ad6d70b7 100644 --- a/mm/frontswap.c +++ b/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, unsigned long *map) for_each_frontswap_ops(ops) ops->init(type); } -EXPORT_SYMBOL(__frontswap_init); bool __frontswap_test(struct swap_info_struct *sis, pgoff_t offset) diff --git a/mm/swapfile.c b/mm/swapfile.c index caa9f81a0d15f..df5930ccd93dd 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2463,7 +2463,8 @@ static void enable_swap_info(struct swap_info_struct *p, int prio, 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);