gfs2 filesystem and dlm development
 help / color / mirror / Atom feed
* [PATCH] gfs2, udf: update to use mmap_prepare
@ 2025-09-02 11:53 Lorenzo Stoakes
  2025-09-02 12:34 ` Andreas Gruenbacher
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Lorenzo Stoakes @ 2025-09-02 11:53 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Andreas Gruenbacher, Jan Kara, gfs2, linux-fsdevel, linux-kernel

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


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

end of thread, other threads:[~2025-09-03 18:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-02 11:53 [PATCH] gfs2, udf: update to use mmap_prepare Lorenzo Stoakes
2025-09-02 12:34 ` Andreas Gruenbacher
2025-09-02 12:38   ` Lorenzo Stoakes
2025-09-02 13:29 ` Jan Kara
2025-09-03  3:43 ` kernel test robot
2025-09-03 18:00   ` Lorenzo Stoakes
2025-09-03  8:13 ` kernel test robot
2025-09-03 13:35   ` Lorenzo Stoakes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox