Commit 636bd62
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>1 parent 63193eb commit 636bd62
1 file changed
Lines changed: 37 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
35 | 46 | | |
36 | 47 | | |
37 | 48 | | |
| |||
62 | 73 | | |
63 | 74 | | |
64 | 75 | | |
65 | | - | |
66 | | - | |
| 76 | + | |
| 77 | + | |
67 | 78 | | |
68 | | - | |
69 | 79 | | |
70 | 80 | | |
71 | | - | |
| 81 | + | |
| 82 | + | |
72 | 83 | | |
73 | 84 | | |
74 | 85 | | |
75 | 86 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
79 | 96 | | |
80 | 97 | | |
81 | 98 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 99 | + | |
| 100 | + | |
85 | 101 | | |
86 | 102 | | |
87 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
88 | 110 | | |
89 | 111 | | |
90 | 112 | | |
| |||
170 | 192 | | |
171 | 193 | | |
172 | 194 | | |
| 195 | + | |
173 | 196 | | |
174 | 197 | | |
175 | 198 | | |
| |||
183 | 206 | | |
184 | 207 | | |
185 | 208 | | |
186 | | - | |
| 209 | + | |
187 | 210 | | |
188 | 211 | | |
189 | 212 | | |
190 | 213 | | |
191 | 214 | | |
192 | | - | |
| 215 | + | |
193 | 216 | | |
| 217 | + | |
| 218 | + | |
194 | 219 | | |
195 | 220 | | |
196 | 221 | | |
| |||
0 commit comments