[Devel] [PATCH vz10 v3 01/11] ext4: minor cleanup in ext4_mfsync

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 22 22:14:07 MSK 2025


From: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

 * Use actual fd member shift in ext4_ioc_mfsync_info instead of
   hardcoded sizeof(__u32).
 * Add some spaces and new lines for readability.

Fixes: 26337aacaafa9 ("ext4: add mfsync support")
https://virtuozzo.atlassian.net/browse/VSTOR-107255
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

Feature: ext4: optimized sync of a set of files - mfsync()
---
 fs/ext4/ioctl.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 66923dd1ddd4a..738ed4d8cf5e6 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -1292,6 +1292,7 @@ static int ext4_mfsync(unsigned long arg)
 
 	if (!ve_is_super(get_exec_env()))
 		return -ENOTSUPP;
+
 	if (copy_from_user(&mfsync, (struct ext4_ioc_mfsync_info *)arg,
 			   sizeof(mfsync)))
 		return -EFAULT;
@@ -1301,7 +1302,7 @@ static int ext4_mfsync(unsigned long arg)
 	if (mfsync.size > NR_FILE)
 		return -ENFILE;
 
-	usr_fd = (__u32 __user *) (arg + sizeof(__u32));
+	usr_fd = (__u32 __user *)&((struct ext4_ioc_mfsync_info *)arg)->fd[0];
 
 	filpp = kzalloc(mfsync.size * sizeof(*filpp), GFP_KERNEL);
 	if (!filpp)
@@ -1311,6 +1312,7 @@ static int ext4_mfsync(unsigned long arg)
 		kfree(filpp);
 		return -ENOMEM;
 	}
+
 	for (i = 0; i < mfsync.size; i++) {
 		int fd;
 		int ret;
@@ -1321,8 +1323,8 @@ static int ext4_mfsync(unsigned long arg)
 			goto mfsync_fput;
 
 		/* negative fd means fdata_sync */
-		flags[i] = (fd & (1<< 31)) != 0;
-		fd &= ~(1<< 31);
+		flags[i] = (fd & (1 << 31)) != 0;
+		fd &= ~(1 << 31);
 
 		err = -EBADF;
 		filpp[i] = fget(fd);
-- 
2.43.0



More information about the Devel mailing list