From patchwork Mon May 27 16:36:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13675640 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 D1105C25B74 for ; Mon, 27 May 2024 16:36:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 694CC6B0098; Mon, 27 May 2024 12:36:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 66B466B0099; Mon, 27 May 2024 12:36:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 532AB6B009A; Mon, 27 May 2024 12:36:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 387EC6B0098 for ; Mon, 27 May 2024 12:36:28 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E18181A08D5 for ; Mon, 27 May 2024 16:36:27 +0000 (UTC) X-FDA: 82164728814.22.DC4CBFD Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf03.hostedemail.com (Postfix) with ESMTP id 5656120016 for ; Mon, 27 May 2024 16:36:26 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=DF+0PB+J; spf=none (imf03.hostedemail.com: domain of BATV+4fba24c4406d7dd25148+7582+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+4fba24c4406d7dd25148+7582+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716827786; 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=27+lP32Q2mw19iey55M36pSytXlr5S4+SrngC3O6v+s=; b=K4sxsngAz565ld/+VOEtIyXChO6FrJpXJtNvQbpYMWQb3YOBm3Mxg1nBXetkpHlJHUQgOH WQ4f0XYWdjTZ93PZbunh4Ignbf61mQRgylNvtaQA6wmGRATqhVhnb2excTI/+ME+E77gfm TMlL6nzONolzSY2VLkBvtmQFxtgg1gc= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=DF+0PB+J; spf=none (imf03.hostedemail.com: domain of BATV+4fba24c4406d7dd25148+7582+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+4fba24c4406d7dd25148+7582+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716827786; a=rsa-sha256; cv=none; b=nd9eh2scuxvG/BV1fJBmpVSqGjhqgKU+0RO8Y4PzzpXyvIiXIpVGoazRUIIQf88zOOYpZm 1qjEv4cPRAI3iZTtg7UIc3lKYDedozP2B8ZXqDnfR8mN60WJ0/OCn57Px1+EpLmMO0hW6k BEZ+V0OcXWrx5VQJuS9e6VyLIysNCTs= 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=27+lP32Q2mw19iey55M36pSytXlr5S4+SrngC3O6v+s=; b=DF+0PB+J1G3GjShibBUkkXKzbg fXBJp4C12z3fLlSUjFb8iSZ12AevUEdRfRjZ65AWcrNk697Svt6DuF5gVqg4QjbjnUClInBMEI1fO TfEbmNaMYRqU/2QXTmXXyJL+AvEdUbrZ+JSijhLQH8oOgsoRdGmy8m7OGPwOckiF+0Z6qGrT1GbQv T/4dxOFKBIJdGP/bWENwVdcqF0qb34xY2V4MCNg0VQwK49HqlXvDjpSaCsAvfsFMLwrrOFg7l6wSd dCI/QdL+yV5U3WF7sB3kYhStTLsR9aFpkkG+H5/jCwMl6/YKu7F1t0WFZn5pMml3EY9duNuMKrv16 rsI69DyQ==; Received: from 2a02-8389-2341-5b80-3177-e4c1-2108-f294.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:3177:e4c1:2108:f294] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBdKh-0000000Ft6T-11pI; Mon, 27 May 2024 16:36:23 +0000 From: Christoph Hellwig To: Trond Myklebust , Anna Schumaker , Matthew Wilcox Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/2] filemap: Convert generic_perform_write() to support large folios Date: Mon, 27 May 2024 18:36:08 +0200 Message-ID: <20240527163616.1135968-2-hch@lst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240527163616.1135968-1-hch@lst.de> References: <20240527163616.1135968-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-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5656120016 X-Stat-Signature: ijtpfborafa4zde91t91ukhtrrzazcxq X-Rspam-User: X-HE-Tag: 1716827786-678201 X-HE-Meta: U2FsdGVkX1/oGjukJu7w8tGUMbkHpgsYv/UV/U76BNlJ2pgAjdzLcEMl+Nf3l2FwjyiJXHJjEpBhxey4JGAYv1pTaM85bbyNQCSJoxeH9wvdintnNZlDLJZWbt86MJpqC5CtU95TK393mRdEXFy0OurRBStsxfVUbjM1izISXLk4rbONyOH3W3U20q97yHyB88rMdSowB394IdVophUx1TMFOOsmrHsQpqX0WCgDbKwbUh9MRB2BaX3UNOmUvT9d0HP+bAwb26lt3p7BJYJEiOWl4k9BcRWjypZUxdUc0c/jBoE650SoHlpPCLlkMqZd4GytkPFAb9bZwuboo4bm5eWGCXNlrACOInDvsh39PejfZ6qqZi1TH9M66rlGo10K6b+6faICt209hChlG0717sy5USz1/OTHyC9dhGNqe8IlNc/FKR0JfYW+mzA/gADlEFCiN52trOQqF/iDzdhMwawTC5TQbsNf4+uOACShRtmx44lywg2rQNPiIF7AwmEjbeQaA+Y7l0QgYm8C+vq9Pu0mNFZPfLGvwfglB+uqftjmpgKnIFpxuqzDaM4QUcEhkUUMMJWtgOH5oci+syuNTmSPYRyI8LNpjveuDqWtNBtUeOiJ1QFfwrSp5PLPO8yEUCa6tij+2Rzjh+ssngmRojjnxb/y2MZKB3Ks0kbGvCFtEuDQvGpcJpmSqumH+WUYMYLXRcX9n6stosmIObK4RpttrznaCRD5qd1Dz95gaX7wbllXpSJyIrm4Pr+8VszUIYbmPcBymzVFx+3qyRhqYT8t9nUwABQxJBtmsbd7hVrvtDVFPJ6kgXd5YlvtFSDfDJUE+wh6muhWDIvcSpMqUxB1P2hytcqNNC+iOyDzG6yPXDWx6yn9WWFpFRSYmjL/YEZ0H5tPM1/I9dEEcIXwY950MRyxOnkbRQe0JBmA92HeS/q2XqTRyQGTvMDga7VcrlRzDKVhLw6zzquO6ab 8oIHNvTq fjCHREwfyCReIhptMeh3UAnIweaalpGim+JYOAQXIZaCRSEo+8QALY90dSvvH0zS3ad5SujkLDgJ0SqX+u6zk0b/4S4YTfeOmUBrfI5dHnluvEK34W+th9IcgycQXbPEt7Y9Yr22k2hmLdTgD1SaSy0LEE5cLyoUJyTdjFZuXAzpuALW5kY9tpTaJOnME1JA0mzZQS4bVzlT8srjhqDdTBmbmZg== 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: List-Subscribe: List-Unsubscribe: From: "Matthew Wilcox (Oracle)" Modelled after the loop in iomap_write_iter(), copy larger chunks from userspace if the filesystem has created large folios. Signed-off-by: Matthew Wilcox (Oracle) [hch: use mapping_max_folio_size to keep supporting file systems that do not support large folios] Signed-off-by: Christoph Hellwig Tested-by: Shaun Tancheff --- mm/filemap.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 382c3d06bfb10c..860728e26ccf32 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3981,21 +3981,24 @@ ssize_t generic_perform_write(struct kiocb *iocb, struct iov_iter *i) loff_t pos = iocb->ki_pos; struct address_space *mapping = file->f_mapping; const struct address_space_operations *a_ops = mapping->a_ops; + size_t chunk = mapping_max_folio_size(mapping); long status = 0; ssize_t written = 0; do { struct page *page; - unsigned long offset; /* Offset into pagecache page */ - unsigned long bytes; /* Bytes to write to page */ + struct folio *folio; + size_t offset; /* Offset into folio */ + size_t bytes; /* Bytes to write to folio */ size_t copied; /* Bytes copied from user */ void *fsdata = NULL; - offset = (pos & (PAGE_SIZE - 1)); - bytes = min_t(unsigned long, PAGE_SIZE - offset, - iov_iter_count(i)); + bytes = iov_iter_count(i); +retry: + offset = pos & (chunk - 1); + bytes = min(chunk - offset, bytes); + balance_dirty_pages_ratelimited(mapping); -again: /* * Bring in the user page that we will copy from _first_. * Otherwise there's a nasty deadlock on copying from the @@ -4017,11 +4020,16 @@ ssize_t generic_perform_write(struct kiocb *iocb, struct iov_iter *i) if (unlikely(status < 0)) break; + folio = page_folio(page); + offset = offset_in_folio(folio, pos); + if (bytes > folio_size(folio) - offset) + bytes = folio_size(folio) - offset; + if (mapping_writably_mapped(mapping)) - flush_dcache_page(page); + flush_dcache_folio(folio); - copied = copy_page_from_iter_atomic(page, offset, bytes, i); - flush_dcache_page(page); + copied = copy_folio_from_iter_atomic(folio, offset, bytes, i); + flush_dcache_folio(folio); status = a_ops->write_end(file, mapping, pos, bytes, copied, page, fsdata); @@ -4039,14 +4047,16 @@ ssize_t generic_perform_write(struct kiocb *iocb, struct iov_iter *i) * halfway through, might be a race with munmap, * might be severe memory pressure. */ - if (copied) + if (chunk > PAGE_SIZE) + chunk /= 2; + if (copied) { bytes = copied; - goto again; + goto retry; + } + } else { + pos += status; + written += status; } - pos += status; - written += status; - - balance_dirty_pages_ratelimited(mapping); } while (iov_iter_count(i)); if (!written) From patchwork Mon May 27 16:36:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13675641 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 4DAF8C25B74 for ; Mon, 27 May 2024 16:36:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 533FF6B0099; Mon, 27 May 2024 12:36:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4BD956B009A; Mon, 27 May 2024 12:36:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 311656B009B; Mon, 27 May 2024 12:36:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0DA6F6B0099 for ; Mon, 27 May 2024 12:36:30 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id BE5761A02F2 for ; Mon, 27 May 2024 16:36:29 +0000 (UTC) X-FDA: 82164728898.11.F03254B Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf11.hostedemail.com (Postfix) with ESMTP id 37ED14000C for ; Mon, 27 May 2024 16:36:28 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=K2OYVydg; spf=none (imf11.hostedemail.com: domain of BATV+4fba24c4406d7dd25148+7582+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+4fba24c4406d7dd25148+7582+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716827788; 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=K4Mxq5Sr+5purWqI8GGeOoyAJxibrH1gh6qH/UJ9bOw=; b=tkdmjTcXYpnsZjEuyrCryxD7m1YYHtA1NHp5ZJbUH8yx9XtJw6rFIB9b89gqWo9eMfcWYH dOPGDc8aFc4oGZGETv8vTUSnyZIZW0HoCwyY4ULWdVCaENS+f6J1jE3RS6zVJw0h+dDIWE PjOesphLXaq0SIZRAFyPd6Mm1gtNjBI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716827788; a=rsa-sha256; cv=none; b=Jq7KE8mng66+yCha+hrpFwlGtCYchDigEKRD+ojXFz5ZUy3UTCHa9+RNGCiVLM2OEcNF4v HWx2cGlpKncIYDP1bXPhamdK2tYQ0wzRQLdMHsKgSzw3Ni4iHRAecTSbduz/42IrO7mXpO S7ZEFabS6Aga0OMahChBdznXs1pmQR8= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=K2OYVydg; spf=none (imf11.hostedemail.com: domain of BATV+4fba24c4406d7dd25148+7582+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+4fba24c4406d7dd25148+7582+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none 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=K4Mxq5Sr+5purWqI8GGeOoyAJxibrH1gh6qH/UJ9bOw=; b=K2OYVydgR+//Tm+fbwytqZykcF MrgUbGSku0QuXH1fWLVjNH2ND/9nYF9fqS34hhFdndgKYKYGc2T7RsAgcq628Wt96VO7vdDbnlTBu VztbKpmWjw6h0VkDDqTBOiVaWP29qg6arvApSZmKPwVX7r4Z5wm8MR0CI4Ibaepbk7JmSMJIYgnea BiKHFs1s6lcYlvMC7PplksdiAm/46rv7/lwE5V+dszHmcsdmdLtYNqirCe7R1X2o6MCFlr0bj0VNX G3+N+JdoLsFxUOpLA9+t+uHTKLsp7hOl3z5FLNSqG+XkXX33/C9pqnIvse9fHjugysF+ilMEOpuWA r1uXFRRw==; Received: from 2a02-8389-2341-5b80-3177-e4c1-2108-f294.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:3177:e4c1:2108:f294] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBdKj-0000000Ft6i-2WfQ; Mon, 27 May 2024 16:36:26 +0000 From: Christoph Hellwig To: Trond Myklebust , Anna Schumaker , Matthew Wilcox Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/2] nfs: add support for large folios Date: Mon, 27 May 2024 18:36:09 +0200 Message-ID: <20240527163616.1135968-3-hch@lst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240527163616.1135968-1-hch@lst.de> References: <20240527163616.1135968-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-Rspam-User: X-Stat-Signature: mw1q6zxkozdaybntse9tnxe18ewquqsa X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 37ED14000C X-HE-Tag: 1716827788-503712 X-HE-Meta: U2FsdGVkX19zL3IIEHCgC5FWwEyLeDG8OZ7YcRBq5RL2cI7vXuVgsg98LJY3yv9YtD7HF/AjaWxVNm81+2ccGcLBSv0IdsFODB6A1CClcjaVR8cpRopbdzhJcxodWRNacu4Xpv0/QTPDL6R5clRP258Sf/vIprG/BpT0PTh0DCjkcfEadsXnyw5sS5kEAOAut3W+7UAmvxAukRo6xlZ8sn8XL4+m8cqcoL+j9MkryeBHuhrmEW0Nvimqiw5SExEuYcZVkDmUBWDILM8ANglceHaL2opDbkeZp0Cg8KyD1Cguoshayuv8Cc7B3/HjjiXVRP4GO5tN/zXXzw+INYuh0J7QuD+K8es37zT/Ecjc2caFHGggwyRVdkZTuWh/M5SPnxy3BAAUbmcP5Zs5m7HCArI5V7yrT8SolLQyXvj5gc40qZcwLosz8v0lx5M/chPXmc+M6kIh3G6qLdfl1GaZd7nakMJ6f127YNFuwOvVbxTMr/d0LEJ8o01x4dBGNRweb/F1xWExfWHy/93ysXsde6EUXSMU6E4mmVZ/pjczkJty30SuguMccvFts+sxmPHH2F1DusS3VCHHs81z/gCvzBIiSdH9iVfzYViMNVz6f7Gwsv+1R+jK5x1oTzELD8Z7/fipwuWYkOWT7eHOl6z1r6WSlJrocZ6Bce0lTeLhB5khp7P2tBKB9/7tdQKtwy5+/79PRD9Pk9qIlY+3oQyuMlm9Qai2T+yT3TXg64uEDIPMMy7wZzhXfjXLe1taidyNuF5R2br72UtVZeqRl3grEQpLgszIWcA2vgLxSy6oiS6Mdsi0HbQyGK4cu2iO3qXFs6dnWOxGtEGP8vVvAN68o9gqXzDhBa5e0lbvHkoLrerS9pp8VMxJqNRn2bsAk7apg8qe9BTXuU0RXtk0IoZtDR4mvlXDpseGg9pOP5r0u/N/7iyFV/0G+tKYBDz7y12yTFhbzE7eOveiT76gkT2 l6enzRiB 3lDoJS2H39wbbUMwKILKwmik+rXqZtdvzjleIS8r8CXr6Ez0XtbjlEzTBTFrjYXDXYZS3K1NoV8jK3IJb3iUYCY5ProHlSaHSZDvPOG6Y0h0Mk4rZvgAOJztpaPeIS/Z7rKDwavObI7OEWoi+fPFH+wWq+NkGDZGJyy64p2NNbaUfj2kF1yu1Ed/21zIPCq4g/cluvkez5gslcWKH6MaDjCaRuEicwoV69STki0pJ81noW5qk8OsCbwRU+hw9Be3960CQc37ruhS1yQHMZLn5U3kEcHkRgAHSX1vMz4MOofnWhh6KQJcLffvTR9L67Cd2RW70dNpnUwyv2tebb4L52Xzb3hFNyydGtLZyCt1XowkScXn72O8p37kMbGIyYgNrxo+aOdq49ffT924qbFNNkHEAI+9I/KBmGqE+ 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: List-Subscribe: List-Unsubscribe: NFS already is void of folio size assumption, so just pass the chunk size to __filemap_get_folio and set the large folio address_space flag for all regular files. Signed-off-by: Christoph Hellwig --- fs/nfs/file.c | 4 +++- fs/nfs/inode.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 6bd127e6683dce..7f1295475a90fd 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -339,6 +339,7 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, struct page **pagep, void **fsdata) { + fgf_t fgp = FGP_WRITEBEGIN; struct folio *folio; int once_thru = 0; int ret; @@ -346,8 +347,9 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping, dfprintk(PAGECACHE, "NFS: write_begin(%pD2(%lu), %u@%lld)\n", file, mapping->host->i_ino, len, (long long) pos); + fgp |= fgf_set_order(len); start: - folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, FGP_WRITEBEGIN, + folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, fgp, mapping_gfp_mask(mapping)); if (IS_ERR(folio)) return PTR_ERR(folio); diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index acef52ecb1bb7e..6d185af4cb29d4 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -491,6 +491,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) inode->i_fop = NFS_SB(sb)->nfs_client->rpc_ops->file_ops; inode->i_data.a_ops = &nfs_file_aops; nfs_inode_init_regular(nfsi); + mapping_set_large_folios(inode->i_mapping); } else if (S_ISDIR(inode->i_mode)) { inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->dir_inode_ops; inode->i_fop = &nfs_dir_operations;