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 E5EC7C433FE for ; Mon, 14 Feb 2022 20:00:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C63F6B0088; Mon, 14 Feb 2022 15:00:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D8586B0082; Mon, 14 Feb 2022 15:00:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6E776B0087; Mon, 14 Feb 2022 15:00:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0226.hostedemail.com [216.40.44.226]) by kanga.kvack.org (Postfix) with ESMTP id 8F94E6B0083 for ; Mon, 14 Feb 2022 15:00:23 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 551991808C914 for ; Mon, 14 Feb 2022 20:00:23 +0000 (UTC) X-FDA: 79142452326.10.15C2A7A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id CED8020012 for ; Mon, 14 Feb 2022 20:00:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=IKQvQjQyaVYzMd7sIYmBk50TPxoi3xTQ2SLk9p3z5lY=; b=beCuCvlC79LZmSc0RJwQniZ7Vz tZhUDBMk6by181+SbK1DharJaL8MmNcQ8Q5mVoI6CYAVceN0a1fYW+mMKeMhF4iizt55NbjqqLY2P UQgoyPihUUUSqzXlGYSHAUQV/GFFO8a3CCC4RhTLqqS21vugd0AWnJrG2QnfabotfoaQ/iCAOnDT4 QsOwlHS7zwIs7HAVtF5+kP6Zw2NFSq6+rpcrexk9bYzKrL3rxJLuQo0qbzqCuel9mz9/sUmY6Aasi MuS0XcI60wQINwgCTFABQ2Zs9DTlVBxZ9DNOHIQRKR5Xv5Ev7VfvSNlB1boozGvA3Wf9CGNJTfyJV P2ChehHQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJhWH-00DDeA-3h; Mon, 14 Feb 2022 20:00:21 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 09/10] mm/truncate: Combine invalidate_mapping_pagevec() and __invalidate_mapping_pages() Date: Mon, 14 Feb 2022 20:00:16 +0000 Message-Id: <20220214200017.3150590-10-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220214200017.3150590-1-willy@infradead.org> References: <20220214200017.3150590-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: CED8020012 X-Stat-Signature: kexo9iuhffde8kfdp6y4ubeamggpc4u8 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=beCuCvlC; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1644868822-215200 Content-Transfer-Encoding: quoted-printable 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: We can save a function call by combining these two functions, which are identical except for the return value. Also move the prototype to mm/internal.h. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/fs.h | 4 ---- mm/internal.h | 2 ++ mm/truncate.c | 32 +++++++++++++------------------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index e2d892b201b0..85c584c5c623 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2749,10 +2749,6 @@ extern bool is_bad_inode(struct inode *); unsigned long invalidate_mapping_pages(struct address_space *mapping, pgoff_t start, pgoff_t end); =20 -void invalidate_mapping_pagevec(struct address_space *mapping, - pgoff_t start, pgoff_t end, - unsigned long *nr_pagevec); - static inline void invalidate_remote_inode(struct inode *inode) { if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || diff --git a/mm/internal.h b/mm/internal.h index d886b87b1294..6bbe40a1880a 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -102,6 +102,8 @@ int truncate_inode_folio(struct address_space *mappin= g, struct folio *folio); bool truncate_inode_partial_folio(struct folio *folio, loff_t start, loff_t end); long invalidate_inode_page(struct page *page); +unsigned long invalidate_mapping_pagevec(struct address_space *mapping, + pgoff_t start, pgoff_t end, unsigned long *nr_pagevec); =20 /** * folio_evictable - Test whether a folio is evictable. diff --git a/mm/truncate.c b/mm/truncate.c index 14486e75ec28..6b94b00f4307 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -492,7 +492,18 @@ void truncate_inode_pages_final(struct address_space= *mapping) } EXPORT_SYMBOL(truncate_inode_pages_final); =20 -static unsigned long __invalidate_mapping_pages(struct address_space *ma= pping, +/** + * invalidate_mapping_pagevec - Invalidate all the unlocked pages of one= inode + * @mapping: the address_space which holds the pages to invalidate + * @start: the offset 'from' which to invalidate + * @end: the offset 'to' which to invalidate (inclusive) + * @nr_pagevec: invalidate failed page number for caller + * + * This helper is similar to invalidate_mapping_pages(), except that it = accounts + * for pages that are likely on a pagevec and counts them in @nr_pagevec= , which + * will be used by the caller. + */ +unsigned long invalidate_mapping_pagevec(struct address_space *mapping, pgoff_t start, pgoff_t end, unsigned long *nr_pagevec) { pgoff_t indices[PAGEVEC_SIZE]; @@ -557,27 +568,10 @@ static unsigned long __invalidate_mapping_pages(str= uct address_space *mapping, unsigned long invalidate_mapping_pages(struct address_space *mapping, pgoff_t start, pgoff_t end) { - return __invalidate_mapping_pages(mapping, start, end, NULL); + return invalidate_mapping_pagevec(mapping, start, end, NULL); } EXPORT_SYMBOL(invalidate_mapping_pages); =20 -/** - * invalidate_mapping_pagevec - Invalidate all the unlocked pages of one= inode - * @mapping: the address_space which holds the pages to invalidate - * @start: the offset 'from' which to invalidate - * @end: the offset 'to' which to invalidate (inclusive) - * @nr_pagevec: invalidate failed page number for caller - * - * This helper is similar to invalidate_mapping_pages(), except that it = accounts - * for pages that are likely on a pagevec and counts them in @nr_pagevec= , which - * will be used by the caller. - */ -void invalidate_mapping_pagevec(struct address_space *mapping, - pgoff_t start, pgoff_t end, unsigned long *nr_pagevec) -{ - __invalidate_mapping_pages(mapping, start, end, nr_pagevec); -} - /* * This is like invalidate_inode_page(), except it ignores the page's * refcount. We do this because invalidate_inode_pages2() needs stronge= r --=20 2.34.1