fs/gfs2/file.c | 12 ++++++------ fs/udf/file.c | 8 +++++--- 2 files changed, 11 insertions(+), 9 deletions(-)
The f_op->mmap() callback is deprecated, and we are in the process of
slowly converting users to f_op->mmap_prepare().
While some filesystems require additional work to be done before they can
be converted, the gfs2 and udf filesystems (like most) are simple and can
simply be replaced right away.
This patch adapts them to do so.
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
fs/gfs2/file.c | 12 ++++++------
fs/udf/file.c | 8 +++++---
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index bc67fa058c84..c28ff8786238 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -577,7 +577,7 @@ static const struct vm_operations_struct gfs2_vm_ops = {
};
/**
- * gfs2_mmap
+ * gfs2_mmap_prepare
* @file: The file to map
* @vma: The VMA which described the mapping
*
@@ -588,8 +588,9 @@ static const struct vm_operations_struct gfs2_vm_ops = {
* Returns: 0
*/
-static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
+static int gfs2_mmap_prepare(struct vm_area_desc *desc)
{
+ struct file *file = desc->file;
struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
if (!(file->f_flags & O_NOATIME) &&
@@ -605,7 +606,7 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
gfs2_glock_dq_uninit(&i_gh);
file_accessed(file);
}
- vma->vm_ops = &gfs2_vm_ops;
+ desc->vm_ops = &gfs2_vm_ops;
return 0;
}
@@ -1585,7 +1586,7 @@ const struct file_operations gfs2_file_fops = {
.iopoll = iocb_bio_iopoll,
.unlocked_ioctl = gfs2_ioctl,
.compat_ioctl = gfs2_compat_ioctl,
- .mmap = gfs2_mmap,
+ .mmap_prepare = gfs2_mmap,
.open = gfs2_open,
.release = gfs2_release,
.fsync = gfs2_fsync,
@@ -1620,7 +1621,7 @@ const struct file_operations gfs2_file_fops_nolock = {
.iopoll = iocb_bio_iopoll,
.unlocked_ioctl = gfs2_ioctl,
.compat_ioctl = gfs2_compat_ioctl,
- .mmap = gfs2_mmap,
+ .mmap_prepare = gfs2_mmap_prepare,
.open = gfs2_open,
.release = gfs2_release,
.fsync = gfs2_fsync,
@@ -1639,4 +1640,3 @@ const struct file_operations gfs2_dir_fops_nolock = {
.fsync = gfs2_fsync,
.llseek = default_llseek,
};
-
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 0d76c4f37b3e..fbb2d6ba8ca2 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -189,10 +189,12 @@ static int udf_release_file(struct inode *inode, struct file *filp)
return 0;
}
-static int udf_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int udf_file_mmap_prepare(struct vm_area_desc *desc)
{
+ struct file *file = desc->file;
+
file_accessed(file);
- vma->vm_ops = &udf_file_vm_ops;
+ desc->vm_ops = &udf_file_vm_ops;
return 0;
}
@@ -201,7 +203,7 @@ const struct file_operations udf_file_operations = {
.read_iter = generic_file_read_iter,
.unlocked_ioctl = udf_ioctl,
.open = generic_file_open,
- .mmap = udf_file_mmap,
+ .mmap_prepare = udf_file_mmap_prepare,
.write_iter = udf_file_write_iter,
.release = udf_release_file,
.fsync = generic_file_fsync,
--
2.50.1
Hi Lorenzo, kernel test robot noticed the following build errors: [auto build test ERROR on brauner-vfs/vfs.all] [also build test ERROR on gfs2/for-next linus/master v6.17-rc4 next-20250902] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Lorenzo-Stoakes/gfs2-udf-update-to-use-mmap_prepare/20250902-200024 base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all patch link: https://lore.kernel.org/r/20250902115341.292100-1-lorenzo.stoakes%40oracle.com patch subject: [PATCH] gfs2, udf: update to use mmap_prepare config: x86_64-randconfig-005-20250903 (https://download.01.org/0day-ci/archive/20250903/202509031521.aEPzyTZp-lkp@intel.com/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250903/202509031521.aEPzyTZp-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202509031521.aEPzyTZp-lkp@intel.com/ All errors (new ones prefixed by >>): >> fs/gfs2/file.c:1582:18: error: use of undeclared identifier 'gfs2_mmap'; did you mean 'vfs_mmap'? 1582 | .mmap_prepare = gfs2_mmap, | ^~~~~~~~~ | vfs_mmap include/linux/fs.h:2393:19: note: 'vfs_mmap' declared here 2393 | static inline int vfs_mmap(struct file *file, struct vm_area_struct *vma) | ^ >> fs/gfs2/file.c:1582:18: error: incompatible function pointer types initializing 'int (*)(struct vm_area_desc *)' with an expression of type 'int (struct file *, struct vm_area_struct *)' [-Wincompatible-function-pointer-types] 1582 | .mmap_prepare = gfs2_mmap, | ^~~~~~~~~ 2 errors generated. vim +1582 fs/gfs2/file.c 1574 1575 const struct file_operations gfs2_file_fops = { 1576 .llseek = gfs2_llseek, 1577 .read_iter = gfs2_file_read_iter, 1578 .write_iter = gfs2_file_write_iter, 1579 .iopoll = iocb_bio_iopoll, 1580 .unlocked_ioctl = gfs2_ioctl, 1581 .compat_ioctl = gfs2_compat_ioctl, > 1582 .mmap_prepare = gfs2_mmap, 1583 .open = gfs2_open, 1584 .release = gfs2_release, 1585 .fsync = gfs2_fsync, 1586 .lock = gfs2_lock, 1587 .flock = gfs2_flock, 1588 .splice_read = copy_splice_read, 1589 .splice_write = gfs2_file_splice_write, 1590 .setlease = simple_nosetlease, 1591 .fallocate = gfs2_fallocate, 1592 .fop_flags = FOP_ASYNC_LOCK, 1593 }; 1594 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
On Wed, Sep 03, 2025 at 04:13:42PM +0800, kernel test robot wrote: > Hi Lorenzo, > > kernel test robot noticed the following build errors: > > [auto build test ERROR on brauner-vfs/vfs.all] > [also build test ERROR on gfs2/for-next linus/master v6.17-rc4 next-20250902] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Lorenzo-Stoakes/gfs2-udf-update-to-use-mmap_prepare/20250902-200024 > base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all > patch link: https://lore.kernel.org/r/20250902115341.292100-1-lorenzo.stoakes%40oracle.com > patch subject: [PATCH] gfs2, udf: update to use mmap_prepare > config: x86_64-randconfig-005-20250903 (https://download.01.org/0day-ci/archive/20250903/202509031521.aEPzyTZp-lkp@intel.com/config) > compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250903/202509031521.aEPzyTZp-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202509031521.aEPzyTZp-lkp@intel.com/ > > All errors (new ones prefixed by >>): > > >> fs/gfs2/file.c:1582:18: error: use of undeclared identifier 'gfs2_mmap'; did you mean 'vfs_mmap'? > 1582 | .mmap_prepare = gfs2_mmap, > | ^~~~~~~~~ > | vfs_mmap > include/linux/fs.h:2393:19: note: 'vfs_mmap' declared here > 2393 | static inline int vfs_mmap(struct file *file, struct vm_area_struct *vma) > | ^ > >> fs/gfs2/file.c:1582:18: error: incompatible function pointer types initializing 'int (*)(struct vm_area_desc *)' with an expression of type 'int (struct file *, struct vm_area_struct *)' [-Wincompatible-function-pointer-types] > 1582 | .mmap_prepare = gfs2_mmap, Yeah silly typo, to make life easier will send v2.
Hi Lorenzo, kernel test robot noticed the following build warnings: [auto build test WARNING on brauner-vfs/vfs.all] [also build test WARNING on gfs2/for-next linus/master v6.17-rc4 next-20250902] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Lorenzo-Stoakes/gfs2-udf-update-to-use-mmap_prepare/20250902-200024 base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all patch link: https://lore.kernel.org/r/20250902115341.292100-1-lorenzo.stoakes%40oracle.com patch subject: [PATCH] gfs2, udf: update to use mmap_prepare config: x86_64-randconfig-004-20250903 (https://download.01.org/0day-ci/archive/20250903/202509031109.QugeBzTq-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250903/202509031109.QugeBzTq-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202509031109.QugeBzTq-lkp@intel.com/ All warnings (new ones prefixed by >>): >> Warning: fs/gfs2/file.c:591 function parameter 'desc' not described in 'gfs2_mmap_prepare' -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
On Wed, Sep 03, 2025 at 11:43:13AM +0800, kernel test robot wrote: > Hi Lorenzo, > > kernel test robot noticed the following build warnings: > > [auto build test WARNING on brauner-vfs/vfs.all] > [also build test WARNING on gfs2/for-next linus/master v6.17-rc4 next-20250902] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Lorenzo-Stoakes/gfs2-udf-update-to-use-mmap_prepare/20250902-200024 > base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all > patch link: https://lore.kernel.org/r/20250902115341.292100-1-lorenzo.stoakes%40oracle.com > patch subject: [PATCH] gfs2, udf: update to use mmap_prepare > config: x86_64-randconfig-004-20250903 (https://download.01.org/0day-ci/archive/20250903/202509031109.QugeBzTq-lkp@intel.com/config) > compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0 > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250903/202509031109.QugeBzTq-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202509031109.QugeBzTq-lkp@intel.com/ > > All warnings (new ones prefixed by >>): > > >> Warning: fs/gfs2/file.c:591 function parameter 'desc' not described in 'gfs2_mmap_prepare' Fixing in respin. > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki
On Tue 02-09-25 12:53:41, Lorenzo Stoakes wrote: > The f_op->mmap() callback is deprecated, and we are in the process of > slowly converting users to f_op->mmap_prepare(). > > While some filesystems require additional work to be done before they can > be converted, the gfs2 and udf filesystems (like most) are simple and can > simply be replaced right away. > > This patch adapts them to do so. > > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Looks good to me. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > fs/gfs2/file.c | 12 ++++++------ > fs/udf/file.c | 8 +++++--- > 2 files changed, 11 insertions(+), 9 deletions(-) > > diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c > index bc67fa058c84..c28ff8786238 100644 > --- a/fs/gfs2/file.c > +++ b/fs/gfs2/file.c > @@ -577,7 +577,7 @@ static const struct vm_operations_struct gfs2_vm_ops = { > }; > > /** > - * gfs2_mmap > + * gfs2_mmap_prepare > * @file: The file to map > * @vma: The VMA which described the mapping > * > @@ -588,8 +588,9 @@ static const struct vm_operations_struct gfs2_vm_ops = { > * Returns: 0 > */ > > -static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) > +static int gfs2_mmap_prepare(struct vm_area_desc *desc) > { > + struct file *file = desc->file; > struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); > > if (!(file->f_flags & O_NOATIME) && > @@ -605,7 +606,7 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) > gfs2_glock_dq_uninit(&i_gh); > file_accessed(file); > } > - vma->vm_ops = &gfs2_vm_ops; > + desc->vm_ops = &gfs2_vm_ops; > > return 0; > } > @@ -1585,7 +1586,7 @@ const struct file_operations gfs2_file_fops = { > .iopoll = iocb_bio_iopoll, > .unlocked_ioctl = gfs2_ioctl, > .compat_ioctl = gfs2_compat_ioctl, > - .mmap = gfs2_mmap, > + .mmap_prepare = gfs2_mmap, > .open = gfs2_open, > .release = gfs2_release, > .fsync = gfs2_fsync, > @@ -1620,7 +1621,7 @@ const struct file_operations gfs2_file_fops_nolock = { > .iopoll = iocb_bio_iopoll, > .unlocked_ioctl = gfs2_ioctl, > .compat_ioctl = gfs2_compat_ioctl, > - .mmap = gfs2_mmap, > + .mmap_prepare = gfs2_mmap_prepare, > .open = gfs2_open, > .release = gfs2_release, > .fsync = gfs2_fsync, > @@ -1639,4 +1640,3 @@ const struct file_operations gfs2_dir_fops_nolock = { > .fsync = gfs2_fsync, > .llseek = default_llseek, > }; > - > diff --git a/fs/udf/file.c b/fs/udf/file.c > index 0d76c4f37b3e..fbb2d6ba8ca2 100644 > --- a/fs/udf/file.c > +++ b/fs/udf/file.c > @@ -189,10 +189,12 @@ static int udf_release_file(struct inode *inode, struct file *filp) > return 0; > } > > -static int udf_file_mmap(struct file *file, struct vm_area_struct *vma) > +static int udf_file_mmap_prepare(struct vm_area_desc *desc) > { > + struct file *file = desc->file; > + > file_accessed(file); > - vma->vm_ops = &udf_file_vm_ops; > + desc->vm_ops = &udf_file_vm_ops; > > return 0; > } > @@ -201,7 +203,7 @@ const struct file_operations udf_file_operations = { > .read_iter = generic_file_read_iter, > .unlocked_ioctl = udf_ioctl, > .open = generic_file_open, > - .mmap = udf_file_mmap, > + .mmap_prepare = udf_file_mmap_prepare, > .write_iter = udf_file_write_iter, > .release = udf_release_file, > .fsync = generic_file_fsync, > -- > 2.50.1 > -- Jan Kara <jack@suse.com> SUSE Labs, CR
On Tue, Sep 2, 2025 at 1:53 PM Lorenzo Stoakes <lorenzo.stoakes@oracle.com> wrote: > The f_op->mmap() callback is deprecated, and we are in the process of > slowly converting users to f_op->mmap_prepare(). > > While some filesystems require additional work to be done before they can > be converted, the gfs2 and udf filesystems (like most) are simple and can > simply be replaced right away. > > This patch adapts them to do so. > > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> > --- > fs/gfs2/file.c | 12 ++++++------ > fs/udf/file.c | 8 +++++--- > 2 files changed, 11 insertions(+), 9 deletions(-) > > diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c > index bc67fa058c84..c28ff8786238 100644 > --- a/fs/gfs2/file.c > +++ b/fs/gfs2/file.c > @@ -577,7 +577,7 @@ static const struct vm_operations_struct gfs2_vm_ops = { > }; > > /** > - * gfs2_mmap > + * gfs2_mmap_prepare > * @file: The file to map > * @vma: The VMA which described the mapping > * > @@ -588,8 +588,9 @@ static const struct vm_operations_struct gfs2_vm_ops = { > * Returns: 0 > */ > > -static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) > +static int gfs2_mmap_prepare(struct vm_area_desc *desc) > { > + struct file *file = desc->file; > struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); > > if (!(file->f_flags & O_NOATIME) && > @@ -605,7 +606,7 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) > gfs2_glock_dq_uninit(&i_gh); > file_accessed(file); > } > - vma->vm_ops = &gfs2_vm_ops; > + desc->vm_ops = &gfs2_vm_ops; > > return 0; > } > @@ -1585,7 +1586,7 @@ const struct file_operations gfs2_file_fops = { > .iopoll = iocb_bio_iopoll, > .unlocked_ioctl = gfs2_ioctl, > .compat_ioctl = gfs2_compat_ioctl, > - .mmap = gfs2_mmap, > + .mmap_prepare = gfs2_mmap, This ought to be: .mmap_prepare = gfs2_mmap_prepare, > .open = gfs2_open, > .release = gfs2_release, > .fsync = gfs2_fsync, > @@ -1620,7 +1621,7 @@ const struct file_operations gfs2_file_fops_nolock = { > .iopoll = iocb_bio_iopoll, > .unlocked_ioctl = gfs2_ioctl, > .compat_ioctl = gfs2_compat_ioctl, > - .mmap = gfs2_mmap, > + .mmap_prepare = gfs2_mmap_prepare, > .open = gfs2_open, > .release = gfs2_release, > .fsync = gfs2_fsync, > @@ -1639,4 +1640,3 @@ const struct file_operations gfs2_dir_fops_nolock = { > .fsync = gfs2_fsync, > .llseek = default_llseek, > }; > - > diff --git a/fs/udf/file.c b/fs/udf/file.c > index 0d76c4f37b3e..fbb2d6ba8ca2 100644 > --- a/fs/udf/file.c > +++ b/fs/udf/file.c > @@ -189,10 +189,12 @@ static int udf_release_file(struct inode *inode, struct file *filp) > return 0; > } > > -static int udf_file_mmap(struct file *file, struct vm_area_struct *vma) > +static int udf_file_mmap_prepare(struct vm_area_desc *desc) > { > + struct file *file = desc->file; > + > file_accessed(file); > - vma->vm_ops = &udf_file_vm_ops; > + desc->vm_ops = &udf_file_vm_ops; > > return 0; > } > @@ -201,7 +203,7 @@ const struct file_operations udf_file_operations = { > .read_iter = generic_file_read_iter, > .unlocked_ioctl = udf_ioctl, > .open = generic_file_open, > - .mmap = udf_file_mmap, > + .mmap_prepare = udf_file_mmap_prepare, > .write_iter = udf_file_write_iter, > .release = udf_release_file, > .fsync = generic_file_fsync, > -- > 2.50.1 > Thanks, Andreas
On Tue, Sep 02, 2025 at 02:34:15PM +0200, Andreas Gruenbacher wrote: > > diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c > > index bc67fa058c84..c28ff8786238 100644 > > --- a/fs/gfs2/file.c > > +++ b/fs/gfs2/file.c > > @@ -577,7 +577,7 @@ static const struct vm_operations_struct gfs2_vm_ops = { > > }; > > > > /** > > - * gfs2_mmap > > + * gfs2_mmap_prepare > > * @file: The file to map > > * @vma: The VMA which described the mapping > > * > > @@ -588,8 +588,9 @@ static const struct vm_operations_struct gfs2_vm_ops = { > > * Returns: 0 > > */ > > > > -static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) > > +static int gfs2_mmap_prepare(struct vm_area_desc *desc) > > { > > + struct file *file = desc->file; > > struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); > > > > if (!(file->f_flags & O_NOATIME) && > > @@ -605,7 +606,7 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) > > gfs2_glock_dq_uninit(&i_gh); > > file_accessed(file); > > } > > - vma->vm_ops = &gfs2_vm_ops; > > + desc->vm_ops = &gfs2_vm_ops; > > > > return 0; > > } > > @@ -1585,7 +1586,7 @@ const struct file_operations gfs2_file_fops = { > > .iopoll = iocb_bio_iopoll, > > .unlocked_ioctl = gfs2_ioctl, > > .compat_ioctl = gfs2_compat_ioctl, > > - .mmap = gfs2_mmap, > > + .mmap_prepare = gfs2_mmap, > > This ought to be: > .mmap_prepare = gfs2_mmap_prepare, Apologies, I missed this one (didn't set CONFIG_GFS2_FS_LOCKING_DLM in testing). Christian - since this is trivial, could you fix up? Thanks!
© 2016 - 2025 Red Hat, Inc.