linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH 00/10] convert the majority of file systems to mmap_prepare
@ 2025-06-16 19:33 Lorenzo Stoakes via Linux-f2fs-devel
  2025-06-16 19:33 ` [f2fs-dev] [PATCH 01/10] mm: rename call_mmap/mmap_prepare to vfs_mmap/mmap_prepare Lorenzo Stoakes via Linux-f2fs-devel
                   ` (15 more replies)
  0 siblings, 16 replies; 50+ messages in thread
From: Lorenzo Stoakes via Linux-f2fs-devel @ 2025-06-16 19:33 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Latchesar Ionkov, nvdimm, Paulo Alcantara, dri-devel, ceph-devel,
	Mike Marshall, linux-xfs, Tyler Hicks, devel, Shyam Prasad N,
	Jan Harkes, linux-um, Joel Becker, Ronnie Sahlberg,
	John Paul Adrian Glaubitz, Eric Van Hensbergen, Christian Brauner,
	linux-kernel, linux-fsdevel, Trond Myklebust, Dave Kleikamp,
	Sandeep Dhavale, Simona Vetter, linux-cifs, linux-nilfs, codalist,
	Namjae Jeon, ecryptfs, Yangtao Li, Jani Nikula, ocfs2-devel,
	Pedro Falcato, OGAWA Hirofumi, linux-block, Theodore Ts'o,
	linux-f2fs-devel, Hongbo Li, Anna Schumaker, Martin Brandenburg,
	Kees Cook, Yuezhang Mo, Carlos Maiolino, Joonas Lahtinen,
	Chris Mason, linux-mtd, Jaegeuk Kim, Marc Dionne, Tvrtko Ursulin,
	linux-afs, Naohiro Aota, Miklos Szeredi, Matthew Wilcox, coda,
	Viacheslav Dubeyko, Ilya Dryomov, linux-ext4, Amir Goldstein,
	intel-gfx, Damien Le Moal, Rodrigo Vivi, Dan Williams, Gao Xiang,
	David Howells, linux-nfs, linux-mm, samba-technical, Steve French,
	ntfs3, linux-erofs, jfs-discussion, Jan Kara, linux-aio,
	Dominique Martinet, Christian Schoenebeck, Bob Copeland,
	Konstantin Komarov, Joseph Qi, Andreas Dilger, Mikulas Patocka,
	David Airlie, Anton Ivanov, Yue Hu, Richard Weinberger,
	Mark Fasheh, linux-bcachefs, Jann Horn, Josef Bacik,
	Liam R . Howlett, Tom Talpey, Hans de Goede, Bharath SM,
	Tigran A . Aivazian, David Sterba, Xiubo Li, Ryusuke Konishi,
	Vlastimil Babka, Jens Axboe, Sungjong Seo, v9fs, Kent Overstreet,
	linux-unionfs, Benjamin LaHaise, Jeffle Xu, Johannes Berg,
	Johannes Thumshirn, David Woodhouse, linux-karma-devel,
	linux-btrfs, Alexander Viro

REVIEWER'S NOTES
================

I am basing this on the mm-new branch in Andrew's tree, so let me know if I
should rebase anything here. Given the mm bits touched I did think perhaps
we should take it through the mm tree, however it may be more sensible to
take it through an fs tree - let me know!

Apologies for the noise/churn, but there are some prerequisite steps here
that inform an ordering - "fs: consistently use file_has_valid_mmap_hooks()
helper" being especially critical, and so I put the bulk of the work in the
same series.

Let me know if there's anything I can do to make life easier here.

Thanks!

===============

In commit c84bf6dd2b83 ("mm: introduce new .mmap_prepare() file
callback"), a new hook for mmap was introduced - f_op->mmap_prepare().

This is preferred to the existing f_op->mmap() hook as it does require a
VMA to be established yet, thus allowing the mmap logic to invoke this hook
far, far earlier, prior to inserting a VMA into the virtual address space,
or performing any other heavy handed operations.

This allows for much simpler unwinding on error, and for there to be a
single attempt at merging a VMA rather than having to possibly reattempt a
merge based on potentially altered VMA state.

Far more importantly, it prevents inappropriate manipulation of
incompletely initialised VMA state, which is something that has been the
cause of bugs and complexity in the past.

The intent is to gradually deprecate f_op->mmap, and in that vein this
series coverts the majority of file systems to using f_op->mmap_prepare.

Prerequisite steps are taken - firstly ensuring all checks for mmap
capabilities use the file_has_valid_mmap_hooks() helper rather than
directly checking for f_op->mmap (which is now not a valid check) and
secondly updating daxdev_mapping_supported() to not require a VMA parameter
to allow ext4 and xfs to be converted.

Commit bb666b7c2707 ("mm: add mmap_prepare() compatibility layer for nested
file systems") handles the nasty edge-case of nested file systems like
overlayfs, which introduces a compatibility shim to allow
f_op->mmap_prepare() to be invoked from an f_op->mmap() callback.

This allows for nested filesystems to continue to function correctly with
all file systems regardless of which callback is used. Once we finally
convert all file systems, this shim can be removed.

As a result, ecryptfs, fuse, and overlayfs remain unaltered so they can
nest all other file systems.

We additionally do not update resctl - as this requires an update to
remap_pfn_range() (or an alternative to it) which we defer to a later
series, equally we do not update cramfs which needs a mixed mapping
insertion with the same issue, nor do we update procfs, hugetlbfs, syfs or
kernfs all of which require VMAs for internal state and hooks. We shall
return to all of these later.

Lorenzo Stoakes (10):
  mm: rename call_mmap/mmap_prepare to vfs_mmap/mmap_prepare
  mm/nommu: use file_has_valid_mmap_hooks() helper
  fs: consistently use file_has_valid_mmap_hooks() helper
  fs/dax: make it possible to check dev dax support without a VMA
  fs/ext4: transition from deprecated .mmap hook to .mmap_prepare
  fs/xfs: transition from deprecated .mmap hook to .mmap_prepare
  mm/filemap: introduce generic_file_*_mmap_prepare() helpers
  fs: convert simple use of generic_file_*_mmap() to .mmap_prepare()
  fs: convert most other generic_file_*mmap() users to .mmap_prepare()
  fs: replace mmap hook with .mmap_prepare for simple mappings

 block/fops.c                               |  9 +++---
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c |  2 +-
 fs/9p/vfs_file.c                           | 13 +++++----
 fs/adfs/file.c                             |  2 +-
 fs/affs/file.c                             |  2 +-
 fs/afs/file.c                              | 11 ++++----
 fs/aio.c                                   |  8 +++---
 fs/backing-file.c                          |  4 +--
 fs/bcachefs/fs.c                           |  8 +++---
 fs/bfs/file.c                              |  2 +-
 fs/binfmt_elf.c                            |  4 +--
 fs/binfmt_elf_fdpic.c                      |  2 +-
 fs/btrfs/file.c                            |  7 +++--
 fs/ceph/addr.c                             |  5 ++--
 fs/ceph/file.c                             |  2 +-
 fs/ceph/super.h                            |  2 +-
 fs/coda/file.c                             |  6 ++--
 fs/ecryptfs/file.c                         |  2 +-
 fs/erofs/data.c                            | 16 ++++++-----
 fs/exfat/file.c                            |  7 +++--
 fs/ext2/file.c                             | 12 ++++----
 fs/ext4/file.c                             | 13 +++++----
 fs/f2fs/file.c                             |  7 +++--
 fs/fat/file.c                              |  2 +-
 fs/hfs/inode.c                             |  2 +-
 fs/hfsplus/inode.c                         |  2 +-
 fs/hostfs/hostfs_kern.c                    |  2 +-
 fs/hpfs/file.c                             |  2 +-
 fs/jffs2/file.c                            |  2 +-
 fs/jfs/file.c                              |  2 +-
 fs/minix/file.c                            |  2 +-
 fs/nfs/file.c                              | 13 +++++----
 fs/nfs/internal.h                          |  2 +-
 fs/nfs/nfs4file.c                          |  2 +-
 fs/nilfs2/file.c                           |  8 +++---
 fs/ntfs3/file.c                            | 15 +++++-----
 fs/ocfs2/file.c                            |  4 +--
 fs/ocfs2/mmap.c                            |  5 ++--
 fs/ocfs2/mmap.h                            |  2 +-
 fs/omfs/file.c                             |  2 +-
 fs/orangefs/file.c                         | 10 ++++---
 fs/ramfs/file-mmu.c                        |  2 +-
 fs/ramfs/file-nommu.c                      | 12 ++++----
 fs/read_write.c                            |  2 +-
 fs/romfs/mmap-nommu.c                      |  6 ++--
 fs/smb/client/cifsfs.c                     | 12 ++++----
 fs/smb/client/cifsfs.h                     |  4 +--
 fs/smb/client/file.c                       | 14 ++++++----
 fs/ubifs/file.c                            |  8 +++---
 fs/ufs/file.c                              |  2 +-
 fs/vboxsf/file.c                           |  8 +++---
 fs/xfs/xfs_file.c                          | 15 +++++-----
 fs/zonefs/file.c                           | 10 ++++---
 include/linux/dax.h                        | 16 ++++++-----
 include/linux/fs.h                         | 11 ++++----
 ipc/shm.c                                  |  2 +-
 mm/filemap.c                               | 29 ++++++++++++++++++++
 mm/internal.h                              |  2 +-
 mm/nommu.c                                 |  2 +-
 mm/vma.c                                   |  2 +-
 tools/testing/vma/vma_internal.h           | 32 ++++++++++++++++++----
 61 files changed, 245 insertions(+), 171 deletions(-)

--
2.49.0


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2025-08-01 15:36 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 19:33 [f2fs-dev] [PATCH 00/10] convert the majority of file systems to mmap_prepare Lorenzo Stoakes via Linux-f2fs-devel
2025-06-16 19:33 ` [f2fs-dev] [PATCH 01/10] mm: rename call_mmap/mmap_prepare to vfs_mmap/mmap_prepare Lorenzo Stoakes via Linux-f2fs-devel
2025-06-17  5:10   ` Christoph Hellwig
2025-06-17  5:29     ` Lorenzo Stoakes via Linux-f2fs-devel
2025-06-17 18:57   ` Vlastimil Babka
2025-06-16 19:33 ` [f2fs-dev] [PATCH 02/10] mm/nommu: use file_has_valid_mmap_hooks() helper Lorenzo Stoakes via Linux-f2fs-devel
2025-06-17 10:05   ` Jan Kara
2025-06-17 18:58   ` Vlastimil Babka
2025-06-16 19:33 ` [f2fs-dev] [PATCH 03/10] fs: consistently " Lorenzo Stoakes via Linux-f2fs-devel
2025-06-16 20:01   ` Kees Cook via Linux-f2fs-devel
2025-06-17  5:11   ` Christoph Hellwig
2025-06-17  5:25     ` Lorenzo Stoakes via Linux-f2fs-devel
2025-06-17  5:29       ` Christoph Hellwig
2025-06-17 10:08       ` Jan Kara
2025-06-17 11:48         ` Christian Brauner via Linux-f2fs-devel
2025-06-16 19:33 ` [f2fs-dev] [PATCH 04/10] fs/dax: make it possible to check dev dax support without a VMA Lorenzo Stoakes via Linux-f2fs-devel
2025-06-16 20:26   ` Matthew Wilcox
2025-06-17 11:43     ` Christian Brauner via Linux-f2fs-devel
2025-06-16 19:33 ` [f2fs-dev] [PATCH 05/10] fs/ext4: transition from deprecated .mmap hook to .mmap_prepare Lorenzo Stoakes via Linux-f2fs-devel
2025-06-17 10:11   ` Jan Kara
2025-06-16 19:33 ` [f2fs-dev] [PATCH 06/10] fs/xfs: " Lorenzo Stoakes via Linux-f2fs-devel
2025-06-17  5:08   ` Christoph Hellwig
2025-06-17 11:45     ` Christian Brauner via Linux-f2fs-devel
2025-06-16 19:33 ` [f2fs-dev] [PATCH 07/10] mm/filemap: introduce generic_file_*_mmap_prepare() helpers Lorenzo Stoakes via Linux-f2fs-devel
2025-06-17 10:12   ` Jan Kara
2025-06-17 19:00   ` Vlastimil Babka
2025-06-16 19:33 ` [f2fs-dev] [PATCH 08/10] fs: convert simple use of generic_file_*_mmap() to .mmap_prepare() Lorenzo Stoakes via Linux-f2fs-devel
2025-06-16 23:26   ` Viacheslav Dubeyko via Linux-f2fs-devel
2025-06-17 10:14   ` Jan Kara
2025-06-17 14:07   ` Dave Kleikamp via Linux-f2fs-devel
2025-06-16 19:33 ` [f2fs-dev] [PATCH 09/10] fs: convert most other generic_file_*mmap() users " Lorenzo Stoakes via Linux-f2fs-devel
2025-06-17 10:23   ` Jan Kara
2025-06-17 11:54     ` Christian Brauner via Linux-f2fs-devel
2025-06-16 19:33 ` [f2fs-dev] [PATCH 10/10] fs: replace mmap hook with .mmap_prepare for simple mappings Lorenzo Stoakes via Linux-f2fs-devel
2025-06-16 22:51   ` Damien Le Moal via Linux-f2fs-devel
2025-06-16 23:24   ` Viacheslav Dubeyko via Linux-f2fs-devel
2025-06-17 10:28   ` Jan Kara
2025-06-17 11:57     ` Christian Brauner via Linux-f2fs-devel
2025-06-18 17:06   ` David Sterba
2025-06-19 17:47   ` Ryusuke Konishi
2025-06-16 19:56 ` [f2fs-dev] [PATCH 00/10] convert the majority of file systems to mmap_prepare Kent Overstreet
2025-06-16 20:41 ` Al Viro
2025-06-17 13:45   ` Jeff Layton via Linux-f2fs-devel
2025-06-17 13:46     ` Lorenzo Stoakes via Linux-f2fs-devel
2025-06-16 23:11 ` Andrew Morton
2025-06-17 11:31   ` Christian Brauner via Linux-f2fs-devel
2025-06-17 11:58 ` Christian Brauner via Linux-f2fs-devel
2025-06-17 14:05 ` David Howells via Linux-f2fs-devel
2025-06-17 14:17   ` Lorenzo Stoakes via Linux-f2fs-devel
2025-08-01 14:00 ` Jason Gunthorpe via Linux-f2fs-devel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).