[Cluster-devel] [PATCH 09/17] fs: factor out a direct_write_fallback helper

2023-04-23 Thread Christoph Hellwig
Add a helper dealing with handling the syncing of a buffered write fallback for direct I/O. Signed-off-by: Christoph Hellwig --- fs/libfs.c | 36 include/linux/fs.h | 2 ++ mm/filemap.c | 59 ++ 3 files chang

[Cluster-devel] [PATCH 04/17] fs: remove emergency_thaw_bdev

2023-04-23 Thread Christoph Hellwig
Fold emergency_thaw_bdev into it's only caller, to prepare for buffer.c to be built only when buffer_head support is enabled. Signed-off-by: Christoph Hellwig --- fs/buffer.c | 6 -- fs/internal.h | 6 -- fs/super.c| 4 +++- 3 files changed, 3 insertions(+), 13 deletions(-) diff -

[Cluster-devel] [PATCH 16/17] block: use iomap for writes to block devices

2023-04-23 Thread Christoph Hellwig
Use iomap in buffer_head compat mode to write to block devices. Signed-off-by: Christoph Hellwig --- block/Kconfig | 1 + block/fops.c | 33 + 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/block/Kconfig b/block/Kconfig index 941b2dca70db73..672

[Cluster-devel] [PATCH 07/17] filemap: add a kiocb_invalidate_pages helper

2023-04-23 Thread Christoph Hellwig
Factor out a helper that calls filemap_write_and_wait_range and invalidate_inode_pages2_rangefor a the range covered by a write kiocb or returns -EAGAIN if the kiocb is marked as nowait and there would be pages to write or invalidate. Signed-off-by: Christoph Hellwig --- include/linux/pagemap.h

[Cluster-devel] RFC: allow building a kernel without buffer_heads

2023-04-23 Thread Christoph Hellwig
Hi all, after all the talk about removing buffer_heads, here is a series that shows how to build a kernel without buffer_heads. And how unrealistic it is to remove the entirely. Most of the series refactors some common code to make implementing direct I/O easier without use of the ->direct_IO me

[Cluster-devel] [PATCH 05/17] filemap: update ki_pos in generic_perform_write

2023-04-23 Thread Christoph Hellwig
All callers of generic_perform_write need to updated ki_pos, move it into common code. Signed-off-by: Christoph Hellwig --- fs/ceph/file.c | 2 -- fs/ext4/file.c | 9 +++-- fs/f2fs/file.c | 1 - fs/nfs/file.c | 1 - mm/filemap.c | 8 5 files changed, 7 insertions(+), 14 deletions

[Cluster-devel] [PATCH 14/17] block: open code __generic_file_write_iter for blkdev writes

2023-04-23 Thread Christoph Hellwig
Open code __generic_file_write_iter to remove the indirect call into ->direct_IO and to prepare using the iomap based write code. Signed-off-by: Christoph Hellwig --- block/fops.c | 46 -- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/

[Cluster-devel] [PATCH 08/17] filemap: add a kiocb_invalidate_post_write helper

2023-04-23 Thread Christoph Hellwig
Add a helper to invalidate page cache after a dio write. Signed-off-by: Christoph Hellwig --- fs/direct-io.c | 10 ++ fs/iomap/direct-io.c| 12 ++-- include/linux/fs.h | 5 - include/linux/pagemap.h | 1 + mm/filemap.c| 37 -

[Cluster-devel] [PATCH 03/17] fs: rename and move block_page_mkwrite_return

2023-04-23 Thread Christoph Hellwig
block_page_mkwrite_return is neither block nor mkwrite specific, and should not be under CONFIG_BLOCK. Move it to mm.h and rename it to errno_to_vmfault. Signed-off-by: Christoph Hellwig --- fs/ext4/inode.c | 2 +- fs/f2fs/file.c | 2 +- fs/gfs2/file.c |

[Cluster-devel] [PATCH 13/17] block: don't plug in blkdev_write_iter

2023-04-23 Thread Christoph Hellwig
Remove the no needed plug in blkdev_write_iter. For direct I/O that issues more than a single I/O, the plug is already done in __blkdev_direct_IO, and for synchronous buffered writes, the plug is done in writeback_inodes_wb / wb_writeback, while for the other cases a plug doesn't make sense. Sign

[Cluster-devel] [PATCH 10/17] iomap: use kiocb_write_and_wait and kiocb_invalidate_pages

2023-04-23 Thread Christoph Hellwig
Use the common helpers for direct I/O page invalidation instead of open coding the logic. This leads to a slight reordering of checks in __iomap_dio_rw to keep the logic straight. Signed-off-by: Christoph Hellwig --- fs/iomap/direct-io.c | 55 1 file

[Cluster-devel] [PATCH 02/17] fs: remove the special !CONFIG_BLOCK def_blk_fops

2023-04-23 Thread Christoph Hellwig
def_blk_fops always returns -ENODEV, which dosn't match the return value of a non-existing block device with CONFIG_BLOCK, which is -ENXIO. Just remove the extra implementation and fall back to the default no_open_fops that always returns -ENXIO. Signed-off-by: Christoph Hellwig --- fs/Makefile

[Cluster-devel] [PATCH 15/17] block: stop setting ->direct_IO

2023-04-23 Thread Christoph Hellwig
Direct I/O on block devices now nevers goes through aops->direct_IO. Stop setting it and set the FMODE_CAN_ODIRECT in ->open instead. Signed-off-by: Christoph Hellwig --- block/fops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/fops.c b/block/fops.c index fd510b61

[Cluster-devel] [PATCH 11/17] iomap: assign current->backing_dev_info in iomap_file_buffered_write

2023-04-23 Thread Christoph Hellwig
Move the assignment to current->backing_dev_info from the callers into iomap_file_buffered_write. Note that zonefs was missing this assignment before. Signed-off-by: Christoph Hellwig --- fs/gfs2/file.c | 3 --- fs/iomap/buffered-io.c | 4 fs/xfs/xfs_file.c | 5 - 3 files

[Cluster-devel] [PATCH 01/17] fs: unexport buffer_check_dirty_writeback

2023-04-23 Thread Christoph Hellwig
buffer_check_dirty_writeback is only used by the block device aops, remove the export. Signed-off-by: Christoph Hellwig --- fs/buffer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index 9e1e2add541e07..eb14fbaa7d35f7 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@

Re: [Cluster-devel] [PATCH 11/17] iomap: assign current->backing_dev_info in iomap_file_buffered_write

2023-04-23 Thread Christoph Hellwig
On Sun, Apr 23, 2023 at 11:18:25PM -0700, Darrick J. Wong wrote: > > @@ -876,8 +877,11 @@ iomap_file_buffered_write(struct kiocb *iocb, struct > > iov_iter *i, > > if (iocb->ki_flags & IOCB_NOWAIT) > > iter.flags |= IOMAP_NOWAIT; > > > > + current->backing_dev_info = inode_to_b

[Cluster-devel] [PATCH 06/17] filemap: add a kiocb_write_and_wait helper

2023-04-23 Thread Christoph Hellwig
Factor out a helper that does filemap_write_and_wait_range for a the range covered by a read kiocb, or returns -EAGAIN if the kiocb is marked as nowait and there would be pages to write. Signed-off-by: Christoph Hellwig --- block/fops.c| 18 +++--- include/linux/pagemap.h

[Cluster-devel] [PATCH 12/17] fuse: use direct_write_fallback

2023-04-23 Thread Christoph Hellwig
Refator the fuse direct write code so that the fuse_perform_write callig convention is simplified to match generic_perform_write and it's updating ki_pos directly, and the generic direct_write_fallback helper is used to consolidate buffered I/O fallback code. Signed-off-by: Christoph Hellwig ---

Re: [Cluster-devel] [PATCH 11/17] iomap: assign current->backing_dev_info in iomap_file_buffered_write

2023-04-23 Thread Darrick J. Wong
On Mon, Apr 24, 2023 at 07:49:20AM +0200, Christoph Hellwig wrote: > Move the assignment to current->backing_dev_info from the callers into > iomap_file_buffered_write. Note that zonefs was missing this assignment > before. > > Signed-off-by: Christoph Hellwig > --- > fs/gfs2/file.c | 3

[Cluster-devel] [PATCH 17/17] fs: add CONFIG_BUFFER_HEAD

2023-04-23 Thread Christoph Hellwig
Add a new config option that controls building the buffer_head code, and select it from all file systems and stacking drivers that need it. For the block device nodes and alternative iomap based buffered I/O path is provided when buffer_head support is not enabled, and iomap needs a little tweak t