Hi, On 7/19/23 17:36, Fengnan Chang wrote:
In commit a015434480dc("ext4: send parallel discards on commit completions"), issue all discard commands in parallel make all bios could merged into one request, so lowlevel drive can issue multi segments in one time which is more efficiency, but commit 55cdd0af2bc5 ("ext4: get discard out of jbd2 commit kthread contex") seems broke this way, let's fix it. In my test, the time of fstrim fs with multi big sparse file reduce from 6.7s to 1.3s.
I tried with a 20T sparse file with latest kernel (6.5-rc2+ commit f7e3a1baf).
truncate -s 20T sparse1.img mkfs.ext4 sparse1.img mount -o discard sparse1.img /mnt/ time fstrim /mnt 1. without the patch [root@localhost ~]# time fstrim /mnt real 0m13.496s user 0m0.002s sys 0m5.202s 2. with the patch [root@localhost ~]# time fstrim /mnt real 0m15.956s user 0m0.000s sys 0m7.251s The result is different from your side, could you share your test? Thanks, Guoqing