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 6B896C25B08 for ; Mon, 8 Aug 2022 19:35:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B4F8940007; Mon, 8 Aug 2022 15:35:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 93CEF940017; Mon, 8 Aug 2022 15:35:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74640940007; Mon, 8 Aug 2022 15:35:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 29066940017 for ; Mon, 8 Aug 2022 15:35:26 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0C30D120133 for ; Mon, 8 Aug 2022 19:35:26 +0000 (UTC) X-FDA: 79777429452.13.BDD1A7A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf08.hostedemail.com (Postfix) with ESMTP id 951E2160172 for ; Mon, 8 Aug 2022 19:35:25 +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=gaYJc1Y+x++0gmr0tEmhrs1/PndL40dj2HR9/lZk7rM=; b=MBKrfPSbqEeh9a7k7UViMg+8DY okNJ+VS4qfOSJoof73tp1d9oHZWYj11O89S1QEqqlsMJfGhl12PUNwFRSFasKUIbaj2lPig58oh+/ nWKMgf1nPUPXd4qOt4GzHDRpXp8kW5g4r7E4kW9wOa1n70AYOH0NdH4+L5aOO7PSyGz5AwZy1Mehg N1pJKX3L5cmDm5B5ekzH9pOOslxNpBAWF35vE1+B6RrNoqOH+tjz8r59a3Bl7aV9Ftq+2G9hYKRtz wt8hIuM9LyAugLtK1IK0dnRiSz4U+3wSpZ72nBKkirmK2a1YSRQ0vKoD8cM0AE0Y/EqehGBW1APu/ u4HWGjzA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL8X5-00EAxT-VG; Mon, 08 Aug 2022 19:35:24 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , hughd@google.com Subject: [PATCH 27/59] shmem: Add shmem_get_folio() Date: Mon, 8 Aug 2022 20:33:55 +0100 Message-Id: <20220808193430.3378317-28-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220808193430.3378317-1-willy@infradead.org> References: <20220808193430.3378317-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659987325; a=rsa-sha256; cv=none; b=COA//NbdyMVSH0e1+JfCTiU07oPmmkUfZ57jdNm2/I6y0ByWVZs8IYsL0dAg10M8kaa2GJ N/fd82xMXx9FHwsZ04XU+aHcexjdC7mWadY+EX5LU4jA42jvkjI+FFptX4i7CneRjX/eYM Sv6wzgoS2r63ktE+5IzMk4XpRfubDEw= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=MBKrfPSb; spf=none (imf08.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659987325; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gaYJc1Y+x++0gmr0tEmhrs1/PndL40dj2HR9/lZk7rM=; b=DMc6fsUtcfO6vXziADYLBf3eUkrbBddXSAQvlF1HwgDPlBe6Vmvj3jiR0VlMJmXhGAYI5m MU6XpVsrNI5npdBQLTR9wAQ5APFjeCblpU8Tw/kPpxPD5QhxHPdFCgifGQJ4im7tl11IMZ hiavOgoG0uwBPs6Fm12B10H00kxhiUg= X-Rspamd-Queue-Id: 951E2160172 X-Rspam-User: X-Rspamd-Server: rspam11 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=MBKrfPSb; spf=none (imf08.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-Stat-Signature: txyjhzpn5mp18o448njksxa8m4d8htrn X-HE-Tag: 1659987325-940087 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: With no remaining callers of shmem_getpage_gfp(), add shmem_get_folio() and reimplement shmem_getpage() as a call to shmem_get_folio(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/shmem_fs.h | 2 ++ mm/shmem.c | 23 ++++++++++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 1b6c4013f691..0549929261f2 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -118,6 +118,8 @@ enum sgp_type { extern int shmem_getpage(struct inode *inode, pgoff_t index, struct page **pagep, enum sgp_type sgp); +int shmem_get_folio(struct inode *inode, pgoff_t index, struct folio **foliop, + enum sgp_type sgp); static inline struct page *shmem_read_mapping_page( struct address_space *mapping, pgoff_t index) diff --git a/mm/shmem.c b/mm/shmem.c index eaaadb7d31b7..75d9304b964e 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2023,14 +2023,18 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index, return error; } -static int shmem_getpage_gfp(struct inode *inode, pgoff_t index, - struct page **pagep, enum sgp_type sgp, - gfp_t gfp, struct vm_area_struct *vma, - struct vm_fault *vmf, vm_fault_t *fault_type) +int shmem_get_folio(struct inode *inode, pgoff_t index, struct folio **foliop, + enum sgp_type sgp) +{ + return shmem_get_folio_gfp(inode, index, foliop, sgp, + mapping_gfp_mask(inode->i_mapping), NULL, NULL, NULL); +} + +int shmem_getpage(struct inode *inode, pgoff_t index, + struct page **pagep, enum sgp_type sgp) { struct folio *folio = NULL; - int ret = shmem_get_folio_gfp(inode, index, &folio, sgp, gfp, vma, - vmf, fault_type); + int ret = shmem_get_folio(inode, index, &folio, sgp); if (folio) *pagep = folio_file_page(folio, index); @@ -2039,13 +2043,6 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index, return ret; } -int shmem_getpage(struct inode *inode, pgoff_t index, - struct page **pagep, enum sgp_type sgp) -{ - return shmem_getpage_gfp(inode, index, pagep, sgp, - mapping_gfp_mask(inode->i_mapping), NULL, NULL, NULL); -} - /* * This is like autoremove_wake_function, but it removes the wait queue * entry unconditionally - even if something else had already woken the -- 2.35.1