Skip to content

Commit e2e2e83

Browse files
committed
netfs: Allocate multipage folios in the writepath
Allocate a multipage folio when copying data into the pagecache if possible if there's sufficient data to warrant it. Signed-off-by: David Howells <[email protected]> Reviewed-by: Jeff Layton <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected]
1 parent 7f84a7b commit e2e2e83

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/netfs/buffered_write.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,19 @@ static enum netfs_how_to_modify netfs_how_to_modify(struct netfs_inode *ctx,
8484
}
8585

8686
/*
87-
* Grab a folio for writing and lock it.
87+
* Grab a folio for writing and lock it. Attempt to allocate as large a folio
88+
* as possible to hold as much of the remaining length as possible in one go.
8889
*/
8990
static struct folio *netfs_grab_folio_for_write(struct address_space *mapping,
9091
loff_t pos, size_t part)
9192
{
9293
pgoff_t index = pos / PAGE_SIZE;
94+
fgf_t fgp_flags = FGP_WRITEBEGIN;
9395

94-
return __filemap_get_folio(mapping, index, FGP_WRITEBEGIN,
96+
if (mapping_large_folio_support(mapping))
97+
fgp_flags |= fgf_set_order(pos % PAGE_SIZE + part);
98+
99+
return __filemap_get_folio(mapping, index, fgp_flags,
95100
mapping_gfp_mask(mapping));
96101
}
97102

0 commit comments

Comments
 (0)