Re: [PATCH 08/10] fs: convert simple use of generic_file_*_mmap() to .mmap_prepare()

Dave Kleikamp
2025-06-17T15:02:42Z

On 6/16/25 2:33PM, Lorenzo Stoakes wrote:
> Since commit c84bf6dd2b83 ("mm: introduce new .mmap_prepare() file
> callback"), the f_op->mmap() hook has been deprecated in favour of
> f_op->mmap_prepare().
>
> We have provided generic .mmap_prepare() equivalents, so update all file
> systems that specify these directly in their file_operations structures.
>
> This updates 9p, adfs, affs, bfs, fat, hfs, hfsplus, hostfs, hpfs, jffs2,
> jfs, minix, omfs, ramfs and ufs file systems directly.
>
> It updates generic_ro_fops which impacts qnx4, cramfs, befs, squashfs,
> frebxfs, qnx6, efs, romfs, erofs and isofs file systems.
>
> There are remaining file systems which use generic hooks in a less direct
> way which we address in a subsequent commit.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

For JFS,

Acked-by: Dave Kleikamp <dave.kleikamp@oracle.com>

> ---
> fs/9p/vfs_file.c | 2 +-
> fs/adfs/file.c | 2 +-
> fs/affs/file.c | 2 +-
> fs/bfs/file.c | 2 +-
> 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/omfs/file.c | 2 +-
> fs/ramfs/file-mmu.c | 2 +-
> fs/read_write.c | 2 +-
> fs/ufs/file.c | 2 +-
> 16 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
> index 348cc90bf9c5..2ff3e0ac7266 100644
> --- a/fs/9p/vfs_file.c
> +++ b/fs/9p/vfs_file.c
> @@ -516,7 +516,7 @@ const struct file_operations v9fs_file_operations = {
> .open = v9fs_file_open,
> .release = v9fs_dir_release,
> .lock = v9fs_file_lock,
> - .mmap = generic_file_readonly_mmap,
> + .mmap_prepare = generic_file_readonly_mmap_prepare,
> .splice_read = v9fs_file_splice_read,
> .splice_write = iter_file_splice_write,
> .fsync = v9fs_file_fsync,
> diff --git a/fs/adfs/file.c b/fs/adfs/file.c
> index ee80718aaeec..cd13165fd904 100644
> --- a/fs/adfs/file.c
> +++ b/fs/adfs/file.c
> @@ -25,7 +25,7 @@
> const struct file_operations adfs_file_operations = {
> .llseek = generic_file_llseek,
> .read_iter = generic_file_read_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .fsync = generic_file_fsync,
> .write_iter = generic_file_write_iter,
> .splice_read = filemap_splice_read,
> diff --git a/fs/affs/file.c b/fs/affs/file.c
> index 7a71018e3f67..fbac204b7055 100644
> --- a/fs/affs/file.c
> +++ b/fs/affs/file.c
> @@ -999,7 +999,7 @@ const struct file_operations affs_file_operations = {
> .llseek = generic_file_llseek,
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .open = affs_file_open,
> .release = affs_file_release,
> .fsync = affs_file_fsync,
> diff --git a/fs/bfs/file.c b/fs/bfs/file.c
> index fa66a09e496a..6685c3411fe7 100644
> --- a/fs/bfs/file.c
> +++ b/fs/bfs/file.c
> @@ -27,7 +27,7 @@ const struct file_operations bfs_file_operations = {
> .llseek = generic_file_llseek,
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .splice_read = filemap_splice_read,
> };
>
> diff --git a/fs/fat/file.c b/fs/fat/file.c
> index e887e9ab7472..4fc49a614fb8 100644
> --- a/fs/fat/file.c
> +++ b/fs/fat/file.c
> @@ -204,7 +204,7 @@ const struct file_operations fat_file_operations = {
> .llseek = generic_file_llseek,
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .release = fat_file_release,
> .unlocked_ioctl = fat_generic_ioctl,
> .compat_ioctl = compat_ptr_ioctl,
> diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
> index a81ce7a740b9..d419586d668d 100644
> --- a/fs/hfs/inode.c
> +++ b/fs/hfs/inode.c
> @@ -690,7 +690,7 @@ static const struct file_operations hfs_file_operations = {
> .llseek = generic_file_llseek,
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .splice_read = filemap_splice_read,
> .fsync = hfs_file_fsync,
> .open = hfs_file_open,
> diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
> index f331e9574217..0af7e302730c 100644
> --- a/fs/hfsplus/inode.c
> +++ b/fs/hfsplus/inode.c
> @@ -366,7 +366,7 @@ static const struct file_operations hfsplus_file_operations = {
> .llseek = generic_file_llseek,
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .splice_read = filemap_splice_read,
> .fsync = hfsplus_file_fsync,
> .open = hfsplus_file_open,
> diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
> index 702c41317589..bc22b6cc72af 100644
> --- a/fs/hostfs/hostfs_kern.c
> +++ b/fs/hostfs/hostfs_kern.c
> @@ -382,7 +382,7 @@ static const struct file_operations hostfs_file_fops = {
> .splice_write = iter_file_splice_write,
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .open = hostfs_open,
> .release = hostfs_file_release,
> .fsync = hostfs_fsync,
> diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
> index 449a3fc1b8d9..a1a44e3edb19 100644
> --- a/fs/hpfs/file.c
> +++ b/fs/hpfs/file.c
> @@ -255,7 +255,7 @@ const struct file_operations hpfs_file_ops =
> .llseek = generic_file_llseek,
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .release = hpfs_file_release,
> .fsync = hpfs_file_fsync,
> .splice_read = filemap_splice_read,
> diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
> index 13c18ccc13b0..1e05f7fe5dd4 100644
> --- a/fs/jffs2/file.c
> +++ b/fs/jffs2/file.c
> @@ -54,7 +54,7 @@ const struct file_operations jffs2_file_operations =
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> .unlocked_ioctl=jffs2_ioctl,
> - .mmap = generic_file_readonly_mmap,
> + .mmap_prepare = generic_file_readonly_mmap_prepare,
> .fsync = jffs2_fsync,
> .splice_read = filemap_splice_read,
> .splice_write = iter_file_splice_write,
> diff --git a/fs/jfs/file.c b/fs/jfs/file.c
> index 01b6912e60f8..5e47951db630 100644
> --- a/fs/jfs/file.c
> +++ b/fs/jfs/file.c
> @@ -143,7 +143,7 @@ const struct file_operations jfs_file_operations = {
> .llseek = generic_file_llseek,
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .splice_read = filemap_splice_read,
> .splice_write = iter_file_splice_write,
> .fsync = jfs_fsync,
> diff --git a/fs/minix/file.c b/fs/minix/file.c
> index 906d192ab7f3..dca7ac71f049 100644
> --- a/fs/minix/file.c
> +++ b/fs/minix/file.c
> @@ -17,7 +17,7 @@ const struct file_operations minix_file_operations = {
> .llseek = generic_file_llseek,
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .fsync = generic_file_fsync,
> .splice_read = filemap_splice_read,
> };
> diff --git a/fs/omfs/file.c b/fs/omfs/file.c
> index 98358d405b6a..319c04e63964 100644
> --- a/fs/omfs/file.c
> +++ b/fs/omfs/file.c
> @@ -332,7 +332,7 @@ const struct file_operations omfs_file_operations = {
> .llseek = generic_file_llseek,
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .fsync = generic_file_fsync,
> .splice_read = filemap_splice_read,
> };
> diff --git a/fs/ramfs/file-mmu.c b/fs/ramfs/file-mmu.c
> index b45c7edc3225..b11f5b20b78b 100644
> --- a/fs/ramfs/file-mmu.c
> +++ b/fs/ramfs/file-mmu.c
> @@ -41,7 +41,7 @@ static unsigned long ramfs_mmu_get_unmapped_area(struct file *file,
> const struct file_operations ramfs_file_operations = {
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .fsync = noop_fsync,
> .splice_read = filemap_splice_read,
> .splice_write = iter_file_splice_write,
> diff --git a/fs/read_write.c b/fs/read_write.c
> index 0ef70e128c4a..80fdab99f9e4 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -28,7 +28,7 @@
> const struct file_operations generic_ro_fops = {
> .llseek = generic_file_llseek,
> .read_iter = generic_file_read_iter,
> - .mmap = generic_file_readonly_mmap,
> + .mmap_prepare = generic_file_readonly_mmap_prepare,
> .splice_read = filemap_splice_read,
> };
>
> diff --git a/fs/ufs/file.c b/fs/ufs/file.c
> index 487ad1fc2de6..c2a391c17df7 100644
> --- a/fs/ufs/file.c
> +++ b/fs/ufs/file.c
> @@ -38,7 +38,7 @@ const struct file_operations ufs_file_operations = {
> .llseek = generic_file_llseek,
> .read_iter = generic_file_read_iter,
> .write_iter = generic_file_write_iter,
> - .mmap = generic_file_mmap,
> + .mmap_prepare = generic_file_mmap_prepare,
> .open = generic_file_open,
> .fsync = generic_file_fsync,
> .splice_read = filemap_splice_read,