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@xxxxxxxxxx> Looks good to me. Feel free to add: Reviewed-by: Jan Kara <jack@xxxxxxx> 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@xxxxxxxx> SUSE Labs, CR