From: Christoph Hellwig <hch@lst.de>
To: Trond Myklebust <trond.myklebust@hammerspace.com>,
Anna Schumaker <anna@kernel.org>,
Matthew Wilcox <willy@infradead.org>
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 [thread overview]
Message-ID: <20240527163616.1135968-3-hch@lst.de> (raw)
In-Reply-To: <20240527163616.1135968-1-hch@lst.de>
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 <hch@lst.de>
---
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;
--
2.43.0
next prev parent reply other threads:[~2024-05-27 16:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 16:36 support large folios for NFS Christoph Hellwig
2024-05-27 16:36 ` [PATCH 1/2] filemap: Convert generic_perform_write() to support large folios Christoph Hellwig
2024-05-27 18:17 ` Matthew Wilcox
2024-05-28 8:12 ` Christoph Hellwig
2024-05-28 15:23 ` Daniel Gomez
2024-05-28 16:50 ` Matthew Wilcox
2024-05-28 19:01 ` Daniel Gomez
2024-06-11 10:47 ` Shaun Tancheff
2024-06-11 16:13 ` Christoph Hellwig
[not found] ` <1d87741b-7178-4791-aca2-da3ac3033552@gmail.com>
2024-06-12 4:02 ` Christoph Hellwig
2024-05-27 16:36 ` Christoph Hellwig [this message]
2024-05-27 19:43 ` support large folios for NFS Sagi Grimberg
2024-05-28 21:03 ` [PATCH] nfs: Fix misuses of folio_shift() and folio_order() Matthew Wilcox (Oracle)
2024-05-29 5:15 ` Christoph Hellwig
2024-05-29 6:30 ` Christoph Hellwig
2024-05-29 14:31 ` Trond Myklebust
2024-05-28 21:05 ` support large folios for NFS Matthew Wilcox
2024-05-29 5:14 ` Christoph Hellwig
2024-05-29 13:35 ` Trond Myklebust
2024-05-29 21:59 ` Trond Myklebust
2024-05-31 6:14 ` hch
2024-06-07 5:29 ` hch
2024-06-07 7:57 ` Cedric Blancher
2024-06-07 15:32 ` Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240527163616.1135968-3-hch@lst.de \
--to=hch@lst.de \
--cc=anna@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@hammerspace.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox