]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
exfat: optimize exfat_chain_cont_cluster with cached buffer heads
authorChi Zhiling <chizhiling@kylinos.cn>
Tue, 3 Mar 2026 03:14:08 +0000 (11:14 +0800)
committerNamjae Jeon <linkinjeon@kernel.org>
Thu, 5 Mar 2026 12:09:32 +0000 (21:09 +0900)
commit636bd62299aea24684086d126ea88b23a6466f8e
tree259f34a76d28626be13cdd599b9f52240ea082de
parent63193eb4452d3bf5b2b71042c536cb51c7d786cb
exfat: optimize exfat_chain_cont_cluster with cached buffer heads

When converting files from NO_FAT_CHAIN to FAT_CHAIN format, profiling
reveals significant time spent in mark_buffer_dirty() and exfat_mirror_bh()
operations. This overhead occurs because each FAT entry modification
triggers a full block dirty marking and mirroring operation.

For consecutive clusters that reside in the same block, optimize by caching
the buffer head and performing dirty marking only once at the end of the
block's modifications.

Performance improvements for converting a 30GB file:

| Cluster Size | Before Patch | After Patch | Speedup |
|--------------|--------------|-------------|---------|
| 512 bytes    | 4.243s       | 1.866s      | 2.27x   |
| 4KB          | 0.863s       | 0.236s      | 3.66x   |
| 32KB         | 0.069s       | 0.034s      | 2.03x   |
| 256KB        | 0.012s       | 0.006s      | 2.00x   |

Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
fs/exfat/fatent.c