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 53295C00140 for ; Mon, 8 Aug 2022 19:35:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 55C06940017; Mon, 8 Aug 2022 15:35:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 45DFB94001B; Mon, 8 Aug 2022 15:35:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F3188940018; Mon, 8 Aug 2022 15:35:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D3EAB940017 for ; Mon, 8 Aug 2022 15:35:28 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A2FA91A0BE3 for ; Mon, 8 Aug 2022 19:35:28 +0000 (UTC) X-FDA: 79777429536.09.1226299 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id 05DDD1C0198 for ; Mon, 8 Aug 2022 19:35:27 +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=p/s7zN93eAE1jGt/6wsL0yiCckkaIiWrMsY7IVplJbc=; b=oWn4fTyBqdtA9Is6IiO9a7lCt4 TM968kd/J292cDXPKpFZDfodfSQoDPBtdu4vmakLudO24c1NFdCCrygpEn6++SjVpymASGGHjooQW WUCdPUOCC2QGyff0+KGhp3lNp/YyktVrw8MMELci43w0n9lxost4O6pW2fj0r0Ze/xh37z5ij0CsI 0vPbci5N5hB7GcVF1CN504EsSLlPmWZFhUdc4nxi2U6+4t8mQTlnwHa7Rqk7xADOzdOrCHgPJtIbI atjoOaMafMfAfQXL7OMMIFui0ERQicVWAYqASXOXkVjn51KwRJMjjhSfRY1eckdGSrOfvkYxzDpZp qdi3SgoQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL8X6-00EAxl-Fw; 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 29/59] shmem: Convert shmem_write_begin() to use shmem_get_folio() Date: Mon, 8 Aug 2022 20:33:57 +0100 Message-Id: <20220808193430.3378317-30-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-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=oWn4fTyB; spf=none (imf21.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659987328; a=rsa-sha256; cv=none; b=g8FBlNUXu44Ll2GdSGYRkfDYZq7/OUNTspipffEdsjNohjf8x+TbunjpwycxTR6mTKQY4n VeLtXtiCqRn0RmRtAC6RWjqMU+9p9kQWi/4JwP4C+X/6VKMPNG7T/F2TpxC5G6BMN9Yead S4SpGoaQ1GtG3Xaq4PyeNrsWgahYFoc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659987328; 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=p/s7zN93eAE1jGt/6wsL0yiCckkaIiWrMsY7IVplJbc=; b=QF8ehIgwlatPVdK1NQwWdFMjNRzteS8v/xZYFcN2++eh0dhPQE11iYC90KciVItWdHa3Bg /m+cDl6wP6i9ISnd+S7UQKwfyc/6OKAtqhixm4OdW/DBZvCtw8OzCW9Ch85sksSYx8mw4n GV1NQtwViK3wuVdhRkRRefY3xuXOIA0= X-Stat-Signature: asipgqt79t63fkspiwa5q6bnpkhqgjay X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 05DDD1C0198 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=oWn4fTyB; spf=none (imf21.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: 1659987327-418696 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: Use a folio throughout this function, saving a couple of calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/shmem.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index b26ab3167040..45212001effd 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2482,6 +2482,7 @@ shmem_write_begin(struct file *file, struct address_space *mapping, struct inode *inode = mapping->host; struct shmem_inode_info *info = SHMEM_I(inode); pgoff_t index = pos >> PAGE_SHIFT; + struct folio *folio; int ret = 0; /* i_rwsem is held by caller */ @@ -2493,14 +2494,15 @@ shmem_write_begin(struct file *file, struct address_space *mapping, return -EPERM; } - ret = shmem_getpage(inode, index, pagep, SGP_WRITE); + ret = shmem_get_folio(inode, index, &folio, SGP_WRITE); if (ret) return ret; + *pagep = folio_file_page(folio, index); if (PageHWPoison(*pagep)) { - unlock_page(*pagep); - put_page(*pagep); + folio_unlock(folio); + folio_put(folio); *pagep = NULL; return -EIO; } -- 2.35.1