FROMGIT: exfat: fdatasync flag should be same like generic_write_sync()

Test: androbench by default setting, use 64GB sdcard.
 the random write speed:
	without this patch 3.5MB/s
	with this patch 7MB/s

After patch "11a347fb6cef", the random write speed decreased
significantly.the .write_iter() interface had been modified, and check
the differences with generic_file_write_iter(), when calling
generic_write_sync() and exfat_file_write_iter() to call
vfs_fsync_range(), the fdatasync flag is wrong, and make not use the
fdatasync mode, and make random write speed decreased.

So use generic_write_sync() instead of vfs_fsync_range().

Fixes: 11a347fb6cef ("exfat: change to get file size from DataLength")

Bug: 427084532
(cherry picked from commit 309914e6602c9e17ff84b20db8c4f1da0d6a2a36
https://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat.git
dev)
Link: https://lore.kernel.org/all/20250619013331.664521-1-zhengxu.zhang@unisoc.com/
Change-Id: I68319a27cabedd9d4a7fa35948affd8c27d72160
Signed-off-by: Zhengxu Zhang <zhengxu.zhang@unisoc.com>
Acked-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
Zhengxu Zhang
2025-06-12 09:14:21 +08:00
committed by Treehugger Robot
parent 789dd354a8
commit 46e269016e

View File

@@ -610,9 +610,8 @@ static ssize_t exfat_file_write_iter(struct kiocb *iocb, struct iov_iter *iter)
if (pos > valid_size)
pos = valid_size;
if (iocb_is_dsync(iocb) && iocb->ki_pos > pos) {
ssize_t err = vfs_fsync_range(file, pos, iocb->ki_pos - 1,
iocb->ki_flags & IOCB_SYNC);
if (iocb->ki_pos > pos) {
ssize_t err = generic_write_sync(iocb, iocb->ki_pos - pos);
if (err < 0)
return err;
}