[PATCH v5 0/5] fs: refactor write_begin/write_end and add ext4 IOCB_DONTCACHE support

陈涛涛 Taotao Chen posted 5 patches 2 months, 4 weeks ago
There is a newer version of this series
Documentation/filesystems/locking.rst     |   4 +-
Documentation/filesystems/vfs.rst         |   6 +-
block/fops.c                              |  13 ++-
drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 114 ++++++----------------
fs/adfs/inode.c                           |   9 +-
fs/affs/file.c                            |  26 ++---
fs/bcachefs/fs-io-buffered.c              |   4 +-
fs/bcachefs/fs-io-buffered.h              |   4 +-
fs/bfs/file.c                             |   7 +-
fs/buffer.c                               |  26 ++---
fs/ceph/addr.c                            |  10 +-
fs/ecryptfs/mmap.c                        |  10 +-
fs/exfat/file.c                           |  11 +--
fs/exfat/inode.c                          |  16 +--
fs/ext2/inode.c                           |  11 ++-
fs/ext4/file.c                            |   3 +-
fs/ext4/inode.c                           |  30 +++---
fs/f2fs/data.c                            |   8 +-
fs/fat/inode.c                            |  18 ++--
fs/fuse/file.c                            |  14 ++-
fs/hfs/hfs_fs.h                           |   2 +-
fs/hfs/inode.c                            |   4 +-
fs/hfsplus/hfsplus_fs.h                   |   6 +-
fs/hfsplus/inode.c                        |   8 +-
fs/hostfs/hostfs_kern.c                   |   8 +-
fs/hpfs/file.c                            |  18 ++--
fs/hugetlbfs/inode.c                      |   9 +-
fs/jffs2/file.c                           |  28 +++---
fs/jfs/inode.c                            |  16 +--
fs/libfs.c                                |  11 ++-
fs/minix/inode.c                          |   7 +-
fs/nfs/file.c                             |   8 +-
fs/nilfs2/inode.c                         |   8 +-
fs/ntfs3/file.c                           |   4 +-
fs/ntfs3/inode.c                          |   7 +-
fs/ntfs3/ntfs_fs.h                        |  10 +-
fs/ocfs2/aops.c                           |   6 +-
fs/omfs/file.c                            |   7 +-
fs/orangefs/inode.c                       |  16 +--
fs/ubifs/file.c                           |   5 +-
fs/udf/inode.c                            |  11 ++-
fs/ufs/inode.c                            |  16 +--
fs/vboxsf/file.c                          |   5 +-
include/linux/buffer_head.h               |   4 +-
include/linux/fs.h                        |  11 ++-
include/linux/pagemap.h                   |  27 +++++
mm/filemap.c                              |   4 +-
mm/shmem.c                                |  12 +--
48 files changed, 327 insertions(+), 295 deletions(-)
[PATCH v5 0/5] fs: refactor write_begin/write_end and add ext4 IOCB_DONTCACHE support
Posted by 陈涛涛 Taotao Chen 2 months, 4 weeks ago
From: Taotao Chen <chentaotao@didiglobal.com>

This patch series refactors the address_space_operations write_begin()
and write_end() callbacks to take const struct kiocb * as their first
argument, allowing IOCB flags such as IOCB_DONTCACHE to propagate to the
filesystem's buffered I/O path.

Ext4 is updated to implement handling of the IOCB_DONTCACHE flag and
advertises support via the FOP_DONTCACHE file operation flag.

Additionally, the i915 driver's shmem write paths are updated to bypass
the legacy write_begin/write_end interface in favor of directly
calling write_iter() with a constructed synchronous kiocb. Another i915
change replaces a manual write loop with kernel_write() during GEM shmem
object creation.

Tested with ext4 and i915 GEM workloads.

This patch series is based on the vfs-6.17.misc branch.

Changes since v4:
- Updated write_begin_get_folio() comment and made it static inline in header.

Taotao Chen (5):
  drm/i915: Use kernel_write() in shmem object create
  drm/i915: Refactor shmem_pwrite() to use kiocb and write_iter
  fs: change write_begin/write_end interface to take struct kiocb *
  mm/pagemap: add write_begin_get_folio() helper function
  ext4: support uncached buffered I/O

 Documentation/filesystems/locking.rst     |   4 +-
 Documentation/filesystems/vfs.rst         |   6 +-
 block/fops.c                              |  13 ++-
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 114 ++++++----------------
 fs/adfs/inode.c                           |   9 +-
 fs/affs/file.c                            |  26 ++---
 fs/bcachefs/fs-io-buffered.c              |   4 +-
 fs/bcachefs/fs-io-buffered.h              |   4 +-
 fs/bfs/file.c                             |   7 +-
 fs/buffer.c                               |  26 ++---
 fs/ceph/addr.c                            |  10 +-
 fs/ecryptfs/mmap.c                        |  10 +-
 fs/exfat/file.c                           |  11 +--
 fs/exfat/inode.c                          |  16 +--
 fs/ext2/inode.c                           |  11 ++-
 fs/ext4/file.c                            |   3 +-
 fs/ext4/inode.c                           |  30 +++---
 fs/f2fs/data.c                            |   8 +-
 fs/fat/inode.c                            |  18 ++--
 fs/fuse/file.c                            |  14 ++-
 fs/hfs/hfs_fs.h                           |   2 +-
 fs/hfs/inode.c                            |   4 +-
 fs/hfsplus/hfsplus_fs.h                   |   6 +-
 fs/hfsplus/inode.c                        |   8 +-
 fs/hostfs/hostfs_kern.c                   |   8 +-
 fs/hpfs/file.c                            |  18 ++--
 fs/hugetlbfs/inode.c                      |   9 +-
 fs/jffs2/file.c                           |  28 +++---
 fs/jfs/inode.c                            |  16 +--
 fs/libfs.c                                |  11 ++-
 fs/minix/inode.c                          |   7 +-
 fs/nfs/file.c                             |   8 +-
 fs/nilfs2/inode.c                         |   8 +-
 fs/ntfs3/file.c                           |   4 +-
 fs/ntfs3/inode.c                          |   7 +-
 fs/ntfs3/ntfs_fs.h                        |  10 +-
 fs/ocfs2/aops.c                           |   6 +-
 fs/omfs/file.c                            |   7 +-
 fs/orangefs/inode.c                       |  16 +--
 fs/ubifs/file.c                           |   5 +-
 fs/udf/inode.c                            |  11 ++-
 fs/ufs/inode.c                            |  16 +--
 fs/vboxsf/file.c                          |   5 +-
 include/linux/buffer_head.h               |   4 +-
 include/linux/fs.h                        |  11 ++-
 include/linux/pagemap.h                   |  27 +++++
 mm/filemap.c                              |   4 +-
 mm/shmem.c                                |  12 +--
 48 files changed, 327 insertions(+), 295 deletions(-)

-- 
2.34.1
Re: [PATCH v5 0/5] fs: refactor write_begin/write_end and add ext4 IOCB_DONTCACHE support
Posted by Christian Brauner 2 months, 3 weeks ago
On Thu, 10 Jul 2025 10:14:06 +0000, 陈涛涛 Taotao Chen wrote:
> From: Taotao Chen <chentaotao@didiglobal.com>
> 
> This patch series refactors the address_space_operations write_begin()
> and write_end() callbacks to take const struct kiocb * as their first
> argument, allowing IOCB flags such as IOCB_DONTCACHE to propagate to the
> filesystem's buffered I/O path.
> 
> [...]

Applied to the vfs-6.17.misc branch of the vfs/vfs.git tree.
Patches in the vfs-6.17.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.17.misc

[1/5] drm/i915: Use kernel_write() in shmem object create
      https://git.kernel.org/vfs/vfs/c/110ae5fb48ed
[2/5] drm/i915: Refactor shmem_pwrite() to use kiocb and write_iter
      https://git.kernel.org/vfs/vfs/c/dd09194ff58c
[3/5] fs: change write_begin/write_end interface to take struct kiocb *
      https://git.kernel.org/vfs/vfs/c/254a06118b31
[4/5] mm/pagemap: add write_begin_get_folio() helper function
      https://git.kernel.org/vfs/vfs/c/ff2219c021c5
[5/5] ext4: support uncached buffered I/O
      https://git.kernel.org/vfs/vfs/c/2677497bc6f4
Re: [PATCH v5 0/5] fs: refactor write_begin/write_end and add ext4 IOCB_DONTCACHE support
Posted by Taotao Chen 2 months, 3 weeks ago
在 2025/7/14 17:11, Christian Brauner 写道:
> On Thu, 10 Jul 2025 10:14:06 +0000, 陈涛涛 Taotao Chen wrote:
>> From: Taotao Chen <chentaotao@didiglobal.com>
>>
>> This patch series refactors the address_space_operations write_begin()
>> and write_end() callbacks to take const struct kiocb * as their first
>> argument, allowing IOCB flags such as IOCB_DONTCACHE to propagate to the
>> filesystem's buffered I/O path.
>>
>> [...]
> Applied to the vfs-6.17.misc branch of the vfs/vfs.git tree.
> Patches in the vfs-6.17.misc branch should appear in linux-next soon.
>
> Please report any outstanding bugs that were missed during review in a
> new review to the original patch series allowing us to drop it.
>
> It's encouraged to provide Acked-bys and Reviewed-bys even though the
> patch has now been applied. If possible patch trailers will be updated.
>
> Note that commit hashes shown below are subject to change due to rebase,
> trailer updates or similar. If in doubt, please check the listed branch.
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
> branch: vfs-6.17.misc
>
> [1/5] drm/i915: Use kernel_write() in shmem object create
>        https://git.kernel.org/vfs/vfs/c/110ae5fb48ed
> [2/5] drm/i915: Refactor shmem_pwrite() to use kiocb and write_iter
>        https://git.kernel.org/vfs/vfs/c/dd09194ff58c
> [3/5] fs: change write_begin/write_end interface to take struct kiocb *
>        https://git.kernel.org/vfs/vfs/c/254a06118b31
> [4/5] mm/pagemap: add write_begin_get_folio() helper function
>        https://git.kernel.org/vfs/vfs/c/ff2219c021c5
> [5/5] ext4: support uncached buffered I/O
>        https://git.kernel.org/vfs/vfs/c/2677497bc6f4
Hi Christian,

Kernel testing reported regression bugs in this patch series:
-  Reported-by: kernel test robot <lkp@intel.com>
    Closes: 
202507142128.Zr5StnYh-lkp@intel.com/">https://lore.kernel.org/oe-kbuild-all/202507142128.Zr5StnYh-lkp@intel.com/

- Reported-by: kernel test robot <lkp@intel.com>
   Closes: 
202507142040.wppyoX1s-lkp@intel.com/">https://lore.kernel.org/oe-kbuild-all/202507142040.wppyoX1s-lkp@intel.com/

I will send an updated version of the patch series shortly to address 
these issues.
Please consider dropping the original series from the vfs-6.17.misc 
branch once the new version is reviewed.

Thanks, and sorry for the trouble.

Taotao