Remove aop flags
Subsystems (37)
Matthew Wilcox (Oracle)
maintainercover Remove aop flags
Thanks to Edward, we can now remove all the AOP_FLAG uses in the kernel and remove the flags parameter from all write_begin implementations.
Edward Shishkin (1):
reiserfs: Stop using AOP_FLAG_CONT_EXPAND flag
Matthew Wilcox (Oracle) (21):
fs: Pass an iocb to generic_perform_write()
fs: Move pagecache_write_begin() and pagecache_write_end()
filemap: Remove AOP_FLAG_CONT_EXPAND
ext4: Use page_symlink() instead of __page_symlink()
namei: Merge page_symlink() and __page_symlink()
namei: Convert page_symlink() to use memalloc_nofs_save()
f2fs: Convert f2fs_grab_cache_page() to use scoped memory APIs
ext4: Allow GFP_FS allocations in
ext4_da_convert_inline_data_to_extent()
ext4: Use scoped memory API in mext_page_double_lock()
ext4: Use scoped memory APIs in ext4_da_write_begin()
ext4: Use scoped memory APIs in ext4_write_begin()
fs: Remove AOP_FLAG_NOFS
fs: Remove aop flags argument from pagecache_write_begin()
fs: Remove aop_flags parameter from netfs_write_begin()
fs: Remove aop flags parameter from block_write_begin()
fs: Remove aop flags parameter from cont_write_begin()
fs: Remove aop flags parameter from grab_cache_page_write_begin()
affs: Use pagecache_write_begin() & pagecache_write_end()
f2fs: Use pagecache_write_begin() & pagecache_write_end()
fs: Remove aop flags parameter from nobh_write_begin()
fs: Remove flags parameter from aops->write_begin
Documentation/filesystems/locking.rst | 2 +- Documentation/filesystems/netfs_library.rst | 1 - Documentation/filesystems/porting.rst | 2 +- Documentation/filesystems/vfs.rst | 5 +-- block/fops.c | 6 +-- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 6 +-- fs/9p/vfs_addr.c | 4 +- fs/adfs/inode.c | 4 +- fs/affs/file.c | 14 ++++--- fs/afs/internal.h | 2 +- fs/afs/write.c | 4 +- fs/bfs/file.c | 5 +-- fs/buffer.c | 20 +++++----- fs/ceph/addr.c | 6 +-- fs/ceph/file.c | 2 +- fs/cifs/file.c | 4 +- fs/ecryptfs/mmap.c | 4 +- fs/exfat/inode.c | 4 +- fs/ext2/inode.c | 11 ++---- fs/ext4/ext4.h | 2 - fs/ext4/file.c | 2 +- fs/ext4/inline.c | 41 ++++++++++----------- fs/ext4/inode.c | 19 +++++----- fs/ext4/move_extent.c | 13 +++++-- fs/ext4/namei.c | 7 +++- fs/ext4/verity.c | 2 +- fs/f2fs/data.c | 5 +-- fs/f2fs/f2fs.h | 9 ++++- fs/f2fs/file.c | 2 +- fs/f2fs/super.c | 5 +-- fs/f2fs/verity.c | 2 +- fs/fat/inode.c | 4 +- fs/fuse/file.c | 7 ++-- fs/hfs/extent.c | 2 +- fs/hfs/inode.c | 4 +- fs/hfsplus/extents.c | 2 +- fs/hfsplus/inode.c | 4 +- fs/hostfs/hostfs_kern.c | 4 +- fs/hpfs/file.c | 4 +- fs/hugetlbfs/inode.c | 2 +- fs/jffs2/file.c | 6 +-- fs/jfs/inode.c | 5 +-- fs/libfs.c | 4 +- fs/minix/inode.c | 5 +-- fs/namei.c | 25 +++++-------- fs/netfs/read_helper.c | 8 +--- fs/nfs/file.c | 6 +-- fs/nilfs2/inode.c | 5 +-- fs/nilfs2/recovery.c | 2 +- fs/ntfs3/file.c | 2 +- fs/ntfs3/inode.c | 8 ++-- fs/ocfs2/aops.c | 2 +- fs/omfs/file.c | 5 +-- fs/orangefs/inode.c | 7 ++-- fs/reiserfs/inode.c | 20 ++++------ fs/sysv/itree.c | 4 +- fs/ubifs/file.c | 11 +++--- fs/udf/file.c | 4 +- fs/udf/inode.c | 4 +- fs/ufs/inode.c | 5 +-- include/linux/buffer_head.h | 6 +-- include/linux/fs.h | 25 ++----------- include/linux/netfs.h | 2 +- include/linux/pagemap.h | 22 ++++++++++- include/trace/events/ext4.h | 21 ++++------- include/trace/events/f2fs.h | 12 ++---- mm/filemap.c | 34 ++++------------- mm/folio-compat.c | 4 +- mm/shmem.c | 2 +- 69 files changed, 227 insertions(+), 287 deletions(-)
Signature · 1 line
2.34.1
Matthew Wilcox (Oracle)
maintainerPATCH 1/22 fs: Pass an iocb to generic_perform_write()
We can extract both the file pointer and the pos from the iocb. This simplifies each caller as well as allowing generic_perform_write() to see more of the iocb contents in the future.
--- fs/ceph/file.c | 2 +- fs/ext4/file.c | 2 +- fs/f2fs/file.c | 2 +- fs/nfs/file.c | 2 +- include/linux/fs.h | 2 +- mm/filemap.c | 10 ++++++---- 6 files changed, 11 insertions(+), 9 deletions(-)
fs/ceph/file.c +1 -1
@@ -1845,7 +1845,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)* are pending vmtruncate. So write and vmtruncate * can not run at the same time */ - written =generic_perform_write (file, from, pos); + written =generic_perform_write (iocb, from);if (likely (written >=0 )) iocb->ki_pos = pos + written;ceph_end_io_write (inode);
fs/ext4/file.c +1 -1
@@ -265,7 +265,7 @@ static ssize_t ext4_buffered_write_iter(struct kiocb *iocb, goto out; current->backing_dev_info =inode_to_bdi (inode); - ret =generic_perform_write (iocb->ki_filp, from, iocb->ki_pos); + ret =generic_perform_write (iocb, from); current->backing_dev_info =NULL ; out:
fs/f2fs/file.c +1 -1
@@ -4445,7 +4445,7 @@ static ssize_t f2fs_buffered_write_iter(struct kiocb *iocb,return -EOPNOTSUPP ; current->backing_dev_info =inode_to_bdi (inode); - ret =generic_perform_write (file, from, iocb->ki_pos); + ret =generic_perform_write (iocb, from); current->backing_dev_info =NULL ;if (ret >0 ) {
fs/nfs/file.c +1 -1
@@ -642,7 +642,7 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from) result =generic_write_checks (iocb, from);if (result >0 ) { current->backing_dev_info =inode_to_bdi (inode); - result =generic_perform_write (file, from, iocb->ki_pos); + result =generic_perform_write (iocb, from); current->backing_dev_info =NULL ; }nfs_end_io_write (inode);
include/linux/fs.h +1 -1
@@ -3117,7 +3117,7 @@ extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *);extern ssize_t __generic_file_write_iter (struct kiocb *,struct iov_iter *);extern ssize_t generic_file_write_iter (struct kiocb *,struct iov_iter *);extern ssize_t generic_file_direct_write (struct kiocb *,struct iov_iter *); -extern ssize_t generic_perform_write (struct file *,struct iov_iter *,loff_t ); +extern ssize_t generic_perform_write (struct kiocb *,struct iov_iter *);ssize_t vfs_iter_read (struct file *file,struct iov_iter *iter,loff_t *ppos,rwf_t flags);
mm/filemap.c +6 -4
@@ -3725,9 +3725,10 @@ generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from) }EXPORT_SYMBOL (generic_file_direct_write); -ssize_t generic_perform_write (struct file *file, -struct iov_iter *i,loff_t pos) +ssize_t generic_perform_write (struct kiocb *iocb,struct iov_iter *i) { +struct file *file = iocb->ki_filp; +loff_t pos = iocb->ki_pos;struct address_space *mapping = file->f_mapping;const struct address_space_operations *a_ops = mapping->a_ops;long status =0 ;
@@ -3857,7 +3858,8 @@ ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from)if (written <0 || !iov_iter_count (from) ||IS_DAX (inode)) goto out; - status =generic_perform_write (file, from, pos = iocb->ki_pos); + pos = iocb->ki_pos; + status =generic_perform_write (iocb, from);/* * If generic_perform_write() returned a synchronous error * then we want to return the number of bytes which were
@@ -3889,7 +3891,7 @@ ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from)*/ } }else { - written =generic_perform_write (file, from, iocb->ki_pos); + written =generic_perform_write (iocb, from);if (likely (written >0 )) iocb->ki_pos += written; }
Signature · 1 line
2.34.1
Re: [PATCH 01/22] fs: Pass an iocb to generic_perform_write()
include/linux/fs.h extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); · line 3120
Quoted 2 lines
include/linux/fs.h +1
-1-extern ssize_t generic_perform_write (struct file *,struct iov_iter *,loff_t ); +extern ssize_t generic_perform_write (struct kiocb *,struct iov_iter *);
Please drop the extern and spell out the parameter names while you're at it.
Otherwise looks fine:
Matthew Wilcox
maintainerRe: [PATCH 01/22] fs: Pass an iocb to generic_perform_write()
Quoted 5 lines · Christoph Hellwig
include/linux/fs.h extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); · line 3120
Quoted 2 lines
include/linux/fs.h +1
-1-extern ssize_t generic_perform_write (struct file *,struct iov_iter *,loff_t ); +extern ssize_t generic_perform_write (struct kiocb *,struct iov_iter *);Please drop the extern and spell out the parameter names while you're at it.
I don't mind dropping the 'extern', but I don't see the value in naming the parameters. For something like 'int' or 'void *', you need to know what kind of thing you're dealing with, but if you're passing one kiocb, calling it 'iocb' gives no extra information. If you're passing two, then knowing which is 'src' and which is 'dest' is useful.
Quoted 3 lines
Otherwise looks fine:
Reviewed-by Christoph Hellwig <[email protected]>
Re: [PATCH 01/22] fs: Pass an iocb to generic_perform_write()
In reply to Matthew Wilcox (Oracle)Quoted 6 lines · Matthew Wilcox
We can extract both the file pointer and the pos from the iocb. This simplifies each caller as well as allowing
generic_perform_write()to see more of the iocb contents in the future.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>---
Nice simplification,
Matthew Wilcox (Oracle)
maintainerPATCH 2/22 fs: Move pagecache_write_begin() and pagecache_write_end()
In reply to Matthew Wilcox (Oracle)These functions are now simple enough to be static inlines. They should also be in pagemap.h instead of fs.h because they're pagecache functions.
--- include/linux/fs.h | 12 ------------ include/linux/pagemap.h | 20 ++++++++++++++++++++ mm/filemap.c | 21 --------------------- 3 files changed, 20 insertions(+), 33 deletions(-)
include/linux/fs.h +0 -12
@@ -391,18 +391,6 @@ struct address_space_operations {extern const struct address_space_operations empty_aops; -/* -* pagecache_write_begin/pagecache_write_end must be used by general code -* to write into the pagecache. -*/ -int pagecache_write_begin (struct file *,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, -struct page **pagep,void **fsdata); - -int pagecache_write_end (struct file *,struct address_space *mapping, -loff_t pos,unsigned len,unsigned copied, -struct page *page,void *fsdata); -/** * struct address_space - Contents of a cacheable, mappable object. * @host: Owner, either the inode or the block_device.
include/linux/pagemap.h +20 -0
@@ -529,6 +529,26 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping, mapping_gfp_mask(mapping)); } +/* +* pagecache_write_begin/pagecache_write_end must be used by general code +* to write into the pagecache. +*/ +static inline int pagecache_write_begin (struct file *file, +struct address_space *mapping,loff_t pos,unsigned len, +unsigned flags,struct page **pagep,void **fsdata) +{ +return mapping->a_ops->write_begin (file, mapping, pos, len, flags, + pagep, fsdata); +} + +static inline int pagecache_write_end (struct file *file, +struct address_space *mapping,loff_t pos,unsigned len, +unsigned copied,struct page *page,void *fsdata) +{ +return mapping->a_ops->write_end (file, mapping, pos, len, copied, + page, fsdata); +} +#define swapcache_index (folio) __page_file_index(&(folio)->page)/**
mm/filemap.c +0 -21
@@ -3601,27 +3601,6 @@ struct page *read_cache_page_gfp(struct address_space *mapping, }EXPORT_SYMBOL (read_cache_page_gfp); -int pagecache_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, -struct page **pagep,void **fsdata) -{ -const struct address_space_operations *aops = mapping->a_ops; - -return aops->write_begin (file, mapping, pos, len, flags, - pagep, fsdata); -} -EXPORT_SYMBOL (pagecache_write_begin); - -int pagecache_write_end (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned copied, -struct page *page,void *fsdata) -{ -const struct address_space_operations *aops = mapping->a_ops; - -return aops->write_end (file, mapping, pos, len, copied, page, fsdata); -} -EXPORT_SYMBOL (pagecache_write_end); -/* * Warn about a page cache invalidation failure during a direct I/O write. */
Signature · 1 line
2.34.1
Re: [PATCH 02/22] fs: Move pagecache_write_begin() and pagecache_write_end()
Quoted 3 lines · Matthew Wilcox (Oracle)
These functions are now simple enough to be static inlines. They should also be in
pagemap.hinstead offs.hbecause they're pagecache functions.
I wonder if we should keep them at all. For the core fs code calling the methods directly seems perfectly fine. And the calles in the file systems should just call the implementations and avoid the indirection.
And the callers in i915 look very suspicious.
Re: [PATCH 02/22] fs: Move pagecache_write_begin() and pagecache_write_end()
In reply to Matthew Wilcox (Oracle)Quoted 6 lines · Matthew Wilcox
These functions are now simple enough to be static inlines. They should also be in
pagemap.hinstead offs.hbecause they're pagecache functions.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>---
Good to see the header shrink further!
Matthew Wilcox (Oracle)
maintainerPATCH 3/22 reiserfs: Stop using AOP_FLAG_CONT_EXPAND flag
In reply to Matthew Wilcox (Oracle)From: Edward Shishkin <[email protected]>
We can simplify write_begin() and write_end() by handling the cont_expand case in reiserfs_setattr().
--- fs/reiserfs/inode.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
fs/reiserfs/inode.c +5 -11
@@ -2763,13 +2763,6 @@ static int reiserfs_write_begin(struct file *file,int old_ref =0 ; inode = mapping->host; - *fsdata =NULL ; -if (flags &AOP_FLAG_CONT_EXPAND && - (pos & (inode->i_sb->s_blocksize -1 )) ==0 ) { - pos ++; - *fsdata = (void *)(unsigned long )flags; - } - index = pos >>PAGE_SHIFT ; page =grab_cache_page_write_begin (mapping, index, flags);if (!page)
@@ -2896,9 +2889,6 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,unsigned start;bool locked = false; -if ((unsigned long )fsdata &AOP_FLAG_CONT_EXPAND ) - pos ++; -reiserfs_wait_on_write_block (inode->i_sb);if (reiserfs_transaction_running (inode->i_sb)) th = current->journal_info;
@@ -3316,7 +3306,11 @@ int reiserfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,/* fill in hole pointers in the expanding truncate case. */ if (attr->ia_size > inode->i_size) { - error =generic_cont_expand_simple (inode, attr->ia_size); +loff_t pos = attr->ia_size; + +if ((pos & (inode->i_sb->s_blocksize -1 )) ==0 ) + pos++; + error =generic_cont_expand_simple (inode, pos);if (REISERFS_I (inode)->i_prealloc_count >0 ) {int err;struct reiserfs_transaction_handle th;
Signature · 1 line
2.34.1
Re: [PATCH 03/22] reiserfs: Stop using AOP_FLAG_CONT_EXPAND flag
Quoted 7 lines · Matthew Wilcox (Oracle)
From: Edward Shishkin <[email protected]>
We can simplify
write_begin()andwrite_end()by handling thecont_expandcase inreiserfs_setattr().Signed-off-by Edward Shishkin <[email protected]>Signed-off-by Matthew Wilcox (Oracle) <[email protected]>
Looks good:
Matthew Wilcox (Oracle)
maintainerPATCH 4/22 filemap: Remove AOP_FLAG_CONT_EXPAND
In reply to Matthew Wilcox (Oracle)This flag is no longer used, so remove it.
--- fs/buffer.c | 3 +-- include/linux/fs.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
fs/buffer.c +1 -2
@@ -2352,8 +2352,7 @@ int generic_cont_expand_simple(struct inode *inode, loff_t size)if (err) goto out; - err =pagecache_write_begin (NULL , mapping, size,0 , -AOP_FLAG_CONT_EXPAND , &page, &fsdata); + err =pagecache_write_begin (NULL , mapping, size,0 ,0 , &page, &fsdata);if (err) goto out;
include/linux/fs.h +0 -1
@@ -274,7 +274,6 @@ enum positive_aop_returns { AOP_TRUNCATED_PAGE = 0x80001, }; -#define AOP_FLAG_CONT_EXPAND 0x0001/* called from cont_expand */ #define AOP_FLAG_NOFS 0x0002/* used by filesystem to direct * helper code (eg buffer layer) * to clear GFP_FS from alloc */
Signature · 1 line
2.34.1
Re: [PATCH 04/22] filemap: Remove AOP_FLAG_CONT_EXPAND
Looks good,
Matthew Wilcox (Oracle)
maintainerPATCH 5/22 ext4: Use page_symlink() instead of __page_symlink()
In reply to Matthew Wilcox (Oracle)By using the memalloc_nofs_save() functionality, we can call page_symlink(), safe in the knowledge that it won't recurse into the filesystem.
--- fs/ext4/namei.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/ext4/namei.c +6 -1
@@ -29,6 +29,7 @@#include <linux/pagemap.h> #include <linux/time.h> #include <linux/fcntl.h> +#include <linux/sched/mm.h> #include <linux/stat.h> #include <linux/string.h> #include <linux/quotaops.h>
@@ -3308,6 +3309,8 @@ static int ext4_symlink(struct user_namespace *mnt_userns, struct inode *dir, }if ((disk_link.len >EXT4_N_BLOCKS *4 )) { +unsigned int flags; +if (!IS_ENCRYPTED (inode)) inode->i_op = &ext4_symlink_inode_operations;inode_nohighmem (inode);
@@ -3329,7 +3332,9 @@ static int ext4_symlink(struct user_namespace *mnt_userns, struct inode *dir, handle =NULL ;if (err) goto err_drop_inode; - err =__page_symlink (inode, disk_link.name, disk_link.len,1 ); + flags =memalloc_nofs_save (); + err =page_symlink (inode, disk_link.name, disk_link.len); +memalloc_nofs_restore (flags);if (err) goto err_drop_inode;/*
Signature · 1 line
2.34.1
Re: [PATCH 05/22] ext4: Use page_symlink() instead of __page_symlink()
Looks good:
Matthew Wilcox (Oracle)
maintainerPATCH 6/22 namei: Merge page_symlink() and __page_symlink()
In reply to Matthew Wilcox (Oracle)There are no callers of __page_symlink() left, so we can remove that entry point.
--- Documentation/filesystems/porting.rst | 2 +- fs/namei.c | 13 ++----------- include/linux/fs.h | 2 -- 3 files changed, 3 insertions(+), 14 deletions(-)
Documentation/filesystems/porting.rst +1 -1
@@ -618,7 +618,7 @@ any symlink that might use page_follow_link_light/page_put_link() must have inode_nohighmem(inode) called before anything might start playing with its pagecache. No highmem pages should end up in the pagecache of such symlinks. That includes any preseeding that might be done during symlink -creation. __page_symlink() will honour the mapping gfp flags, so once +creation. page_symlink() will honour the mapping gfp flags, so once you've done inode_nohighmem() it's safe to use, but if you allocate and insert the page manually, make sure to use the right gfp flags.
fs/namei.c +2 -11
@@ -5003,12 +5003,10 @@ int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) }EXPORT_SYMBOL (page_readlink); -/* -* The nofs argument instructs pagecache_write_begin to pass AOP_FLAG_NOFS -*/ -int __page_symlink (struct inode *inode,const char *symname,int len,int nofs) +int page_symlink (struct inode *inode,const char *symname,int len) {struct address_space *mapping = inode->i_mapping; +bool nofs = !mapping_gfp_constraint (mapping, __GFP_FS);struct page *page;void *fsdata;int err;
@@ -5036,13 +5034,6 @@ int __page_symlink(struct inode *inode, const char *symname, int len, int nofs) fail:return err; } -EXPORT_SYMBOL (__page_symlink); - -int page_symlink (struct inode *inode,const char *symname,int len) -{ -return __page_symlink (inode, symname, len, - !mapping_gfp_constraint (inode->i_mapping, __GFP_FS)); -}EXPORT_SYMBOL (page_symlink);const struct inode_operations page_symlink_inode_operations = {
include/linux/fs.h +0 -2
@@ -3214,8 +3214,6 @@ extern int page_readlink(struct dentry *, char __user *, int);extern const char *page_get_link (struct dentry *,struct inode *,struct delayed_call *);extern void page_put_link (void *); -extern int __page_symlink (struct inode *inode,const char *symname,int len, -int nofs);extern int page_symlink (struct inode *inode,const char *symname,int len);extern const struct inode_operations page_symlink_inode_operations;extern void kfree_link (void *);
Signature · 1 line
2.34.1
Re: [PATCH 06/22] namei: Merge page_symlink() and __page_symlink()
Quoted 2 lines · Matthew Wilcox (Oracle)
There are no callers of
__page_symlink()left, so we can remove that entry point.
Looks good,
Re: [PATCH 06/22] namei: Merge page_symlink() and __page_symlink()
In reply to Matthew Wilcox (Oracle)Quoted 5 lines · Matthew Wilcox
There are no callers of
__page_symlink()left, so we can remove that entry point.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>---
Matthew Wilcox (Oracle)
maintainerPATCH 7/22 namei: Convert page_symlink() to use memalloc_nofs_save()
In reply to Matthew Wilcox (Oracle)Stop using AOP_FLAG_NOFS in favour of the scoped memory API.
--- fs/namei.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/namei.c +7 -4
@@ -22,6 +22,7 @@#include <linux/fs.h> #include <linux/namei.h> #include <linux/pagemap.h> +#include <linux/sched/mm.h> #include <linux/fsnotify.h> #include <linux/personality.h> #include <linux/security.h>
@@ -5010,13 +5011,15 @@ int page_symlink(struct inode *inode, const char *symname, int len)struct page *page;void *fsdata;int err; -unsigned int flags =0 ; -if (nofs) - flags |=AOP_FLAG_NOFS ; +unsigned int flags; retry: +if (nofs) + flags =memalloc_nofs_save (); err =pagecache_write_begin (NULL , mapping,0 , len-1 , - flags, &page, &fsdata); +0 , &page, &fsdata); +if (nofs) +memalloc_nofs_restore (flags);if (err) goto fail;
Signature · 1 line
2.34.1
Re: [PATCH 07/22] namei: Convert page_symlink() to use memalloc_nofs_save()
Quoted 1 line · Matthew Wilcox (Oracle)
Stop using
AOP_FLAG_NOFSin favour of the scoped memory API.
Looks good:
Matthew Wilcox (Oracle)
maintainerPATCH 8/22 f2fs: Convert f2fs_grab_cache_page() to use scoped memory APIs
In reply to Matthew Wilcox (Oracle)Prevent GFP_FS allocations by using memalloc_nofs_save() instead of AOP_FLAG_NOFS.
--- fs/f2fs/f2fs.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/f2fs/f2fs.h +8 -1
@@ -18,6 +18,7 @@#include <linux/kobject.h> #include <linux/sched.h> #include <linux/cred.h> +#include <linux/sched/mm.h> #include <linux/vmalloc.h> #include <linux/bio.h> #include <linux/blkdev.h>
@@ -2557,6 +2558,7 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping, pgoff_t index, bool for_write) {struct page *page; +unsigned int flags;if (IS_ENABLED (CONFIG_F2FS_FAULT_INJECTION )) {if (!for_write)
@@ -2576,7 +2578,12 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping,if (!for_write)return grab_cache_page (mapping, index); -return grab_cache_page_write_begin (mapping, index,AOP_FLAG_NOFS ); + + flags =memalloc_nofs_save (); + page =grab_cache_page_write_begin (mapping, index,0 ); +memalloc_nofs_restore (flags); + +return page; } static inline struct page *f2fs_pagecache_get_page(
Signature · 1 line
2.34.1
Re: [PATCH 08/22] f2fs: Convert f2fs_grab_cache_page() to use scoped memory APIs
Quoted 2 lines · Matthew Wilcox (Oracle)
Prevent
GFP_FSallocations by usingmemalloc_nofs_save()instead ofAOP_FLAG_NOFS.
Looks good:
Matthew Wilcox (Oracle)
maintainerPATCH 9/22 ext4: Allow GFP_FS allocations in ext4_da_convert_inline_data_to_extent()
In reply to Matthew Wilcox (Oracle)Since commit 8bc1379b82b8, the transaction is stopped before calling ext4_da_convert_inline_data_to_extent(), which means we can do GFP_FS allocations and recurse into the filesystem.
--- fs/ext4/inline.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/ext4/inline.c +1 -3
@@ -848,13 +848,12 @@ ext4_journalled_write_inline_data(struct inode *inode,*/ static int ext4_da_convert_inline_data_to_extent (struct address_space *mapping,struct inode *inode, -unsigned flags,void **fsdata) {int ret =0 , inline_size;struct page *page; - page =grab_cache_page_write_begin (mapping,0 , flags); + page =grab_cache_page_write_begin (mapping,0 ,0 );if (!page)return -ENOMEM ;
@@ -942,7 +941,6 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,ext4_journal_stop (handle); ret =ext4_da_convert_inline_data_to_extent (mapping, inode, - flags, fsdata);if (ret == -ENOSPC &&ext4_should_retry_alloc (inode->i_sb, &retries))
Signature · 1 line
2.34.1
Re: [PATCH 09/22] ext4: Allow GFP_FS allocations in ext4_da_convert_inline_data_to_extent()
Quoted 5 lines · Matthew Wilcox (Oracle)
Since commit
8bc1379b82b8, the transaction is stopped before callingext4_da_convert_inline_data_to_extent(), which means we can doGFP_FSallocations and recurse into the filesystem.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>
(Or would you prefer that I take these through the ext4 tree?)
- Ted
Matthew Wilcox (Oracle)
maintainerPATCH 10/22 ext4: Use scoped memory API in mext_page_double_lock()
In reply to Matthew Wilcox (Oracle)Replace use of AOP_FLAG_NOFS with calls to memalloc_nofs_save() and memalloc_nofs_restore().
--- fs/ext4/move_extent.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
fs/ext4/move_extent.c +9 -4
@@ -8,6 +8,7 @@#include <linux/fs.h> #include <linux/quotaops.h> #include <linux/slab.h> +#include <linux/sched/mm.h> #include "ext4_jbd2.h" #include "ext4.h" #include "ext4_extents.h"
@@ -127,7 +128,7 @@ mext_page_double_lock(struct inode *inode1, struct inode *inode2, pgoff_t index1, pgoff_t index2, struct page *page[2]) { struct address_space *mapping[2]; -unsigned fl =AOP_FLAG_NOFS ; +unsigned int flags;BUG_ON (!inode1 || !inode2);if (inode1 < inode2) {
@@ -139,11 +140,15 @@ mext_page_double_lock(struct inode *inode1, struct inode *inode2, mapping[1 ] = inode1->i_mapping; } - page[0 ] =grab_cache_page_write_begin (mapping[0 ], index1, fl); -if (!page[0 ]) + flags =memalloc_nofs_save (); + page[0 ] =grab_cache_page_write_begin (mapping[0 ], index1,0 ); +if (!page[0 ]) { +memalloc_nofs_restore (flags);return -ENOMEM ; + } - page[1 ] =grab_cache_page_write_begin (mapping[1 ], index2, fl); + page[1 ] =grab_cache_page_write_begin (mapping[1 ], index2,0 ); +memalloc_nofs_restore (flags);if (!page[1 ]) {unlock_page (page[0 ]);put_page (page[0 ]);
Signature · 1 line
2.34.1
Re: [PATCH 10/22] ext4: Use scoped memory API in mext_page_double_lock()
Quoted 4 lines · Matthew Wilcox (Oracle)
Replace use of
AOP_FLAG_NOFSwith calls tomemalloc_nofs_save()andmemalloc_nofs_restore().Signed-off-by Matthew Wilcox (Oracle) <[email protected]>
- Ted
Matthew Wilcox (Oracle)
maintainerPATCH 11/22 ext4: Use scoped memory APIs in ext4_da_write_begin()
In reply to Matthew Wilcox (Oracle)Instead of setting AOP_FLAG_NOFS, use memalloc_nofs_save() and memalloc_nofs_restore() to prevent GFP_FS allocations recursing into the filesystem with a journal already started.
--- fs/ext4/ext4.h | 1 - fs/ext4/inline.c | 16 ++++++++-------- fs/ext4/inode.c | 3 +-- 3 files changed, 9 insertions(+), 11 deletions(-)
fs/ext4/ext4.h +0 -1
@@ -3597,7 +3597,6 @@ ext4_journalled_write_inline_data(struct inode *inode,extern int ext4_da_write_inline_data_begin (struct address_space *mapping,struct inode *inode,loff_t pos,unsigned len, -unsigned flags,struct page **pagep,void **fsdata); extern int ext4_try_add_inline_entry(handle_t *handle,
fs/ext4/inline.c +8 -8
@@ -906,7 +906,6 @@ static int ext4_da_convert_inline_data_to_extent(struct address_space *mapping,int ext4_da_write_inline_data_begin (struct address_space *mapping,struct inode *inode,loff_t pos,unsigned len, -unsigned flags,struct page **pagep,void **fsdata) {
@@ -915,6 +914,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,struct page *page;struct ext4_iloc iloc;int retries =0 ; +unsigned int flags; ret =ext4_get_inode_loc (inode, &iloc);if (ret)
@@ -931,12 +931,6 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,if (ret && ret != -ENOSPC ) goto out_journal; -/* -* We cannot recurse into the filesystem as the transaction -* is already started. -*/ - flags |=AOP_FLAG_NOFS ; -if (ret == -ENOSPC ) {ext4_journal_stop (handle); ret = ext4_da_convert_inline_data_to_extent(mapping,
@@ -948,7 +942,13 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, goto out; } - page =grab_cache_page_write_begin (mapping,0 , flags); +/* +* We cannot recurse into the filesystem as the transaction +* is already started. +*/ + flags =memalloc_nofs_save (); + page =grab_cache_page_write_begin (mapping,0 ,0 ); +memalloc_nofs_restore (flags);if (!page) { ret = -ENOMEM ; goto out_journal;
fs/ext4/inode.c +1 -2
@@ -2929,8 +2929,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,trace_ext4_da_write_begin (inode, pos, len, flags);if (ext4_test_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA )) { - ret =ext4_da_write_inline_data_begin (mapping, inode, - pos, len, flags, + ret =ext4_da_write_inline_data_begin (mapping, inode, pos, len, pagep, fsdata);if (ret <0 )return ret;
Signature · 1 line
2.34.1
Re: [PATCH 11/22] ext4: Use scoped memory APIs in ext4_da_write_begin()
Quoted 5 lines · Matthew Wilcox (Oracle)
Instead of setting
AOP_FLAG_NOFS, usememalloc_nofs_save()andmemalloc_nofs_restore()to preventGFP_FSallocations recursing into the filesystem with a journal already started.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>
Matthew Wilcox (Oracle)
maintainerPATCH 12/22 ext4: Use scoped memory APIs in ext4_write_begin()
In reply to Matthew Wilcox (Oracle)Instead of setting AOP_FLAG_NOFS, use memalloc_nofs_save() and memalloc_nofs_restore() to prevent GFP_FS allocations recursing into the filesystem with a journal already started.
--- fs/ext4/ext4.h | 1 - fs/ext4/inline.c | 21 ++++++++++----------- fs/ext4/inode.c | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-)
fs/ext4/ext4.h +0 -1
@@ -3584,7 +3584,6 @@ extern int ext4_readpage_inline(struct inode *inode, struct page *page);extern int ext4_try_to_write_inline_data (struct address_space *mapping,struct inode *inode,loff_t pos,unsigned len, -unsigned flags,struct page **pagep); extern int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len,
fs/ext4/inline.c +10 -11
@@ -527,13 +527,13 @@ int ext4_readpage_inline(struct inode *inode, struct page *page) }static int ext4_convert_inline_data_to_extent (struct address_space *mapping, -struct inode *inode, -unsigned flags) +struct inode *inode) {int ret, needed_blocks, no_expand;handle_t *handle =NULL ;int retries =0 , sem_held =0 ;struct page *page =NULL ; +unsigned int flags;unsigned from, to;struct ext4_iloc iloc;
@@ -562,9 +562,9 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,/* We cannot recurse into the filesystem as the transaction is already * started */ - flags |=AOP_FLAG_NOFS ; - - page =grab_cache_page_write_begin (mapping,0 , flags); + flags =memalloc_nofs_save (); + page =grab_cache_page_write_begin (mapping,0 ,0 ); +memalloc_nofs_restore (flags);if (!page) { ret = -ENOMEM ; goto out;
@@ -649,11 +649,11 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,int ext4_try_to_write_inline_data (struct address_space *mapping,struct inode *inode,loff_t pos,unsigned len, -unsigned flags,struct page **pagep) {int ret;handle_t *handle; +unsigned int flags;struct page *page;struct ext4_iloc iloc;
@@ -691,9 +691,9 @@ int ext4_try_to_write_inline_data(struct address_space *mapping,if (ret) goto out; - flags |=AOP_FLAG_NOFS ; - - page =grab_cache_page_write_begin (mapping,0 , flags); + flags =memalloc_nofs_save (); + page =grab_cache_page_write_begin (mapping,0 ,0 ); +memalloc_nofs_restore (flags);if (!page) { ret = -ENOMEM ; goto out;
@@ -727,8 +727,7 @@ int ext4_try_to_write_inline_data(struct address_space *mapping,brelse (iloc.bh);return ret; convert: -return ext4_convert_inline_data_to_extent (mapping, - inode, flags); +return ext4_convert_inline_data_to_extent (mapping, inode); } int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len,
fs/ext4/inode.c +1 -1
@@ -1156,7 +1156,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,if (ext4_test_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA )) { ret =ext4_try_to_write_inline_data (mapping, inode, pos, len, - flags, pagep); + pagep);if (ret <0 )return ret;if (ret ==1 )
Signature · 1 line
2.34.1
Re: [PATCH 12/22] ext4: Use scoped memory APIs in ext4_write_begin()
Quoted 5 lines · Matthew Wilcox (Oracle)
Instead of setting
AOP_FLAG_NOFS, usememalloc_nofs_save()andmemalloc_nofs_restore()to preventGFP_FSallocations recursing into the filesystem with a journal already started.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>
Matthew Wilcox (Oracle)
maintainerPATCH 13/22 fs: Remove AOP_FLAG_NOFS
In reply to Matthew Wilcox (Oracle)With all users of this flag gone, we can stop testing whether it's set.
--- fs/ceph/addr.c | 2 -- fs/netfs/read_helper.c | 2 -- include/linux/fs.h | 4 ---- mm/folio-compat.c | 2 -- 4 files changed, 10 deletions(-)
fs/ceph/addr.c +0 -2
@@ -1288,8 +1288,6 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping,*/ if (ci->i_inline_version !=CEPH_INLINE_NONE ) {unsigned int fgp_flags =FGP_LOCK |FGP_WRITE |FGP_CREAT |FGP_STABLE ; -if (aop_flags &AOP_FLAG_NOFS ) - fgp_flags |=FGP_NOFS ; folio =__filemap_get_folio (mapping, index, fgp_flags,mapping_gfp_mask (mapping));if (!folio)
fs/netfs/read_helper.c +0 -2
@@ -1090,8 +1090,6 @@ int netfs_write_begin(struct file *file, struct address_space *mapping, retry: fgp_flags =FGP_LOCK |FGP_WRITE |FGP_CREAT |FGP_STABLE ; -if (aop_flags &AOP_FLAG_NOFS ) - fgp_flags |=FGP_NOFS ; folio =__filemap_get_folio (mapping, index, fgp_flags,mapping_gfp_mask (mapping));if (!folio)
include/linux/fs.h +0 -4
@@ -274,10 +274,6 @@ enum positive_aop_returns { AOP_TRUNCATED_PAGE = 0x80001, }; -#define AOP_FLAG_NOFS 0x0002/* used by filesystem to direct -* helper code (eg buffer layer) -* to clear GFP_FS from alloc */ -/* * oh the beauties of C type declarations. */
mm/folio-compat.c +0 -2
@@ -134,8 +134,6 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping, {unsigned fgp_flags =FGP_LOCK |FGP_WRITE |FGP_CREAT |FGP_STABLE ; -if (flags &AOP_FLAG_NOFS ) - fgp_flags |=FGP_NOFS ;return pagecache_get_page (mapping, index, fgp_flags,mapping_gfp_mask (mapping)); }
Signature · 1 line
2.34.1
Re: [PATCH 13/22] fs: Remove AOP_FLAG_NOFS
Quoted 1 line · Matthew Wilcox (Oracle)
With all users of this flag gone, we can stop testing whether it's set.
Looks good:
Matthew Wilcox (Oracle)
maintainerPATCH 14/22 fs: Remove aop flags argument from pagecache_write_begin()
In reply to Matthew Wilcox (Oracle)With no more AOP_FLAG definitions left, remove this parameter.
--- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 6 ++---- fs/buffer.c | 6 +++--- fs/ext4/verity.c | 2 +- fs/f2fs/verity.c | 2 +- fs/hfs/extent.c | 2 +- fs/hfsplus/extents.c | 2 +- fs/namei.c | 3 +-- fs/ntfs3/file.c | 2 +- include/linux/pagemap.h | 4 ++-- 9 files changed, 13 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_shmem.c +2 -4
@@ -448,8 +448,7 @@ shmem_pwrite(struct drm_i915_gem_object *obj,return err; err =pagecache_write_begin (obj->base.filp, mapping, - offset, len,0 , - &page, &data); + offset, len, &page, &data);if (err <0 )return err;
@@ -622,8 +621,7 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *dev_priv,void *pgdata, *vaddr; err =pagecache_write_begin (file, file->f_mapping, - offset, len,0 , - &page, &pgdata); + offset, len, &page, &pgdata);if (err <0 ) goto fail;
fs/buffer.c +3 -3
@@ -2352,7 +2352,7 @@ int generic_cont_expand_simple(struct inode *inode, loff_t size)if (err) goto out; - err =pagecache_write_begin (NULL , mapping, size,0 ,0 , &page, &fsdata); + err =pagecache_write_begin (NULL , mapping, size,0 , &page, &fsdata);if (err) goto out;
@@ -2387,7 +2387,7 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping, } len =PAGE_SIZE - zerofrom; - err =pagecache_write_begin (file, mapping, curpos, len,0 , + err =pagecache_write_begin (file, mapping, curpos, len, &page, &fsdata);if (err) goto out;
@@ -2420,7 +2420,7 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping, } len = offset - zerofrom; - err =pagecache_write_begin (file, mapping, curpos, len,0 , + err =pagecache_write_begin (file, mapping, curpos, len, &page, &fsdata);if (err) goto out;
fs/ext4/verity.c +1 -1
@@ -79,7 +79,7 @@ static int pagecache_write(struct inode *inode, const void *buf, size_t count,void *fsdata;int res; - res =pagecache_write_begin (NULL , inode->i_mapping, pos, n,0 , + res =pagecache_write_begin (NULL , inode->i_mapping, pos, n, &page, &fsdata);if (res)return res;
fs/f2fs/verity.c +1 -1
@@ -85,7 +85,7 @@ static int pagecache_write(struct inode *inode, const void *buf, size_t count,void *addr;int res; - res =pagecache_write_begin (NULL , inode->i_mapping, pos, n,0 , + res =pagecache_write_begin (NULL , inode->i_mapping, pos, n, &page, &fsdata);if (res)return res;
fs/hfs/extent.c +1 -1
@@ -491,7 +491,7 @@ void hfs_file_truncate(struct inode *inode)/* XXX: Can use generic_cont_expand? */ size = inode->i_size -1 ; - res =pagecache_write_begin (NULL , mapping, size+1 ,0 ,0 , + res =pagecache_write_begin (NULL , mapping, size+1 ,0 , &page, &fsdata);if (!res) { res = pagecache_write_end(NULL, mapping, size+1, 0, 0,
fs/hfsplus/extents.c +1 -1
@@ -557,7 +557,7 @@ void hfsplus_file_truncate(struct inode *inode)void *fsdata;loff_t size = inode->i_size; - res =pagecache_write_begin (NULL , mapping, size,0 ,0 , + res =pagecache_write_begin (NULL , mapping, size,0 , &page, &fsdata);if (res)return ;
fs/namei.c +1 -2
@@ -5016,8 +5016,7 @@ int page_symlink(struct inode *inode, const char *symname, int len) retry:if (nofs) flags =memalloc_nofs_save (); - err =pagecache_write_begin (NULL , mapping,0 , len-1 , -0 , &page, &fsdata); + err =pagecache_write_begin (NULL , mapping,0 , len -1 , &page, &fsdata);if (nofs)memalloc_nofs_restore (flags);if (err)
fs/ntfs3/file.c +1 -1
@@ -157,7 +157,7 @@ static int ntfs_extend_initialized_size(struct file *file,if (pos + len > new_valid) len = new_valid - pos; - err =pagecache_write_begin (file, mapping, pos, len,0 , &page, + err =pagecache_write_begin (file, mapping, pos, len, &page, &fsdata);if (err) goto out;
include/linux/pagemap.h +2 -2
@@ -535,9 +535,9 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping,*/ static inline int pagecache_write_begin (struct file *file,struct address_space *mapping,loff_t pos,unsigned len, -unsigned flags,struct page **pagep,void **fsdata) +struct page **pagep,void **fsdata) { -return mapping->a_ops->write_begin (file, mapping, pos, len, flags, +return mapping->a_ops->write_begin (file, mapping, pos, len,0 , pagep, fsdata); }
Signature · 1 line
2.34.1
Re: [PATCH 14/22] fs: Remove aop flags argument from pagecache_write_begin()
Looks good:
Matthew Wilcox (Oracle)
maintainerPATCH 15/22 fs: Remove aop_flags parameter from netfs_write_begin()
In reply to Matthew Wilcox (Oracle)There are no more aop flags left, so remove the parameter.
--- Documentation/filesystems/netfs_library.rst | 1 - fs/9p/vfs_addr.c | 2 +- fs/afs/write.c | 2 +- fs/ceph/addr.c | 2 +- fs/netfs/read_helper.c | 6 ++---- include/linux/netfs.h | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-)
Documentation/filesystems/netfs_library.rst +0 -1
@@ -81,7 +81,6 @@ Three read helpers are provided:: struct address_space *mapping, loff_t pos, unsigned int len, - unsigned int flags, struct folio **_folio, void **_fsdata, const struct netfs_read_request_ops *ops,
fs/9p/vfs_addr.c +1 -1
@@ -308,7 +308,7 @@ static int v9fs_write_begin(struct file *filp, struct address_space *mapping,* file. We need to do this before we get a lock on the page in case * there's more than one writer competing for the same cache block. */ - retval =netfs_write_begin (filp, mapping, pos, len, flags, &folio, fsdata, + retval =netfs_write_begin (filp, mapping, pos, len, &folio, fsdata, &v9fs_req_ops,NULL );if (retval <0 )return retval;
fs/afs/write.c +1 -1
@@ -60,7 +60,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping,* file. We need to do this before we get a lock on the page in case * there's more than one writer competing for the same cache block. */ - ret =netfs_write_begin (file, mapping, pos, len, flags, &folio, fsdata, + ret =netfs_write_begin (file, mapping, pos, len, &folio, fsdata, &afs_req_ops,NULL );if (ret <0 )return ret;
fs/ceph/addr.c +1 -1
@@ -1311,7 +1311,7 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping, goto out; } - r =netfs_write_begin (file, inode->i_mapping, pos, len,0 , &folio,NULL , + r =netfs_write_begin (file, inode->i_mapping, pos, len, &folio,NULL , &ceph_netfs_read_ops,NULL ); out:if (r ==0 )
fs/netfs/read_helper.c +2 -4
@@ -1048,7 +1048,6 @@ static bool netfs_skip_folio_read(struct folio *folio, loff_t pos, size_t len)* @mapping: The mapping to read from * @pos: File position at which the write will begin * @len: The length of the write (may extend beyond the end of the folio chosen) -* @aop_flags: AOP_* flags * @_folio: Where to put the resultant folio * @_fsdata: Place for the netfs to store a cookie * @ops: The network filesystem's operations for the helper to use
@@ -1074,9 +1073,8 @@ static bool netfs_skip_folio_read(struct folio *folio, loff_t pos, size_t len)* This is usable whether or not caching is enabled. */ int netfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned int len,unsigned int aop_flags, -struct folio **_folio,void **_fsdata, -const struct netfs_read_request_ops *ops, +loff_t pos,unsigned int len,struct folio **_folio, +void **_fsdata,const struct netfs_read_request_ops *ops,void *netfs_priv) {struct netfs_read_request *rreq;
include/linux/netfs.h +1 -1
@@ -262,7 +262,7 @@ extern int netfs_readpage(struct file *, const struct netfs_read_request_ops *, void *);extern int netfs_write_begin (struct file *,struct address_space *, -loff_t ,unsigned int ,unsigned int ,struct folio **, +loff_t ,unsigned int ,struct folio **,void **,const struct netfs_read_request_ops *,void *);
Signature · 1 line
2.34.1
Re: [PATCH 15/22] fs: Remove aop_flags parameter from netfs_write_begin()
Looks good:
Matthew Wilcox (Oracle)
maintainerPATCH 16/22 fs: Remove aop flags parameter from block_write_begin()
In reply to Matthew Wilcox (Oracle)There are no more aop flags left, so remove the parameter.
--- block/fops.c | 3 +-- fs/bfs/file.c | 3 +-- fs/buffer.c | 6 +++--- fs/ext2/inode.c | 3 +-- fs/minix/inode.c | 3 +-- fs/nilfs2/inode.c | 3 +-- fs/nilfs2/recovery.c | 2 +- fs/ntfs3/inode.c | 4 ++-- fs/omfs/file.c | 3 +-- fs/sysv/itree.c | 2 +- fs/udf/inode.c | 2 +- fs/ufs/inode.c | 3 +-- include/linux/buffer_head.h | 2 +- 13 files changed, 16 insertions(+), 23 deletions(-)
block/fops.c +1 -2
@@ -405,8 +405,7 @@ static int blkdev_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata) { - return block_write_begin(mapping, pos, len, flags, pagep, -blkdev_get_block ); + return block_write_begin(mapping, pos, len, pagep, blkdev_get_block); } static int blkdev_write_end(struct file *file, struct address_space *mapping,
fs/bfs/file.c +1 -2
@@ -174,8 +174,7 @@ static int bfs_write_begin(struct file *file, struct address_space *mapping, {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, - bfs_get_block); + ret =block_write_begin (mapping, pos, len, pagep, bfs_get_block);if (unlikely (ret))bfs_write_failed (mapping, pos + len);
fs/buffer.c +3 -3
@@ -2104,13 +2104,13 @@ static int __block_commit_write(struct inode *inode, struct page *page,* The filesystem needs to handle block truncation upon failure. */ int block_write_begin (struct address_space *mapping,loff_t pos,unsigned len, -unsigned flags,struct page **pagep,get_block_t *get_block) +struct page **pagep,get_block_t *get_block) {pgoff_t index = pos >>PAGE_SHIFT ;struct page *page;int status; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index,0 );if (!page)return -ENOMEM ;
@@ -2460,7 +2460,7 @@ int cont_write_begin(struct file *file, struct address_space *mapping, (*bytes)++; } -return block_write_begin (mapping, pos, len, flags, pagep, get_block); +return block_write_begin (mapping, pos, len, pagep, get_block); }EXPORT_SYMBOL (cont_write_begin);
fs/ext2/inode.c +1 -2
@@ -892,8 +892,7 @@ ext2_write_begin(struct file *file, struct address_space *mapping, {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, - ext2_get_block); + ret =block_write_begin (mapping, pos, len, pagep, ext2_get_block);if (ret <0 )ext2_write_failed (mapping, pos + len);return ret;
fs/minix/inode.c +1 -2
@@ -428,8 +428,7 @@ static int minix_write_begin(struct file *file, struct address_space *mapping, {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, - minix_get_block); + ret =block_write_begin (mapping, pos, len, pagep, minix_get_block);if (unlikely (ret))minix_write_failed (mapping, pos + len);
fs/nilfs2/inode.c +1 -2
@@ -255,8 +255,7 @@ static int nilfs_write_begin(struct file *file, struct address_space *mapping,if (unlikely (err))return err; - err =block_write_begin (mapping, pos, len, flags, pagep, - nilfs_get_block); + err =block_write_begin (mapping, pos, len, pagep, nilfs_get_block);if (unlikely (err)) {nilfs_write_failed (mapping, pos + len);nilfs_transaction_abort (inode->i_sb);
fs/nilfs2/recovery.c +1 -1
@@ -511,7 +511,7 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs, pos = rb->blkoff << inode->i_blkbits; err =block_write_begin (inode->i_mapping, pos, blocksize, -0 , &page, nilfs_get_block); + &page, nilfs_get_block);if (unlikely (err)) {loff_t isize = inode->i_size;
fs/ntfs3/inode.c +2 -2
@@ -894,7 +894,7 @@ static int ntfs_write_begin(struct file *file, struct address_space *mapping, goto out; } - err =block_write_begin (mapping, pos, len, flags, pagep, + err =block_write_begin (mapping, pos, len, pagep, ntfs_get_block_write_begin); out:
@@ -975,7 +975,7 @@ int reset_log_file(struct inode *inode) len = pos +PAGE_SIZE > log_size ? (log_size - pos) :PAGE_SIZE ; - err =block_write_begin (mapping, pos, len,0 , &page, + err =block_write_begin (mapping, pos, len, &page, ntfs_get_block_write_begin);if (err) goto out;
fs/omfs/file.c +1 -2
@@ -321,8 +321,7 @@ static int omfs_write_begin(struct file *file, struct address_space *mapping, {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, - omfs_get_block); + ret =block_write_begin (mapping, pos, len, pagep, omfs_get_block);if (unlikely (ret))omfs_write_failed (mapping, pos + len);
fs/sysv/itree.c +1 -1
@@ -482,7 +482,7 @@ static int sysv_write_begin(struct file *file, struct address_space *mapping, {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, get_block); + ret =block_write_begin (mapping, pos, len, pagep, get_block);if (unlikely (ret))sysv_write_failed (mapping, pos + len);
fs/udf/inode.c +1 -1
@@ -209,7 +209,7 @@ static int udf_write_begin(struct file *file, struct address_space *mapping, {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, udf_get_block); + ret =block_write_begin (mapping, pos, len, pagep, udf_get_block);if (unlikely (ret))udf_write_failed (mapping, pos + len);return ret;
fs/ufs/inode.c +1 -2
@@ -500,8 +500,7 @@ static int ufs_write_begin(struct file *file, struct address_space *mapping, {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, - ufs_getfrag_block); + ret =block_write_begin (mapping, pos, len, pagep, ufs_getfrag_block);if (unlikely (ret))ufs_write_failed (mapping, pos + len);
include/linux/buffer_head.h +1 -1
@@ -226,7 +226,7 @@ int __block_write_full_page(struct inode *inode, struct page *page,int block_read_full_page (struct page *,get_block_t *);bool block_is_partially_uptodate (struct folio *,size_t from,size_t count);int block_write_begin (struct address_space *mapping,loff_t pos,unsigned len, -unsigned flags,struct page **pagep,get_block_t *get_block); +struct page **pagep,get_block_t *get_block);int __block_write_begin (struct page *page,loff_t pos,unsigned len,get_block_t *get_block); int block_write_end(struct file *, struct address_space *,
Signature · 1 line
2.34.1
Re: [PATCH 16/22] fs: Remove aop flags parameter from block_write_begin()
Quoted 1 line · Matthew Wilcox (Oracle)
There are no more aop flags left, so remove the parameter.
Looks good,
Matthew Wilcox (Oracle)
maintainerPATCH 17/22 fs: Remove aop flags parameter from cont_write_begin()
In reply to Matthew Wilcox (Oracle)There are no more aop flags left, so remove the parameter.
--- fs/adfs/inode.c | 2 +- fs/affs/file.c | 2 +- fs/buffer.c | 2 +- fs/exfat/inode.c | 2 +- fs/fat/inode.c | 2 +- fs/hfs/inode.c | 2 +- fs/hfsplus/inode.c | 2 +- fs/hpfs/file.c | 2 +- include/linux/buffer_head.h | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-)
fs/adfs/inode.c +1 -1
@@ -58,7 +58,7 @@ static int adfs_write_begin(struct file *file, struct address_space *mapping,int ret; *pagep =NULL ; - ret =cont_write_begin (file, mapping, pos, len, flags, pagep, fsdata, + ret =cont_write_begin (file, mapping, pos, len, pagep, fsdata, adfs_get_block, &ADFS_I (mapping->host)->mmu_private);if (unlikely (ret))
fs/affs/file.c +1 -1
@@ -420,7 +420,7 @@ static int affs_write_begin(struct file *file, struct address_space *mapping,int ret; *pagep =NULL ; - ret =cont_write_begin (file, mapping, pos, len, flags, pagep, fsdata, + ret =cont_write_begin (file, mapping, pos, len, pagep, fsdata, affs_get_block, &AFFS_I (mapping->host)->mmu_private);if (unlikely (ret))
fs/buffer.c +1 -1
@@ -2441,7 +2441,7 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,* We may have to extend the file. */ int cont_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata,get_block_t *get_block,loff_t *bytes) {
fs/exfat/inode.c +1 -1
@@ -395,7 +395,7 @@ static int exfat_write_begin(struct file *file, struct address_space *mapping,int ret; *pagep =NULL ; - ret =cont_write_begin (file, mapping, pos, len, flags, pagep, fsdata, + ret =cont_write_begin (file, mapping, pos, len, pagep, fsdata, exfat_get_block, &EXFAT_I (mapping->host)->i_size_ondisk);
fs/fat/inode.c +1 -1
@@ -232,7 +232,7 @@ static int fat_write_begin(struct file *file, struct address_space *mapping,int err; *pagep =NULL ; - err =cont_write_begin (file, mapping, pos, len, flags, + err =cont_write_begin (file, mapping, pos, len, pagep, fsdata, fat_get_block, &MSDOS_I (mapping->host)->mmu_private);if (err <0 )
fs/hfs/inode.c +1 -1
@@ -56,7 +56,7 @@ static int hfs_write_begin(struct file *file, struct address_space *mapping,int ret; *pagep =NULL ; - ret =cont_write_begin (file, mapping, pos, len, flags, pagep, fsdata, + ret =cont_write_begin (file, mapping, pos, len, pagep, fsdata, hfs_get_block, &HFS_I (mapping->host)->phys_size);if (unlikely (ret))
fs/hfsplus/inode.c +1 -1
@@ -50,7 +50,7 @@ static int hfsplus_write_begin(struct file *file, struct address_space *mapping,int ret; *pagep =NULL ; - ret =cont_write_begin (file, mapping, pos, len, flags, pagep, fsdata, + ret =cont_write_begin (file, mapping, pos, len, pagep, fsdata, hfsplus_get_block, &HFSPLUS_I (mapping->host)->phys_size);if (unlikely (ret))
fs/hpfs/file.c +1 -1
@@ -200,7 +200,7 @@ static int hpfs_write_begin(struct file *file, struct address_space *mapping,int ret; *pagep =NULL ; - ret =cont_write_begin (file, mapping, pos, len, flags, pagep, fsdata, + ret =cont_write_begin (file, mapping, pos, len, pagep, fsdata, hpfs_get_block, &hpfs_i (mapping->host)->mmu_private);if (unlikely (ret))
include/linux/buffer_head.h +1 -1
@@ -238,7 +238,7 @@ int generic_write_end(struct file *, struct address_space *,void page_zero_new_buffers (struct page *page,unsigned from,unsigned to);void clean_page_buffers (struct page *page);int cont_write_begin (struct file *,struct address_space *,loff_t , -unsigned ,unsigned ,struct page **,void **, +unsigned ,struct page **,void **,get_block_t *,loff_t *);int generic_cont_expand_simple (struct inode *inode,loff_t size);int block_commit_write (struct page *page,unsigned from,unsigned to);
Signature · 1 line
2.34.1
Re: [PATCH 17/22] fs: Remove aop flags parameter from cont_write_begin()
Quoted 1 line · Matthew Wilcox (Oracle)
There are no more aop flags left, so remove the parameter.
Looks good,
Matthew Wilcox (Oracle)
maintainerPATCH 18/22 fs: Remove aop flags parameter from grab_cache_page_write_begin()
In reply to Matthew Wilcox (Oracle)There are no more aop flags left, so remove the parameter.
--- fs/affs/file.c | 2 +- fs/buffer.c | 4 ++-- fs/cifs/file.c | 2 +- fs/ecryptfs/mmap.c | 2 +- fs/ext4/inline.c | 8 ++++---- fs/ext4/inode.c | 4 ++-- fs/ext4/move_extent.c | 4 ++-- fs/f2fs/f2fs.h | 2 +- fs/fuse/file.c | 4 ++-- fs/hostfs/hostfs_kern.c | 2 +- fs/jffs2/file.c | 2 +- fs/libfs.c | 2 +- fs/nfs/file.c | 2 +- fs/ntfs3/inode.c | 2 +- fs/orangefs/inode.c | 2 +- fs/reiserfs/inode.c | 2 +- fs/ubifs/file.c | 4 ++-- fs/udf/file.c | 2 +- include/linux/pagemap.h | 2 +- mm/folio-compat.c | 2 +- 20 files changed, 28 insertions(+), 28 deletions(-)
fs/affs/file.c +1 -1
@@ -670,7 +670,7 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping } index = pos >>PAGE_SHIFT ; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ; *pagep = page;
fs/buffer.c +2 -2
@@ -2110,7 +2110,7 @@ int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,struct page *page;int status; - page =grab_cache_page_write_begin (mapping, index,0 ); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ;
@@ -2591,7 +2591,7 @@ int nobh_write_begin(struct address_space *mapping, from = pos & (PAGE_SIZE -1 ); to = from + len; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ; *pagep = page;
fs/cifs/file.c +1 -1
@@ -4679,7 +4679,7 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,cifs_dbg (FYI ,"write_begin from %lld len %d\n" , (long long )pos, len); start: - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page) { rc = -ENOMEM ; goto out;
fs/ecryptfs/mmap.c +1 -1
@@ -272,7 +272,7 @@ static int ecryptfs_write_begin(struct file *file,loff_t prev_page_end_size;int rc =0 ; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ; *pagep = page;
fs/ext4/inline.c +4 -4
@@ -563,7 +563,7 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,/* We cannot recurse into the filesystem as the transaction is already * started */ flags =memalloc_nofs_save (); - page =grab_cache_page_write_begin (mapping,0 ,0 ); + page =grab_cache_page_write_begin (mapping,0 );memalloc_nofs_restore (flags);if (!page) { ret = -ENOMEM ;
@@ -692,7 +692,7 @@ int ext4_try_to_write_inline_data(struct address_space *mapping, goto out; flags =memalloc_nofs_save (); - page =grab_cache_page_write_begin (mapping,0 ,0 ); + page =grab_cache_page_write_begin (mapping,0 );memalloc_nofs_restore (flags);if (!page) { ret = -ENOMEM ;
@@ -852,7 +852,7 @@ static int ext4_da_convert_inline_data_to_extent(struct address_space *mapping,int ret =0 , inline_size;struct page *page; - page =grab_cache_page_write_begin (mapping,0 ,0 ); + page =grab_cache_page_write_begin (mapping,0 );if (!page)return -ENOMEM ;
@@ -946,7 +946,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,* is already started. */ flags =memalloc_nofs_save (); - page =grab_cache_page_write_begin (mapping,0 ,0 ); + page =grab_cache_page_write_begin (mapping,0 );memalloc_nofs_restore (flags);if (!page) { ret = -ENOMEM ;
fs/ext4/inode.c +2 -2
@@ -1171,7 +1171,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,* the page (if needed) without using GFP_NOFS. */ retry_grab: - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ;unlock_page (page);
@@ -2938,7 +2938,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping, } retry: - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ;
fs/ext4/move_extent.c +2 -2
@@ -141,13 +141,13 @@ mext_page_double_lock(struct inode *inode1, struct inode *inode2, } flags =memalloc_nofs_save (); - page[0 ] =grab_cache_page_write_begin (mapping[0 ], index1,0 ); + page[0 ] =grab_cache_page_write_begin (mapping[0 ], index1);if (!page[0 ]) {memalloc_nofs_restore (flags);return -ENOMEM ; } - page[1 ] =grab_cache_page_write_begin (mapping[1 ], index2,0 ); + page[1 ] =grab_cache_page_write_begin (mapping[1 ], index2);memalloc_nofs_restore (flags);if (!page[1 ]) {unlock_page (page[0 ]);
fs/f2fs/f2fs.h +1 -1
@@ -2580,7 +2580,7 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping,return grab_cache_page (mapping, index); flags =memalloc_nofs_save (); - page =grab_cache_page_write_begin (mapping, index,0 ); + page =grab_cache_page_write_begin (mapping, index);memalloc_nofs_restore (flags);return page;
fs/fuse/file.c +2 -2
@@ -1166,7 +1166,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia,break ; err = -ENOMEM ; - page =grab_cache_page_write_begin (mapping, index,0 ); + page =grab_cache_page_write_begin (mapping, index);if (!page)break ;
@@ -2266,7 +2266,7 @@ static int fuse_write_begin(struct file *file, struct address_space *mapping,WARN_ON (!fc->writeback_cache); - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page) goto error;
fs/hostfs/hostfs_kern.c +1 -1
@@ -468,7 +468,7 @@ static int hostfs_write_begin(struct file *file, struct address_space *mapping, {pgoff_t index = pos >>PAGE_SHIFT ; - *pagep =grab_cache_page_write_begin (mapping, index, flags); + *pagep =grab_cache_page_write_begin (mapping, index);if (!*pagep)return -ENOMEM ;return 0 ;
fs/jffs2/file.c +1 -1
@@ -213,7 +213,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,* page in read_cache_page(), which causes a deadlock. */ mutex_lock (&c->alloc_sem); - pg =grab_cache_page_write_begin (mapping, index, flags); + pg =grab_cache_page_write_begin (mapping, index);if (!pg) { ret = -ENOMEM ; goto release_sem;
fs/libfs.c +1 -1
@@ -557,7 +557,7 @@ int simple_write_begin(struct file *file, struct address_space *mapping, index = pos >>PAGE_SHIFT ; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ;
fs/nfs/file.c +1 -1
@@ -330,7 +330,7 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping, file, mapping->host->i_ino, len, (long long) pos); start: - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ; *pagep = page;
fs/ntfs3/inode.c +1 -1
@@ -872,7 +872,7 @@ static int ntfs_write_begin(struct file *file, struct address_space *mapping, *pagep =NULL ;if (is_resident (ni)) {struct page *page =grab_cache_page_write_begin ( - mapping, pos >>PAGE_SHIFT , flags); + mapping, pos >>PAGE_SHIFT );if (!page) { err = -ENOMEM ;
fs/orangefs/inode.c +1 -1
@@ -338,7 +338,7 @@ static int orangefs_write_begin(struct file *file, index = pos >>PAGE_SHIFT ; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ;
fs/reiserfs/inode.c +1 -1
@@ -2764,7 +2764,7 @@ static int reiserfs_write_begin(struct file *file, inode = mapping->host; index = pos >>PAGE_SHIFT ; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ; *pagep = page;
fs/ubifs/file.c +2 -2
@@ -244,7 +244,7 @@ static int write_begin_slow(struct address_space *mapping,if (unlikely (err))return err; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (unlikely (!page)) {ubifs_release_budget (c, &req);return -ENOMEM ;
@@ -437,7 +437,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,return -EROFS ;/* Try out the fast-path part first */ - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (unlikely (!page))return -ENOMEM ;
fs/udf/file.c +1 -1
@@ -94,7 +94,7 @@ static int udf_adinicb_write_begin(struct file *file,if (WARN_ON_ONCE (pos >=PAGE_SIZE ))return -EIO ; - page =grab_cache_page_write_begin (mapping,0 , flags); + page =grab_cache_page_write_begin (mapping,0 );if (!page)return -ENOMEM ; *pagep = page;
include/linux/pagemap.h +1 -1
@@ -653,7 +653,7 @@ static inline unsigned find_get_pages_tag(struct address_space *mapping, }struct page *grab_cache_page_write_begin (struct address_space *mapping, -pgoff_t index,unsigned flags); +pgoff_t index);/* * Returns locked page at given index in given cache, creating it if needed.
mm/folio-compat.c +1 -1
@@ -130,7 +130,7 @@ struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,EXPORT_SYMBOL (pagecache_get_page);struct page *grab_cache_page_write_begin (struct address_space *mapping, -pgoff_t index,unsigned flags) +pgoff_t index) {unsigned fgp_flags =FGP_LOCK |FGP_WRITE |FGP_CREAT |FGP_STABLE ;
Signature · 1 line
2.34.1
Re: [PATCH 18/22] fs: Remove aop flags parameter from grab_cache_page_write_begin()
Quoted 1 line · Matthew Wilcox (Oracle)
There are no more aop flags left, so remove the parameter.
Looks good,
Matthew Wilcox (Oracle)
maintainerPATCH 19/22 affs: Use pagecache_write_begin() & pagecache_write_end()
In reply to Matthew Wilcox (Oracle)Use the convenience wrappers instead of invoking ->write_begin and ->write_end directly.
--- fs/affs/file.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/affs/file.c +4 -2
@@ -887,9 +887,11 @@ affs_truncate(struct inode *inode)loff_t isize = inode->i_size;int res; - res = mapping->a_ops->write_begin (NULL , mapping, isize,0 ,0 , &page, &fsdata); + res =pagecache_write_begin (NULL , mapping, isize,0 , &page, + &fsdata);if (!res) - res = mapping->a_ops->write_end (NULL , mapping, isize,0 ,0 , page, fsdata); + res =pagecache_write_end (NULL , mapping, isize,0 ,0 , + page, fsdata);else inode->i_size =AFFS_I (inode)->mmu_private;mark_inode_dirty (inode);
Signature · 1 line
2.34.1
Re: [PATCH 19/22] affs: Use pagecache_write_begin() & pagecache_write_end()
Quoted 2 lines · Matthew Wilcox (Oracle)
Use the convenience wrappers instead of invoking ->write_begin and ->write_end directly.
I'd much rather call the actual implementation used by affs directly. Same for the following patch.
Matthew Wilcox (Oracle)
maintainerPATCH 20/22 f2fs: Use pagecache_write_begin() & pagecache_write_end()
In reply to Matthew Wilcox (Oracle)Use the convenience wrappers instead of invoking ->write_begin and ->write_end directly.
--- fs/f2fs/super.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/f2fs/super.c +2 -3
@@ -2487,7 +2487,6 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type, {struct inode *inode =sb_dqopt (sb)->files[type];struct address_space *mapping = inode->i_mapping; -const struct address_space_operations *a_ops = mapping->a_ops;int offset = off & (sb->s_blocksize -1 );size_t towrite = len;struct page *page;
@@ -2500,7 +2499,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type, tocopy = min_t(unsigned long, sb->s_blocksize - offset, towrite); retry: - err = a_ops->write_begin (NULL , mapping, off, tocopy,0 , + err =pagecache_write_begin (NULL , mapping, off, tocopy, &page, &fsdata);if (unlikely (err)) {if (err == -ENOMEM ) {
@@ -2517,7 +2516,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,kunmap_atomic (kaddr);flush_dcache_page (page); - a_ops->write_end (NULL , mapping, off, tocopy, tocopy, +pagecache_write_end (NULL , mapping, off, tocopy, tocopy, page, fsdata); offset =0 ; towrite -= tocopy;
Signature · 1 line
2.34.1
Matthew Wilcox (Oracle)
maintainerPATCH 21/22 fs: Remove aop flags parameter from nobh_write_begin()
In reply to Matthew Wilcox (Oracle)There are no more aop flags left, so remove the parameter.
--- fs/buffer.c | 3 +-- fs/ext2/inode.c | 2 +- fs/jfs/inode.c | 3 +-- include/linux/buffer_head.h | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-)
fs/buffer.c +1 -2
@@ -2568,8 +2568,7 @@ static void attach_nobh_buffers(struct page *page, struct buffer_head *head)* On exit the page is fully uptodate in the areas outside (from,to) * The filesystem needs to handle block truncation upon failure. */ -int nobh_write_begin (struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +int nobh_write_begin (struct address_space *mapping,loff_t pos,unsigned len,struct page **pagep,void **fsdata,get_block_t *get_block) {
fs/ext2/inode.c +1 -1
@@ -917,7 +917,7 @@ ext2_nobh_write_begin(struct file *file, struct address_space *mapping, {int ret; - ret =nobh_write_begin (mapping, pos, len, flags, pagep, fsdata, + ret =nobh_write_begin (mapping, pos, len, pagep, fsdata, ext2_get_block);if (ret <0 )ext2_write_failed (mapping, pos + len);
fs/jfs/inode.c +1 -2
@@ -318,8 +318,7 @@ static int jfs_write_begin(struct file *file, struct address_space *mapping, {int ret; - ret =nobh_write_begin (mapping, pos, len, flags, pagep, fsdata, - jfs_get_block); + ret =nobh_write_begin (mapping, pos, len, pagep, fsdata, jfs_get_block);if (unlikely (ret))jfs_write_failed (mapping, pos + len);
include/linux/buffer_head.h +1 -1
@@ -258,7 +258,7 @@ static inline vm_fault_t block_page_mkwrite_return(int err) }sector_t generic_block_bmap (struct address_space *,sector_t ,get_block_t *);int block_truncate_page (struct address_space *,loff_t ,get_block_t *); -int nobh_write_begin (struct address_space *,loff_t ,unsigned ,unsigned , +int nobh_write_begin (struct address_space *,loff_t ,unsigned len,struct page **,void **,get_block_t *); int nobh_write_end(struct file *, struct address_space *, loff_t, unsigned, unsigned,
Signature · 1 line
2.34.1
Re: [PATCH 21/22] fs: Remove aop flags parameter from nobh_write_begin()
Looks good,
Matthew Wilcox (Oracle)
maintainerPATCH 22/22 fs: Remove flags parameter from aops->write_begin
In reply to Matthew Wilcox (Oracle)There are no more aop flags left, so remove the parameter.
--- Documentation/filesystems/locking.rst | 2 +- Documentation/filesystems/vfs.rst | 5 +---- block/fops.c | 3 +-- fs/9p/vfs_addr.c | 2 +- fs/adfs/inode.c | 2 +- fs/affs/file.c | 4 ++-- fs/afs/internal.h | 2 +- fs/afs/write.c | 2 +- fs/bfs/file.c | 2 +- fs/ceph/addr.c | 2 +- fs/cifs/file.c | 2 +- fs/ecryptfs/mmap.c | 2 +- fs/exfat/inode.c | 2 +- fs/ext2/inode.c | 6 ++---- fs/ext4/inode.c | 10 +++++----- fs/f2fs/data.c | 5 ++--- fs/fat/inode.c | 2 +- fs/fuse/file.c | 3 +-- fs/hfs/inode.c | 2 +- fs/hfsplus/inode.c | 2 +- fs/hostfs/hostfs_kern.c | 2 +- fs/hpfs/file.c | 2 +- fs/hugetlbfs/inode.c | 2 +- fs/jffs2/file.c | 4 ++-- fs/jfs/inode.c | 2 +- fs/libfs.c | 2 +- fs/minix/inode.c | 2 +- fs/nfs/file.c | 2 +- fs/nilfs2/inode.c | 2 +- fs/ntfs3/inode.c | 2 +- fs/ocfs2/aops.c | 2 +- fs/omfs/file.c | 2 +- fs/orangefs/inode.c | 5 ++--- fs/reiserfs/inode.c | 2 +- fs/sysv/itree.c | 2 +- fs/ubifs/file.c | 7 +++---- fs/udf/file.c | 2 +- fs/udf/inode.c | 2 +- fs/ufs/inode.c | 2 +- include/linux/fs.h | 4 ++-- include/linux/pagemap.h | 2 +- include/trace/events/ext4.h | 21 ++++++++------------- include/trace/events/f2fs.h | 12 ++++-------- mm/filemap.c | 3 +-- mm/shmem.c | 2 +- 45 files changed, 67 insertions(+), 87 deletions(-)
Documentation/filesystems/locking.rst +1 -1
@@ -244,7 +244,7 @@ prototypes:: int (*readpages)(struct file *filp, struct address_space *mapping, struct list_head *pages, unsigned nr_pages); int (*write_begin)(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata); int (*write_end)(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied,
Documentation/filesystems/vfs.rst +1 -4
@@ -729,7 +729,7 @@ cache in your filesystem. The following members are defined: int (*readpages)(struct file *filp, struct address_space *mapping, struct list_head *pages, unsigned nr_pages); int (*write_begin)(struct file *, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata); int (*write_end)(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied,
@@ -839,9 +839,6 @@ cache in your filesystem. The following members are defined: passed to write_begin is greater than the number of bytes copied into the page). - flags is a field for AOP_FLAG_xxx flags, described in - include/linux/fs.h. - A void * may be returned in fsdata, which then gets passed into write_end.
block/fops.c +1 -2
@@ -402,8 +402,7 @@ static void blkdev_readahead(struct readahead_control *rac) }static int blkdev_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags,struct page **pagep, -void **fsdata) +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {return block_write_begin (mapping, pos, len, pagep, blkdev_get_block); }
fs/9p/vfs_addr.c +1 -1
@@ -293,7 +293,7 @@ v9fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) }static int v9fs_write_begin (struct file *filp,struct address_space *mapping, -loff_t pos,unsigned int len,unsigned int flags, +loff_t pos,unsigned int len,struct page **subpagep,void **fsdata) {int retval;
fs/adfs/inode.c +1 -1
@@ -52,7 +52,7 @@ static void adfs_write_failed(struct address_space *mapping, loff_t to) }static int adfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/affs/file.c +2 -2
@@ -414,7 +414,7 @@ affs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) }static int affs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
@@ -650,7 +650,7 @@ affs_readpage_ofs(struct file *file, struct page *page) }static int affs_write_begin_ofs (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode = mapping->host;
fs/afs/internal.h +1 -1
@@ -1526,7 +1526,7 @@ bool afs_dirty_folio(struct address_space *, struct folio *);#define afs_dirty_folio filemap_dirty_folio#endif extern int afs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata); extern int afs_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied,
fs/afs/write.c +1 -1
@@ -42,7 +42,7 @@ static void afs_folio_start_fscache(bool caching, struct folio *folio)* prepare to perform part of a write to a page */ int afs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **_page,void **fsdata) {struct afs_vnode *vnode =AFS_FS_I (file_inode (file));
fs/bfs/file.c +1 -1
@@ -169,7 +169,7 @@ static void bfs_write_failed(struct address_space *mapping, loff_t to) }static int bfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/ceph/addr.c +1 -1
@@ -1273,7 +1273,7 @@ static int ceph_netfs_check_write_begin(struct file *file, loff_t pos, unsigned* clean, or already dirty within the same snap context. */ static int ceph_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned aop_flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode =file_inode (file);
fs/cifs/file.c +1 -1
@@ -4665,7 +4665,7 @@ bool is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) }static int cifs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int oncethru =0 ;
fs/ecryptfs/mmap.c +1 -1
@@ -264,7 +264,7 @@ static int fill_zeros_to_end_of_page(struct page *page, unsigned int to)*/ static int ecryptfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {pgoff_t index = pos >>PAGE_SHIFT ;
fs/exfat/inode.c +1 -1
@@ -389,7 +389,7 @@ static void exfat_write_failed(struct address_space *mapping, loff_t to) }static int exfat_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned int len,unsigned int flags, +loff_t pos,unsigned int len,struct page **pagep,void **fsdata) {int ret;
fs/ext2/inode.c +2 -4
@@ -887,8 +887,7 @@ static void ext2_readahead(struct readahead_control *rac)static int ext2_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, -struct page **pagep,void **fsdata) +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
@@ -912,8 +911,7 @@ static int ext2_write_end(struct file *file, struct address_space *mapping,static int ext2_nobh_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, -struct page **pagep,void **fsdata) +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/ext4/inode.c +5 -5
@@ -1130,7 +1130,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,#endif static int ext4_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode = mapping->host;
@@ -1144,7 +1144,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,if (unlikely (ext4_forced_shutdown (EXT4_SB (inode->i_sb))))return -EIO ; -trace_ext4_write_begin (inode, pos, len, flags); +trace_ext4_write_begin (inode, pos, len);/* * Reserve one block more for addition to orphan list in case * we allocate blocks but write fails for some reason
@@ -2906,7 +2906,7 @@ static int ext4_nonda_switch(struct super_block *sb) }static int ext4_da_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret, retries =0 ;
@@ -2923,10 +2923,10 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping, ext4_verity_in_progress(inode)) { *fsdata = (void *)FALL_BACK_TO_NONDELALLOC ;return ext4_write_begin (file, mapping, pos, - len, flags, pagep, fsdata); + len, pagep, fsdata); } *fsdata = (void *)0 ; -trace_ext4_da_write_begin (inode, pos, len, flags); +trace_ext4_da_write_begin (inode, pos, len);if (ext4_test_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA )) { ret = ext4_da_write_inline_data_begin(mapping, inode, pos, len,
fs/f2fs/data.c +2 -3
@@ -3310,8 +3310,7 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi, }static int f2fs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, -struct page **pagep,void **fsdata) +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode = mapping->host;struct f2fs_sb_info *sbi =F2FS_I_SB (inode);
@@ -3321,7 +3320,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,block_t blkaddr =NULL_ADDR ;int err =0 ; -trace_f2fs_write_begin (inode, pos, len, flags); +trace_f2fs_write_begin (inode, pos, len);if (!f2fs_is_checkpoint_ready (sbi)) { err = -ENOSPC ;
fs/fat/inode.c +1 -1
@@ -226,7 +226,7 @@ static void fat_write_failed(struct address_space *mapping, loff_t to) }static int fat_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int err;
fs/fuse/file.c +1 -2
@@ -2255,8 +2255,7 @@ static int fuse_writepages(struct address_space *mapping,* but how to implement it without killing performance need more thinking. */ static int fuse_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, -struct page **pagep,void **fsdata) +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {pgoff_t index = pos >>PAGE_SHIFT ;struct fuse_conn *fc =get_fuse_conn (file_inode (file));
fs/hfs/inode.c +1 -1
@@ -50,7 +50,7 @@ static void hfs_write_failed(struct address_space *mapping, loff_t to) }static int hfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/hfsplus/inode.c +1 -1
@@ -44,7 +44,7 @@ static void hfsplus_write_failed(struct address_space *mapping, loff_t to) }static int hfsplus_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/hostfs/hostfs_kern.c +1 -1
@@ -463,7 +463,7 @@ static int hostfs_readpage(struct file *file, struct page *page) }static int hostfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {pgoff_t index = pos >>PAGE_SHIFT ;
fs/hpfs/file.c +1 -1
@@ -194,7 +194,7 @@ static void hpfs_write_failed(struct address_space *mapping, loff_t to) }static int hpfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/hugetlbfs/inode.c +1 -1
@@ -382,7 +382,7 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to)static int hugetlbfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {return -EINVAL ;
fs/jffs2/file.c +2 -2
@@ -25,7 +25,7 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *pg, void *fsdata);static int jffs2_write_begin (struct file *filp,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata);static int jffs2_readpage (struct file *filp,struct page *pg);
@@ -130,7 +130,7 @@ static int jffs2_readpage (struct file *filp, struct page *pg) }static int jffs2_write_begin (struct file *filp,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct page *pg;
fs/jfs/inode.c +1 -1
@@ -313,7 +313,7 @@ static void jfs_write_failed(struct address_space *mapping, loff_t to) }static int jfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/libfs.c +1 -1
@@ -549,7 +549,7 @@ static int simple_readpage(struct file *file, struct page *page) }int simple_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct page *page;
fs/minix/inode.c +1 -1
@@ -423,7 +423,7 @@ static void minix_write_failed(struct address_space *mapping, loff_t to) }static int minix_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/nfs/file.c +1 -1
@@ -318,7 +318,7 @@ static bool nfs_want_read_modify_write(struct file *file, struct page *page,* increment the page use counts until he is done with the page. */ static int nfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/nilfs2/inode.c +1 -1
@@ -245,7 +245,7 @@ void nilfs_write_failed(struct address_space *mapping, loff_t to) }static int nilfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {
fs/ntfs3/inode.c +1 -1
@@ -862,7 +862,7 @@ static int ntfs_get_block_write_begin(struct inode *inode, sector_t vbn, }static int ntfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,u32 len,u32 flags,struct page **pagep, +loff_t pos,u32 len,struct page **pagep,void **fsdata) {int err;
fs/ocfs2/aops.c +1 -1
@@ -1881,7 +1881,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, }static int ocfs2_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/omfs/file.c +1 -1
@@ -316,7 +316,7 @@ static void omfs_write_failed(struct address_space *mapping, loff_t to) }static int omfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/orangefs/inode.c +2 -3
@@ -326,9 +326,8 @@ static int orangefs_readpage(struct file *file, struct page *page) }static int orangefs_write_begin (struct file *file, -struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags,struct page **pagep, -void **fsdata) +struct address_space *mapping,loff_t pos,unsigned len, +struct page **pagep,void **fsdata) {struct orangefs_write_range *wr;struct folio *folio;
fs/reiserfs/inode.c +1 -1
@@ -2753,7 +2753,7 @@ static void reiserfs_truncate_failed_write(struct inode *inode)static int reiserfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode;
fs/sysv/itree.c +1 -1
@@ -477,7 +477,7 @@ static void sysv_write_failed(struct address_space *mapping, loff_t to) }static int sysv_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/ubifs/file.c +3 -4
@@ -215,8 +215,7 @@ static void release_existing_page_budget(struct ubifs_info *c) }static int write_begin_slow (struct address_space *mapping, -loff_t pos,unsigned len,struct page **pagep, -unsigned flags) +loff_t pos,unsigned len,struct page **pagep) {struct inode *inode = mapping->host;struct ubifs_info *c = inode->i_sb->s_fs_info;
@@ -419,7 +418,7 @@ static int allocate_budget(struct ubifs_info *c, struct page *page,* without forcing write-back. The slow path does not make this assumption. */ static int ubifs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode = mapping->host;
@@ -493,7 +492,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,unlock_page (page);put_page (page); -return write_begin_slow (mapping, pos, len, pagep, flags); +return write_begin_slow (mapping, pos, len, pagep); }/*
fs/udf/file.c +1 -1
@@ -87,7 +87,7 @@ static int udf_adinicb_writepage(struct page *page,static int udf_adinicb_write_begin (struct file *file,struct address_space *mapping,loff_t pos, -unsigned len,unsigned flags,struct page **pagep, +unsigned len,struct page **pagep,void **fsdata) {struct page *page;
fs/udf/inode.c +1 -1
@@ -204,7 +204,7 @@ static void udf_readahead(struct readahead_control *rac) }static int udf_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/ufs/inode.c +1 -1
@@ -495,7 +495,7 @@ static void ufs_write_failed(struct address_space *mapping, loff_t to) }static int ufs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
include/linux/fs.h +2 -2
@@ -352,7 +352,7 @@ struct address_space_operations {void (*readahead)(struct readahead_control *);int (*write_begin)(struct file *,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata); int (*write_end)(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied,
@@ -3284,7 +3284,7 @@ extern int noop_fsync(struct file *, loff_t, loff_t, int);extern ssize_t noop_direct_IO (struct kiocb *iocb,struct iov_iter *iter);extern int simple_empty (struct dentry *);extern int simple_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata);extern const struct address_space_operations ram_aops;extern int always_delete_dentry (const struct dentry *);
include/linux/pagemap.h +1 -1
@@ -537,7 +537,7 @@ static inline int pagecache_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, struct page **pagep, void **fsdata) { - return mapping->a_ops->write_begin(file, mapping, pos, len, 0, + return mapping->a_ops->write_begin(file, mapping, pos, len,pagep ,fsdata ); }
include/trace/events/ext4.h +8 -13
@@ -324,17 +324,15 @@ TRACE_EVENT(ext4_begin_ordered_truncate, DECLARE_EVENT_CLASS(ext4__write_begin, - TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, - unsigned int flags), + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), - TP_ARGS(inode, pos, len, flags), + TP_ARGS(inode, pos, len), TP_STRUCT__entry( __field( dev_t, dev ) __field( ino_t, ino ) __field( loff_t, pos ) __field( unsigned int, len ) - __field( unsigned int, flags ) ), TP_fast_assign(
@@ -342,29 +340,26 @@ DECLARE_EVENT_CLASS(ext4__write_begin, __entry->ino = inode->i_ino; __entry->pos = pos; __entry->len = len; - __entry->flags = flags; ), -TP_printk ("dev %d,%d ino %lu pos %lld len %u flags %u" , +TP_printk ("dev %d,%d ino %lu pos %lld len %u" ,MAJOR (__entry->dev),MINOR (__entry->dev), (unsigned long ) __entry->ino, - __entry->pos, __entry->len, __entry->flags) + __entry->pos, __entry->len) );DEFINE_EVENT (ext4__write_begin, ext4_write_begin, - TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, - unsigned int flags), + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), -TP_ARGS (inode, pos, len, flags) +TP_ARGS (inode, pos, len) );DEFINE_EVENT (ext4__write_begin, ext4_da_write_begin, - TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, - unsigned int flags), + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), -TP_ARGS (inode, pos, len, flags) +TP_ARGS (inode, pos, len) ); DECLARE_EVENT_CLASS(ext4__write_end,
include/trace/events/f2fs.h +4 -8
@@ -1160,17 +1160,15 @@ DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_write_bio, TRACE_EVENT(f2fs_write_begin, - TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, - unsigned int flags), + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), - TP_ARGS(inode, pos, len, flags), + TP_ARGS(inode, pos, len), TP_STRUCT__entry( __field(dev_t, dev) __field(ino_t, ino) __field(loff_t, pos) __field(unsigned int, len) - __field(unsigned int, flags) ), TP_fast_assign(
@@ -1178,14 +1176,12 @@ TRACE_EVENT(f2fs_write_begin, __entry->ino = inode->i_ino; __entry->pos = pos; __entry->len = len; - __entry->flags = flags; ), -TP_printk ("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u" , +TP_printk ("dev = (%d,%d), ino = %lu, pos = %llu, len = %u" ,show_dev_ino (__entry), (unsigned long long )__entry->pos, - __entry->len, - __entry->flags) + __entry->len) ); TRACE_EVENT(f2fs_write_end,
mm/filemap.c +1 -2
@@ -3712,7 +3712,6 @@ ssize_t generic_perform_write(struct kiocb *iocb, struct iov_iter *i)const struct address_space_operations *a_ops = mapping->a_ops;long status =0 ;ssize_t written =0 ; -unsigned int flags =0 ; do { struct page *page;
@@ -3742,7 +3741,7 @@ ssize_t generic_perform_write(struct kiocb *iocb, struct iov_iter *i)break ; } - status = a_ops->write_begin (file, mapping, pos, bytes, flags, + status = a_ops->write_begin (file, mapping, pos, bytes, &page, &fsdata);if (unlikely (status <0 ))break ;
mm/shmem.c +1 -1
@@ -2417,7 +2417,7 @@ static int shmem_initxattrs(struct inode *, const struct xattr *, void *);static int shmem_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode = mapping->host;
Signature · 1 line
2.34.1
Re: [PATCH 22/22] fs: Remove flags parameter from aops->write_begin
Looks good,
Quoted 2 lines · Matthew Wilcox (Oracle)
Thanks to Edward, we can now remove all the
AOP_FLAGuses in the kernel and remove the flags parameter from allwrite_beginimplementations.
I just did a quick pass over the patches, all looks pretty straight forwards and obvious with the exception of the reiserfs patch...
Signature · 2 lines
Dave Chinner [email protected]