If you use the exFAT file system for Linux, there is a significant optimization for deleting files with the "dirsync" set of mounting options. exFAT for Linux 5.12 should be able to delete large files much faster when running with the "dirsync" mount option. Improving file deletion will increase as the file size increases.
The patch is queued in the exFAT driver development tree. Reducing the time to delete files is done with less than 40 lines of code, (the cluster allocation bitmap is updated only when the buffer index changes).
Good news for those who use exFAT on Linux with active "dirsync", you have much faster deletion times with the Linux 5.12 kernel.
There are stressful update of cluster allocation bitmap when using dirsync mount option which is doing sync buffer on every cluster bit clearing. This could result in performance degradation when deleting big size file.
Fix to update only when the bitmap buffer index is changed would make less disk access, improving performance especially for truncate operation.
Testing with Samsung 256GB sdcard, mounted with dirsync option (mount -t exfat /dev/block/mmcblk0p1 /temp/mount -o dirsync)
Remove 4GB file, blktrace result.
[Before] : 39 secs.
Total (blktrace):
Reads Queued: 0, 0KiB Writes Queued: 32775, 16387KiB
Read Dispatches: 0, 0KiB Write Dispatches: 32775, 16387KiB
Reads Requeued: 0 Writes Requeued: 0
Reads Completed: 0, 0KiB Writes Completed: 32775, 16387KiB
Read Merges: 0, 0KiB Write Merges: 0, 0KiB
IO unplugs: 2 Timer unplugs: 0
[After] : 1 sec.
Total (blktrace):
Reads Queued: 0, 0KiB Writes Queued: 13, 6KiB
Read Dispatches: 0, 0KiB Write Dispatches: 13, 6KiB
Reads Requeued: 0 Writes Requeued: 0
Reads Completed: 0, 0KiB Writes Completed: 13, 6KiB
Read Merges: 0, 0KiB Write Merges: 0, 0KiB
IO unplugs: 1 Timer unplugs: 0
Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
</namjae.jeon@samsung.com></sj1557.seo@samsung.com></hyeongseok@gmail.com>