Skip to content

Commit 49b29a5

Browse files
Christoph Hellwigamschuma-ntap
authored andcommitted
nfs: add support for large folios
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 <[email protected]> Tested-by: Sagi Grimberg <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 9aac777 commit 49b29a5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

fs/nfs/file.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,15 +339,17 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping,
339339
loff_t pos, unsigned len, struct page **pagep,
340340
void **fsdata)
341341
{
342+
fgf_t fgp = FGP_WRITEBEGIN;
342343
struct folio *folio;
343344
int once_thru = 0;
344345
int ret;
345346

346347
dfprintk(PAGECACHE, "NFS: write_begin(%pD2(%lu), %u@%lld)\n",
347348
file, mapping->host->i_ino, len, (long long) pos);
348349

350+
fgp |= fgf_set_order(len);
349351
start:
350-
folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, FGP_WRITEBEGIN,
352+
folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, fgp,
351353
mapping_gfp_mask(mapping));
352354
if (IS_ERR(folio))
353355
return PTR_ERR(folio);

fs/nfs/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
491491
inode->i_fop = NFS_SB(sb)->nfs_client->rpc_ops->file_ops;
492492
inode->i_data.a_ops = &nfs_file_aops;
493493
nfs_inode_init_regular(nfsi);
494+
mapping_set_large_folios(inode->i_mapping);
494495
} else if (S_ISDIR(inode->i_mode)) {
495496
inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->dir_inode_ops;
496497
inode->i_fop = &nfs_dir_operations;

0 commit comments

Comments
 (0)