diff options
author | Matthew Wilcox <willy@infradead.org> | 2023-03-24 18:01:01 +0000 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2023-04-06 13:39:50 -0400 |
commit | e999a5c5a19cf3b679f3d93c49ad5f5c04e4806c (patch) | |
tree | 712cf4371e6126d1c4159078c3e00b02815d7848 /fs/netfs | |
parent | 361eb69fc99f1a8f1d653d69ecd742f3cbb896be (diff) | |
download | lwn-e999a5c5a19cf3b679f3d93c49ad5f5c04e4806c.tar.gz lwn-e999a5c5a19cf3b679f3d93c49ad5f5c04e4806c.zip |
fs: Add FGP_WRITEBEGIN
This particular combination of flags is used by most filesystems
in their ->write_begin method, although it does find use in a
few other places. Before folios, it warranted its own function
(grab_cache_page_write_begin()), but I think that just having specialised
flags is enough. It certainly helps the few places that have been
converted from grab_cache_page_write_begin() to __filemap_get_folio().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://lore.kernel.org/r/20230324180129.1220691-2-willy@infradead.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/netfs')
-rw-r--r-- | fs/netfs/buffered_read.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c index 7679a68e8193..e3d754a9e1b0 100644 --- a/fs/netfs/buffered_read.c +++ b/fs/netfs/buffered_read.c @@ -341,14 +341,13 @@ int netfs_write_begin(struct netfs_inode *ctx, { struct netfs_io_request *rreq; struct folio *folio; - unsigned int fgp_flags = FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE; pgoff_t index = pos >> PAGE_SHIFT; int ret; DEFINE_READAHEAD(ractl, file, NULL, mapping, index); retry: - folio = __filemap_get_folio(mapping, index, fgp_flags, + folio = __filemap_get_folio(mapping, index, FGP_WRITEBEGIN, mapping_gfp_mask(mapping)); if (!folio) return -ENOMEM; |