All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/22] Remove aop flags
@ 2022-02-22 19:47 Matthew Wilcox (Oracle)
  2022-02-22 19:47 ` [PATCH 01/22] fs: Pass an iocb to generic_perform_write() Matthew Wilcox (Oracle)
                   ` (22 more replies)
  0 siblings, 23 replies; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:47 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

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(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH 01/22] fs: Pass an iocb to generic_perform_write()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
@ 2022-02-22 19:47 ` Matthew Wilcox (Oracle)
  2022-02-23  6:51   ` Christoph Hellwig
  2022-02-23  8:47   ` Christian Brauner
  2022-02-22 19:48 ` [PATCH 02/22] fs: Move pagecache_write_begin() and pagecache_write_end() Matthew Wilcox (Oracle)
                   ` (21 subsequent siblings)
  22 siblings, 2 replies; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:47 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

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) <willy@infradead.org>
---
 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(-)

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index bbed3224ad68..a22eb492bbba 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -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);
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 8cc11715518a..894565626179 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -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:
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 3c98ef6af97d..067e0eefae9b 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -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) {
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index b747e3d4c354..68ec0c9579d9 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -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);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 1c0660ff9ff0..394570a970af 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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);
diff --git a/mm/filemap.c b/mm/filemap.c
index bb4e91bf5492..c2bef068afab 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -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;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 02/22] fs: Move pagecache_write_begin() and pagecache_write_end()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
  2022-02-22 19:47 ` [PATCH 01/22] fs: Pass an iocb to generic_perform_write() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:53   ` Christoph Hellwig
  2022-02-23  8:47   ` Christian Brauner
  2022-02-22 19:48 ` [PATCH 03/22] reiserfs: Stop using AOP_FLAG_CONT_EXPAND flag Matthew Wilcox (Oracle)
                   ` (20 subsequent siblings)
  22 siblings, 2 replies; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: 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.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/fs.h      | 12 ------------
 include/linux/pagemap.h | 20 ++++++++++++++++++++
 mm/filemap.c            | 21 ---------------------
 3 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 394570a970af..2843f789a6db 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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.
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 9cd504542c31..76b0ddfef5ba 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -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)
 
 /**
diff --git a/mm/filemap.c b/mm/filemap.c
index c2bef068afab..9e3ccc2e54ee 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -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.
  */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 03/22] reiserfs: Stop using AOP_FLAG_CONT_EXPAND flag
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
  2022-02-22 19:47 ` [PATCH 01/22] fs: Pass an iocb to generic_perform_write() Matthew Wilcox (Oracle)
  2022-02-22 19:48 ` [PATCH 02/22] fs: Move pagecache_write_begin() and pagecache_write_end() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:54   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 04/22] filemap: Remove AOP_FLAG_CONT_EXPAND Matthew Wilcox (Oracle)
                   ` (19 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Edward Shishkin, Matthew Wilcox

From: Edward Shishkin <edward.shishkin@gmail.com>

We can simplify write_begin() and write_end() by handling the
cont_expand case in reiserfs_setattr().

Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/reiserfs/inode.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index e4221fa85ea2..36c59b25486c 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 04/22] filemap: Remove AOP_FLAG_CONT_EXPAND
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (2 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 03/22] reiserfs: Stop using AOP_FLAG_CONT_EXPAND flag Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:54   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 05/22] ext4: Use page_symlink() instead of __page_symlink() Matthew Wilcox (Oracle)
                   ` (18 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

This flag is no longer used, so remove it.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/buffer.c        | 3 +--
 include/linux/fs.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 28b9739b719b..c33e681fdeba 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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;
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2843f789a6db..10ba90e22b4b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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 */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 05/22] ext4: Use page_symlink() instead of __page_symlink()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (3 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 04/22] filemap: Remove AOP_FLAG_CONT_EXPAND Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:54   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 06/22] namei: Merge page_symlink() and __page_symlink() Matthew Wilcox (Oracle)
                   ` (17 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: 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.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/ext4/namei.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 8cf0a924a49b..52799e1d579f 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -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;
 		/*
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 06/22] namei: Merge page_symlink() and __page_symlink()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (4 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 05/22] ext4: Use page_symlink() instead of __page_symlink() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:55   ` Christoph Hellwig
  2022-02-23  8:48   ` Christian Brauner
  2022-02-22 19:48 ` [PATCH 07/22] namei: Convert page_symlink() to use memalloc_nofs_save() Matthew Wilcox (Oracle)
                   ` (16 subsequent siblings)
  22 siblings, 2 replies; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

There are no callers of __page_symlink() left, so we can remove that
entry point.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 Documentation/filesystems/porting.rst |  2 +-
 fs/namei.c                            | 13 ++-----------
 include/linux/fs.h                    |  2 --
 3 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/Documentation/filesystems/porting.rst b/Documentation/filesystems/porting.rst
index bf19fd6b86e7..0d847532f767 100644
--- a/Documentation/filesystems/porting.rst
+++ b/Documentation/filesystems/porting.rst
@@ -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.
 
diff --git a/fs/namei.c b/fs/namei.c
index 3f1829b3ab5b..8335dad105b4 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -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 = {
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 10ba90e22b4b..4db0893750aa 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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 *);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 07/22] namei: Convert page_symlink() to use memalloc_nofs_save()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (5 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 06/22] namei: Merge page_symlink() and __page_symlink() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:56   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 08/22] f2fs: Convert f2fs_grab_cache_page() to use scoped memory APIs Matthew Wilcox (Oracle)
                   ` (15 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

Stop using AOP_FLAG_NOFS in favour of the scoped memory API.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/namei.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 8335dad105b4..4f5c07d5579f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -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;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 08/22] f2fs: Convert f2fs_grab_cache_page() to use scoped memory APIs
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (6 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 07/22] namei: Convert page_symlink() to use memalloc_nofs_save() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:57   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 09/22] ext4: Allow GFP_FS allocations in ext4_da_convert_inline_data_to_extent() Matthew Wilcox (Oracle)
                   ` (14 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

Prevent GFP_FS allocations by using memalloc_nofs_save() instead
of AOP_FLAG_NOFS.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/f2fs/f2fs.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 51ba0f8ffd86..324553da3bdd 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -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(
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 09/22] ext4: Allow GFP_FS allocations in ext4_da_convert_inline_data_to_extent()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (7 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 08/22] f2fs: Convert f2fs_grab_cache_page() to use scoped memory APIs Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-03-08 17:12   ` Theodore Ts'o
  2022-02-22 19:48 ` [PATCH 10/22] ext4: Use scoped memory API in mext_page_double_lock() Matthew Wilcox (Oracle)
                   ` (13 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: 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.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/ext4/inline.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index e42941803605..7865fe136b66 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -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))
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 10/22] ext4: Use scoped memory API in mext_page_double_lock()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (8 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 09/22] ext4: Allow GFP_FS allocations in ext4_da_convert_inline_data_to_extent() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-03-08 17:13   ` Theodore Ts'o
  2022-02-22 19:48 ` [PATCH 11/22] ext4: Use scoped memory APIs in ext4_da_write_begin() Matthew Wilcox (Oracle)
                   ` (12 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

Replace use of AOP_FLAG_NOFS with calls to memalloc_nofs_save()
and memalloc_nofs_restore().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/ext4/move_extent.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index 95aa212f0863..56f21272fb00 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -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]);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 11/22] ext4: Use scoped memory APIs in ext4_da_write_begin()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (9 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 10/22] ext4: Use scoped memory API in mext_page_double_lock() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-03-08 17:13   ` Theodore Ts'o
  2022-02-22 19:48 ` [PATCH 12/22] ext4: Use scoped memory APIs in ext4_write_begin() Matthew Wilcox (Oracle)
                   ` (11 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: 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.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/ext4/ext4.h   |  1 -
 fs/ext4/inline.c | 16 ++++++++--------
 fs/ext4/inode.c  |  3 +--
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index bcd3b9bf8069..d291a0d47993 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -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,
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 7865fe136b66..f9eeb36bc9f6 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -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;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 436efd31cc27..bffcdefb0ffa 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 12/22] ext4: Use scoped memory APIs in ext4_write_begin()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (10 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 11/22] ext4: Use scoped memory APIs in ext4_da_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-03-08 15:55   ` Theodore Ts'o
  2022-02-22 19:48 ` [PATCH 13/22] fs: Remove AOP_FLAG_NOFS Matthew Wilcox (Oracle)
                   ` (10 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: 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.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/ext4/ext4.h   |  1 -
 fs/ext4/inline.c | 21 ++++++++++-----------
 fs/ext4/inode.c  |  2 +-
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index d291a0d47993..fe06d4aace09 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -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,
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index f9eeb36bc9f6..eae94228a143 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -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,
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index bffcdefb0ffa..c203183859c9 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -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)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 13/22] fs: Remove AOP_FLAG_NOFS
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (11 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 12/22] ext4: Use scoped memory APIs in ext4_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:57   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 14/22] fs: Remove aop flags argument from pagecache_write_begin() Matthew Wilcox (Oracle)
                   ` (9 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

With all users of this flag gone, we can stop testing whether it's set.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 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(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index f40c34f4f526..3a2b98efebf5 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -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)
diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c
index 501da990c259..de0dfb37746b 100644
--- a/fs/netfs/read_helper.c
+++ b/fs/netfs/read_helper.c
@@ -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)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4db0893750aa..bdbf5dcdb272 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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.
  */
diff --git a/mm/folio-compat.c b/mm/folio-compat.c
index 749555a232a8..540c4949e9a1 100644
--- a/mm/folio-compat.c
+++ b/mm/folio-compat.c
@@ -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));
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 14/22] fs: Remove aop flags argument from pagecache_write_begin()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (12 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 13/22] fs: Remove AOP_FLAG_NOFS Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:57   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 15/22] fs: Remove aop_flags parameter from netfs_write_begin() Matthew Wilcox (Oracle)
                   ` (8 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

With no more AOP_FLAG definitions left, remove this parameter.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 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(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
index cc9fe258fba7..5a27b0225850 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
@@ -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;
 
diff --git a/fs/buffer.c b/fs/buffer.c
index c33e681fdeba..440979592c05 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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;
diff --git a/fs/ext4/verity.c b/fs/ext4/verity.c
index eacbd489e3bf..ed7bcf699348 100644
--- a/fs/ext4/verity.c
+++ b/fs/ext4/verity.c
@@ -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;
diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c
index fe5acdccaae1..e38fef7652ee 100644
--- a/fs/f2fs/verity.c
+++ b/fs/f2fs/verity.c
@@ -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;
diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c
index 263d5028d9d1..7ac7c74255be 100644
--- a/fs/hfs/extent.c
+++ b/fs/hfs/extent.c
@@ -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,
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index 7054a542689f..6b37dbec9f0b 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -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;
diff --git a/fs/namei.c b/fs/namei.c
index 4f5c07d5579f..48498737ee5c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -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)
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 787b53b984ee..516efea57bfc 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -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;
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 76b0ddfef5ba..2e0a82a01564 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -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);
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 15/22] fs: Remove aop_flags parameter from netfs_write_begin()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (13 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 14/22] fs: Remove aop flags argument from pagecache_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:57   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 16/22] fs: Remove aop flags parameter from block_write_begin() Matthew Wilcox (Oracle)
                   ` (7 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

There are no more aop flags left, so remove the parameter.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 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(-)

diff --git a/Documentation/filesystems/netfs_library.rst b/Documentation/filesystems/netfs_library.rst
index 4f373a8ec47b..9e0390c9e679 100644
--- a/Documentation/filesystems/netfs_library.rst
+++ b/Documentation/filesystems/netfs_library.rst
@@ -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,
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 76956c9d2af9..0eece6974a3f 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -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;
diff --git a/fs/afs/write.c b/fs/afs/write.c
index 88861613734e..986e97866e16 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -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;
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 3a2b98efebf5..09f27d1d7fec 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -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)
diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c
index de0dfb37746b..439e83dc2a02 100644
--- a/fs/netfs/read_helper.c
+++ b/fs/netfs/read_helper.c
@@ -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;
diff --git a/include/linux/netfs.h b/include/linux/netfs.h
index 614f22213e21..8e10aef2565d 100644
--- a/include/linux/netfs.h
+++ b/include/linux/netfs.h
@@ -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 *);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 16/22] fs: Remove aop flags parameter from block_write_begin()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (14 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 15/22] fs: Remove aop_flags parameter from netfs_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:58   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 17/22] fs: Remove aop flags parameter from cont_write_begin() Matthew Wilcox (Oracle)
                   ` (6 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

There are no more aop flags left, so remove the parameter.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 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(-)

diff --git a/block/fops.c b/block/fops.c
index 796a78fd1583..6a2c84555dbb 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -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,
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index 03139344568f..9408f45225cb 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -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);
 
diff --git a/fs/buffer.c b/fs/buffer.c
index 440979592c05..b5b83e5159bf 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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);
 
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 52377a0ee735..97192932ea56 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -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;
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 1e41fba68dcf..2fac50b3a334 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -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);
 
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index c1219c0678a5..96f5d8334621 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -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);
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
index 9e2ed76c0f25..0955b657938f 100644
--- a/fs/nilfs2/recovery.c
+++ b/fs/nilfs2/recovery.c
@@ -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;
 
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 9eab11e3b034..3914138fd8ba 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -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;
diff --git a/fs/omfs/file.c b/fs/omfs/file.c
index 3f297b541713..349b96d89c44 100644
--- a/fs/omfs/file.c
+++ b/fs/omfs/file.c
@@ -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);
 
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index 409ab5e17803..96b7fd4facf3 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -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);
 
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index ca4fa710e562..88a95886ce8a 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -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;
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index d0dda01620f0..bd0e0c66f93d 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -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);
 
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index bcb4fe9b8575..63e49dfa7738 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -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 *,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 17/22] fs: Remove aop flags parameter from cont_write_begin()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (15 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 16/22] fs: Remove aop flags parameter from block_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:59   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 18/22] fs: Remove aop flags parameter from grab_cache_page_write_begin() Matthew Wilcox (Oracle)
                   ` (5 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

There are no more aop flags left, so remove the parameter.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 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(-)

diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index 561bc748c04a..b6912496bb19 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -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))
diff --git a/fs/affs/file.c b/fs/affs/file.c
index b3f81d84ff4c..704911d6aeba 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -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))
diff --git a/fs/buffer.c b/fs/buffer.c
index b5b83e5159bf..115a1184a0bf 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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)
 {
diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
index fc0ea1684880..8ed3c4b700cd 100644
--- a/fs/exfat/inode.c
+++ b/fs/exfat/inode.c
@@ -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);
 
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 86957dd07bda..3d76e535e709 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -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)
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 55f45e9b4930..396735dd3407 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -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))
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 446a816aa8e1..435b6202532a 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -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))
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
index 99493a23c5d0..8740b4ea0b52 100644
--- a/fs/hpfs/file.c
+++ b/fs/hpfs/file.c
@@ -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))
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 63e49dfa7738..127b60fad77e 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 18/22] fs: Remove aop flags parameter from grab_cache_page_write_begin()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (16 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 17/22] fs: Remove aop flags parameter from cont_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  6:59   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 19/22] affs: Use pagecache_write_begin() & pagecache_write_end() Matthew Wilcox (Oracle)
                   ` (4 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

There are no more aop flags left, so remove the parameter.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 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(-)

diff --git a/fs/affs/file.c b/fs/affs/file.c
index 704911d6aeba..06645d05c717 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -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;
diff --git a/fs/buffer.c b/fs/buffer.c
index 115a1184a0bf..2b3518d57bcc 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 8a2e9025bdb3..3816c7f1bc98 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -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;
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 9ad61b582f07..84e399a921ad 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -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;
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index eae94228a143..4d04e0af00a7 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -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;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index c203183859c9..11e3c2d6bcd2 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -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;
 
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index 56f21272fb00..4172a7d22471 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -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]);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 324553da3bdd..68bf0978b0a6 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -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;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 48062c2506bd..968941d41162 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -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;
 
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 27f4c2eb1705..7075a29a7c0c 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -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;
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index bd7d58d27bfc..142d3ba9f0a8 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -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;
diff --git a/fs/libfs.c b/fs/libfs.c
index e64bdedef168..d4395e1c6696 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -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;
 
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 68ec0c9579d9..12bf12da7657 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -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;
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 3914138fd8ba..16466c8648f3 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -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;
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 79c1025d18ea..809690db8be2 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -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;
 
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 36c59b25486c..aa31cf1dbba6 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -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;
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 8a9ffc2d4167..191490fdf91b 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -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;
 
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 0f6bf2504437..724bb3141fda 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -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;
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 2e0a82a01564..e7d9cf94e0f0 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -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.
diff --git a/mm/folio-compat.c b/mm/folio-compat.c
index 540c4949e9a1..599e4743d79f 100644
--- a/mm/folio-compat.c
+++ b/mm/folio-compat.c
@@ -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;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 19/22] affs: Use pagecache_write_begin() & pagecache_write_end()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (17 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 18/22] fs: Remove aop flags parameter from grab_cache_page_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  7:05   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 20/22] f2fs: " Matthew Wilcox (Oracle)
                   ` (3 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

Use the convenience wrappers instead of invoking ->write_begin and
->write_end directly.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/affs/file.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/affs/file.c b/fs/affs/file.c
index 06645d05c717..1c18f13e8aa1 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 20/22] f2fs: Use pagecache_write_begin() & pagecache_write_end()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (18 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 19/22] affs: Use pagecache_write_begin() & pagecache_write_end() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-22 19:48 ` [PATCH 21/22] fs: Remove aop flags parameter from nobh_write_begin() Matthew Wilcox (Oracle)
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

Use the convenience wrappers instead of invoking ->write_begin and
->write_end directly.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/f2fs/super.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index baefd398ec1a..fe4adf761f81 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 21/22] fs: Remove aop flags parameter from nobh_write_begin()
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (19 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 20/22] f2fs: " Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  7:05   ` Christoph Hellwig
  2022-02-22 19:48 ` [PATCH 22/22] fs: Remove flags parameter from aops->write_begin Matthew Wilcox (Oracle)
  2022-02-22 22:24 ` [PATCH 00/22] Remove aop flags Dave Chinner
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

There are no more aop flags left, so remove the parameter.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 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(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 2b3518d57bcc..cd4fd4bed561 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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)
 {
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 97192932ea56..bfa69c52ce2c 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -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);
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 27be2e8ba237..7e433ecfc9e9 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -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);
 
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 127b60fad77e..6e5a64005fef 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -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,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 22/22] fs: Remove flags parameter from aops->write_begin
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (20 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 21/22] fs: Remove aop flags parameter from nobh_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-22 19:48 ` Matthew Wilcox (Oracle)
  2022-02-23  7:06   ` Christoph Hellwig
  2022-02-22 22:24 ` [PATCH 00/22] Remove aop flags Dave Chinner
  22 siblings, 1 reply; 49+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-02-22 19:48 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle)

There are no more aop flags left, so remove the parameter.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 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(-)

diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst
index 72fa12dabd39..a5935b101d62 100644
--- a/Documentation/filesystems/locking.rst
+++ b/Documentation/filesystems/locking.rst
@@ -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,
diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst
index d16bee420326..9c5a8a9fe1b6 100644
--- a/Documentation/filesystems/vfs.rst
+++ b/Documentation/filesystems/vfs.rst
@@ -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.
 
diff --git a/block/fops.c b/block/fops.c
index 6a2c84555dbb..1fa7229b7670 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -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);
 }
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 0eece6974a3f..a7d8e265f998 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -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;
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index b6912496bb19..f7959b1a2d52 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -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;
diff --git a/fs/affs/file.c b/fs/affs/file.c
index 1c18f13e8aa1..44396b710e04 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -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;
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index dc5032e10244..f093321f2ec7 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -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,
diff --git a/fs/afs/write.c b/fs/afs/write.c
index 986e97866e16..65ef2a444868 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -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));
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index 9408f45225cb..dc97c9b8f23b 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -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;
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 09f27d1d7fec..0b8f6d6862cc 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -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);
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 3816c7f1bc98..249899126198 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -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;
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 84e399a921ad..47904d40ef88 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -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;
diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
index 8ed3c4b700cd..b9f63113db2d 100644
--- a/fs/exfat/inode.c
+++ b/fs/exfat/inode.c
@@ -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;
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index bfa69c52ce2c..d8ca8050945a 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -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;
 
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 11e3c2d6bcd2..545ee86419c2 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -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,
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 6330be19a973..d2b197580429 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -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;
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 3d76e535e709..a5cd9e02d983 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -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;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 968941d41162..354e2b1af97b 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -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));
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 396735dd3407..93d9aa832139 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -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;
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 435b6202532a..73010aa4623f 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -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;
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 7075a29a7c0c..6b61e18563d7 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -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;
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
index 8740b4ea0b52..8b590b3826c3 100644
--- a/fs/hpfs/file.c
+++ b/fs/hpfs/file.c
@@ -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;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index f544f622598d..c23781efa95a 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -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;
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index 142d3ba9f0a8..2b35811772de 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -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;
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 7e433ecfc9e9..fa8c3203bf9b 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -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;
diff --git a/fs/libfs.c b/fs/libfs.c
index d4395e1c6696..a1c10d3163e0 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -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;
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 2fac50b3a334..a80251975336 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -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;
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 12bf12da7657..d22b30e126a8 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -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;
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 96f5d8334621..ab893a282fbe 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -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)
 
 {
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 16466c8648f3..1364174cc6c9 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -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;
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index fc890ca2e17e..6cddb927075f 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -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;
diff --git a/fs/omfs/file.c b/fs/omfs/file.c
index 349b96d89c44..980b0a72c172 100644
--- a/fs/omfs/file.c
+++ b/fs/omfs/file.c
@@ -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;
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 809690db8be2..bc7ccd15d7a3 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -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;
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index aa31cf1dbba6..46ba4892030a 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -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;
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index 96b7fd4facf3..96ad24fe0ffb 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -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;
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 191490fdf91b..ad980b9a5604 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -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);
 	}
 
 	/*
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 724bb3141fda..3f4d5c44c784 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -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;
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 88a95886ce8a..866f9a53248e 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -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;
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index bd0e0c66f93d..6c973b71cab2 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -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;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index bdbf5dcdb272..34ff92ba7528 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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 *);
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index e7d9cf94e0f0..f2b5b25296cf 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -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);
 }
 
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 40cca0e5a811..1820e40c4d6f 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -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,
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index f701bb23f83c..0b4148542c40 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -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,
diff --git a/mm/filemap.c b/mm/filemap.c
index 9e3ccc2e54ee..4551013993cb 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -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;
diff --git a/mm/shmem.c b/mm/shmem.c
index 5944159bc43e..b28e9ccb16f5 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* Re: [PATCH 00/22] Remove aop flags
  2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
                   ` (21 preceding siblings ...)
  2022-02-22 19:48 ` [PATCH 22/22] fs: Remove flags parameter from aops->write_begin Matthew Wilcox (Oracle)
@ 2022-02-22 22:24 ` Dave Chinner
  22 siblings, 0 replies; 49+ messages in thread
From: Dave Chinner @ 2022-02-22 22:24 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:47:58PM +0000, Matthew Wilcox (Oracle) wrote:
> 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.

I just did a quick pass over the patches, all looks pretty straight
forwards and obvious with the exception of the reiserfs patch...

Acked-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 01/22] fs: Pass an iocb to generic_perform_write()
  2022-02-22 19:47 ` [PATCH 01/22] fs: Pass an iocb to generic_perform_write() Matthew Wilcox (Oracle)
@ 2022-02-23  6:51   ` Christoph Hellwig
  2022-03-02 17:36     ` Matthew Wilcox
  2022-02-23  8:47   ` Christian Brauner
  1 sibling, 1 reply; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:51 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

> -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:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 02/22] fs: Move pagecache_write_begin() and pagecache_write_end()
  2022-02-22 19:48 ` [PATCH 02/22] fs: Move pagecache_write_begin() and pagecache_write_end() Matthew Wilcox (Oracle)
@ 2022-02-23  6:53   ` Christoph Hellwig
  2022-02-23  8:47   ` Christian Brauner
  1 sibling, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:53 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:00PM +0000, Matthew Wilcox (Oracle) wrote:
> 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.

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.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 03/22] reiserfs: Stop using AOP_FLAG_CONT_EXPAND flag
  2022-02-22 19:48 ` [PATCH 03/22] reiserfs: Stop using AOP_FLAG_CONT_EXPAND flag Matthew Wilcox (Oracle)
@ 2022-02-23  6:54   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:54 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel, Edward Shishkin

On Tue, Feb 22, 2022 at 07:48:01PM +0000, Matthew Wilcox (Oracle) wrote:
> From: Edward Shishkin <edward.shishkin@gmail.com>
> 
> We can simplify write_begin() and write_end() by handling the
> cont_expand case in reiserfs_setattr().
> 
> Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 04/22] filemap: Remove AOP_FLAG_CONT_EXPAND
  2022-02-22 19:48 ` [PATCH 04/22] filemap: Remove AOP_FLAG_CONT_EXPAND Matthew Wilcox (Oracle)
@ 2022-02-23  6:54   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:54 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 05/22] ext4: Use page_symlink() instead of __page_symlink()
  2022-02-22 19:48 ` [PATCH 05/22] ext4: Use page_symlink() instead of __page_symlink() Matthew Wilcox (Oracle)
@ 2022-02-23  6:54   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:54 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 06/22] namei: Merge page_symlink() and __page_symlink()
  2022-02-22 19:48 ` [PATCH 06/22] namei: Merge page_symlink() and __page_symlink() Matthew Wilcox (Oracle)
@ 2022-02-23  6:55   ` Christoph Hellwig
  2022-02-23  8:48   ` Christian Brauner
  1 sibling, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:55 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:04PM +0000, Matthew Wilcox (Oracle) wrote:
> There are no callers of __page_symlink() left, so we can remove that
> entry point.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 07/22] namei: Convert page_symlink() to use memalloc_nofs_save()
  2022-02-22 19:48 ` [PATCH 07/22] namei: Convert page_symlink() to use memalloc_nofs_save() Matthew Wilcox (Oracle)
@ 2022-02-23  6:56   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:56 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:05PM +0000, Matthew Wilcox (Oracle) wrote:
> Stop using AOP_FLAG_NOFS in favour of the scoped memory API.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 08/22] f2fs: Convert f2fs_grab_cache_page() to use scoped memory APIs
  2022-02-22 19:48 ` [PATCH 08/22] f2fs: Convert f2fs_grab_cache_page() to use scoped memory APIs Matthew Wilcox (Oracle)
@ 2022-02-23  6:57   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:57 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:06PM +0000, Matthew Wilcox (Oracle) wrote:
> Prevent GFP_FS allocations by using memalloc_nofs_save() instead
> of AOP_FLAG_NOFS.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 13/22] fs: Remove AOP_FLAG_NOFS
  2022-02-22 19:48 ` [PATCH 13/22] fs: Remove AOP_FLAG_NOFS Matthew Wilcox (Oracle)
@ 2022-02-23  6:57   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:57 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:11PM +0000, Matthew Wilcox (Oracle) wrote:
> With all users of this flag gone, we can stop testing whether it's set.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 14/22] fs: Remove aop flags argument from pagecache_write_begin()
  2022-02-22 19:48 ` [PATCH 14/22] fs: Remove aop flags argument from pagecache_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-23  6:57   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:57 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 15/22] fs: Remove aop_flags parameter from netfs_write_begin()
  2022-02-22 19:48 ` [PATCH 15/22] fs: Remove aop_flags parameter from netfs_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-23  6:57   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:57 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 16/22] fs: Remove aop flags parameter from block_write_begin()
  2022-02-22 19:48 ` [PATCH 16/22] fs: Remove aop flags parameter from block_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-23  6:58   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:58 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:14PM +0000, Matthew Wilcox (Oracle) wrote:
> There are no more aop flags left, so remove the parameter.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 17/22] fs: Remove aop flags parameter from cont_write_begin()
  2022-02-22 19:48 ` [PATCH 17/22] fs: Remove aop flags parameter from cont_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-23  6:59   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:59 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:15PM +0000, Matthew Wilcox (Oracle) wrote:
> There are no more aop flags left, so remove the parameter.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 18/22] fs: Remove aop flags parameter from grab_cache_page_write_begin()
  2022-02-22 19:48 ` [PATCH 18/22] fs: Remove aop flags parameter from grab_cache_page_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-23  6:59   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  6:59 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:16PM +0000, Matthew Wilcox (Oracle) wrote:
> There are no more aop flags left, so remove the parameter.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 19/22] affs: Use pagecache_write_begin() & pagecache_write_end()
  2022-02-22 19:48 ` [PATCH 19/22] affs: Use pagecache_write_begin() & pagecache_write_end() Matthew Wilcox (Oracle)
@ 2022-02-23  7:05   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  7:05 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:17PM +0000, Matthew Wilcox (Oracle) wrote:
> 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.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 21/22] fs: Remove aop flags parameter from nobh_write_begin()
  2022-02-22 19:48 ` [PATCH 21/22] fs: Remove aop flags parameter from nobh_write_begin() Matthew Wilcox (Oracle)
@ 2022-02-23  7:05   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  7:05 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 22/22] fs: Remove flags parameter from aops->write_begin
  2022-02-22 19:48 ` [PATCH 22/22] fs: Remove flags parameter from aops->write_begin Matthew Wilcox (Oracle)
@ 2022-02-23  7:06   ` Christoph Hellwig
  0 siblings, 0 replies; 49+ messages in thread
From: Christoph Hellwig @ 2022-02-23  7:06 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 01/22] fs: Pass an iocb to generic_perform_write()
  2022-02-22 19:47 ` [PATCH 01/22] fs: Pass an iocb to generic_perform_write() Matthew Wilcox (Oracle)
  2022-02-23  6:51   ` Christoph Hellwig
@ 2022-02-23  8:47   ` Christian Brauner
  1 sibling, 0 replies; 49+ messages in thread
From: Christian Brauner @ 2022-02-23  8:47 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:47:59PM +0000, Matthew Wilcox wrote:
> 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) <willy@infradead.org>
> ---

Nice simplification,
Reviewed-by: Christian Brauner <brauner@kernel.org>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 02/22] fs: Move pagecache_write_begin() and pagecache_write_end()
  2022-02-22 19:48 ` [PATCH 02/22] fs: Move pagecache_write_begin() and pagecache_write_end() Matthew Wilcox (Oracle)
  2022-02-23  6:53   ` Christoph Hellwig
@ 2022-02-23  8:47   ` Christian Brauner
  1 sibling, 0 replies; 49+ messages in thread
From: Christian Brauner @ 2022-02-23  8:47 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:00PM +0000, Matthew Wilcox wrote:
> 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.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---

Good to see the header shrink further!
Reviewed-by: Christian Brauner <brauner@kernel.org>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 06/22] namei: Merge page_symlink() and __page_symlink()
  2022-02-22 19:48 ` [PATCH 06/22] namei: Merge page_symlink() and __page_symlink() Matthew Wilcox (Oracle)
  2022-02-23  6:55   ` Christoph Hellwig
@ 2022-02-23  8:48   ` Christian Brauner
  1 sibling, 0 replies; 49+ messages in thread
From: Christian Brauner @ 2022-02-23  8:48 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:04PM +0000, Matthew Wilcox wrote:
> There are no callers of __page_symlink() left, so we can remove that
> entry point.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---

Reviewed-by: Christian Brauner <brauner@kernel.org>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 01/22] fs: Pass an iocb to generic_perform_write()
  2022-02-23  6:51   ` Christoph Hellwig
@ 2022-03-02 17:36     ` Matthew Wilcox
  0 siblings, 0 replies; 49+ messages in thread
From: Matthew Wilcox @ 2022-03-02 17:36 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 10:51:39PM -0800, Christoph Hellwig wrote:
> > -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.

> Otherwise looks fine:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 12/22] ext4: Use scoped memory APIs in ext4_write_begin()
  2022-02-22 19:48 ` [PATCH 12/22] ext4: Use scoped memory APIs in ext4_write_begin() Matthew Wilcox (Oracle)
@ 2022-03-08 15:55   ` Theodore Ts'o
  0 siblings, 0 replies; 49+ messages in thread
From: Theodore Ts'o @ 2022-03-08 15:55 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:10PM +0000, Matthew Wilcox (Oracle) wrote:
> 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.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 09/22] ext4: Allow GFP_FS allocations in ext4_da_convert_inline_data_to_extent()
  2022-02-22 19:48 ` [PATCH 09/22] ext4: Allow GFP_FS allocations in ext4_da_convert_inline_data_to_extent() Matthew Wilcox (Oracle)
@ 2022-03-08 17:12   ` Theodore Ts'o
  0 siblings, 0 replies; 49+ messages in thread
From: Theodore Ts'o @ 2022-03-08 17:12 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:07PM +0000, Matthew Wilcox (Oracle) wrote:
> 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.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Theodore Ts'o <tytso@mit.edu>

(Or would you prefer that I take these through the ext4 tree?)

    	      	     	    	 - Ted

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 10/22] ext4: Use scoped memory API in mext_page_double_lock()
  2022-02-22 19:48 ` [PATCH 10/22] ext4: Use scoped memory API in mext_page_double_lock() Matthew Wilcox (Oracle)
@ 2022-03-08 17:13   ` Theodore Ts'o
  0 siblings, 0 replies; 49+ messages in thread
From: Theodore Ts'o @ 2022-03-08 17:13 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:08PM +0000, Matthew Wilcox (Oracle) wrote:
> Replace use of AOP_FLAG_NOFS with calls to memalloc_nofs_save()
> and memalloc_nofs_restore().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Theodore Ts'o <tytso@mit.edu>

							- Ted

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 11/22] ext4: Use scoped memory APIs in ext4_da_write_begin()
  2022-02-22 19:48 ` [PATCH 11/22] ext4: Use scoped memory APIs in ext4_da_write_begin() Matthew Wilcox (Oracle)
@ 2022-03-08 17:13   ` Theodore Ts'o
  0 siblings, 0 replies; 49+ messages in thread
From: Theodore Ts'o @ 2022-03-08 17:13 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel

On Tue, Feb 22, 2022 at 07:48:09PM +0000, Matthew Wilcox (Oracle) wrote:
> 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.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Theodore Ts'o <tytso@mit.edu>


^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2022-03-08 17:13 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 19:47 [PATCH 00/22] Remove aop flags Matthew Wilcox (Oracle)
2022-02-22 19:47 ` [PATCH 01/22] fs: Pass an iocb to generic_perform_write() Matthew Wilcox (Oracle)
2022-02-23  6:51   ` Christoph Hellwig
2022-03-02 17:36     ` Matthew Wilcox
2022-02-23  8:47   ` Christian Brauner
2022-02-22 19:48 ` [PATCH 02/22] fs: Move pagecache_write_begin() and pagecache_write_end() Matthew Wilcox (Oracle)
2022-02-23  6:53   ` Christoph Hellwig
2022-02-23  8:47   ` Christian Brauner
2022-02-22 19:48 ` [PATCH 03/22] reiserfs: Stop using AOP_FLAG_CONT_EXPAND flag Matthew Wilcox (Oracle)
2022-02-23  6:54   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 04/22] filemap: Remove AOP_FLAG_CONT_EXPAND Matthew Wilcox (Oracle)
2022-02-23  6:54   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 05/22] ext4: Use page_symlink() instead of __page_symlink() Matthew Wilcox (Oracle)
2022-02-23  6:54   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 06/22] namei: Merge page_symlink() and __page_symlink() Matthew Wilcox (Oracle)
2022-02-23  6:55   ` Christoph Hellwig
2022-02-23  8:48   ` Christian Brauner
2022-02-22 19:48 ` [PATCH 07/22] namei: Convert page_symlink() to use memalloc_nofs_save() Matthew Wilcox (Oracle)
2022-02-23  6:56   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 08/22] f2fs: Convert f2fs_grab_cache_page() to use scoped memory APIs Matthew Wilcox (Oracle)
2022-02-23  6:57   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 09/22] ext4: Allow GFP_FS allocations in ext4_da_convert_inline_data_to_extent() Matthew Wilcox (Oracle)
2022-03-08 17:12   ` Theodore Ts'o
2022-02-22 19:48 ` [PATCH 10/22] ext4: Use scoped memory API in mext_page_double_lock() Matthew Wilcox (Oracle)
2022-03-08 17:13   ` Theodore Ts'o
2022-02-22 19:48 ` [PATCH 11/22] ext4: Use scoped memory APIs in ext4_da_write_begin() Matthew Wilcox (Oracle)
2022-03-08 17:13   ` Theodore Ts'o
2022-02-22 19:48 ` [PATCH 12/22] ext4: Use scoped memory APIs in ext4_write_begin() Matthew Wilcox (Oracle)
2022-03-08 15:55   ` Theodore Ts'o
2022-02-22 19:48 ` [PATCH 13/22] fs: Remove AOP_FLAG_NOFS Matthew Wilcox (Oracle)
2022-02-23  6:57   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 14/22] fs: Remove aop flags argument from pagecache_write_begin() Matthew Wilcox (Oracle)
2022-02-23  6:57   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 15/22] fs: Remove aop_flags parameter from netfs_write_begin() Matthew Wilcox (Oracle)
2022-02-23  6:57   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 16/22] fs: Remove aop flags parameter from block_write_begin() Matthew Wilcox (Oracle)
2022-02-23  6:58   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 17/22] fs: Remove aop flags parameter from cont_write_begin() Matthew Wilcox (Oracle)
2022-02-23  6:59   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 18/22] fs: Remove aop flags parameter from grab_cache_page_write_begin() Matthew Wilcox (Oracle)
2022-02-23  6:59   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 19/22] affs: Use pagecache_write_begin() & pagecache_write_end() Matthew Wilcox (Oracle)
2022-02-23  7:05   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 20/22] f2fs: " Matthew Wilcox (Oracle)
2022-02-22 19:48 ` [PATCH 21/22] fs: Remove aop flags parameter from nobh_write_begin() Matthew Wilcox (Oracle)
2022-02-23  7:05   ` Christoph Hellwig
2022-02-22 19:48 ` [PATCH 22/22] fs: Remove flags parameter from aops->write_begin Matthew Wilcox (Oracle)
2022-02-23  7:06   ` Christoph Hellwig
2022-02-22 22:24 ` [PATCH 00/22] Remove aop flags Dave Chinner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.