Commit 673dcd2
authored
perf(ext4): batch nojournal range allocation (#2135)
* perf(ext4): batch nojournal range allocation
CubeSandbox tmp writes on nojournal ext4 allocated and published every missing 4 KiB block independently. Each block synchronously rewrote allocation metadata, zeroed data, and updated the inode, keeping virtio-blk at queue depth one and amplifying fixed request latency.
Add a bounded DirectRangeStage for depth-zero contiguous appends. Plan allocation metadata in transaction-private images, bulk-zero the complete range, enforce a reliable pre-publication flush, and publish bitmap, group descriptor, superblock, and inode homes in semantic order. Runtime failures restore allocation homes when safe and poison the direct backend when inode state or rollback durability is uncertain.
Add fallible DMA/BIO construction, exact block I/O completion handling, bounded contiguous ext4 block transfers, and compile-time-disabled block/ext4 diagnostic counters. Preserve journaled, fragmented, sparse, small-write, unsupported-flush, and resource-pressure behavior through explicit legacy fallbacks.
Cover extent validation, unwritten tails, allocation bounds, zero and flush failures, every allocation-home failure, rollback failures, inode uncertainty, and transaction snapshot ownership. The nojournal crash contract remains unchanged: abnormal power loss still requires fsck.
Validation: make fmt; cargo test --manifest-path kernel/crates/another_ext4/Cargo.toml --lib; RUST_MIN_STACK=33554432 make kernel; local nojournal ext4 hash and e2fsck; CubeSandbox fresh-volume A1/B/A2 performance and hash checks.
Signed-off-by: longjin <longjin@dragonos.org>
* fix(ext4): address direct range review findings
Make nojournal direct-range publication flush allocation metadata before writing the inode home block. If the durability barrier fails, restore and flush every allocation home; poison the backend when rollback durability cannot be established. Add fault-injection coverage for the new ordering and failure states.
Keep coherent DMA memory in the normal write-back direct mapping instead of changing RAM cache attributes without architecture cache maintenance. Reject unsupported non-coherent cache policies explicitly, removing partial multi-page remaps and TLB shootdowns from allocation and interrupt-context release paths.
Prune expired ext4 statistics registry entries during mount registration so repeated mount/unmount cycles do not retain dead Weak control blocks.
Signed-off-by: longjin <longjin@dragonos.org>
* fix(io): address direct range review findings
Classify nojournal direct-range candidates under the compatible metadata gate before requesting an exclusive transaction snapshot. Unsupported small, overwrite, sparse, and oversized writes now continue directly through the legacy allocator, while real candidates are re-read and revalidated after exclusive acquisition to avoid stale plans.
Restore zero-length virtio-blk synchronous I/O semantics by returning Ok(0) before buffer validation or BIO submission. Keep zero-length read/write BIOs invalid as an internal submission invariant.
Add direct-range eligibility coverage for the optimized and legacy request shapes.
Signed-off-by: longjin <longjin@dragonos.org>
---------
Signed-off-by: longjin <longjin@dragonos.org>1 parent 7383e9a commit 673dcd2
21 files changed
Lines changed: 2139 additions & 150 deletions
File tree
- kernel
- crates/another_ext4/src
- ext4_defs
- ext4
- src
- debug
- sysfs
- driver
- base/block
- block
- filesystem/ext4
- mm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
7 | 15 | | |
8 | 16 | | |
9 | 17 | | |
| |||
71 | 79 | | |
72 | 80 | | |
73 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
74 | 211 | | |
75 | 212 | | |
76 | 213 | | |
| |||
764 | 901 | | |
765 | 902 | | |
766 | 903 | | |
| 904 | + | |
767 | 905 | | |
768 | 906 | | |
769 | 907 | | |
| |||
785 | 923 | | |
786 | 924 | | |
787 | 925 | | |
| 926 | + | |
788 | 927 | | |
789 | 928 | | |
790 | 929 | | |
| |||
844 | 983 | | |
845 | 984 | | |
846 | 985 | | |
| 986 | + | |
847 | 987 | | |
848 | 988 | | |
849 | 989 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
29 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
30 | 127 | | |
31 | 128 | | |
32 | 129 | | |
| |||
74 | 171 | | |
75 | 172 | | |
76 | 173 | | |
| 174 | + | |
77 | 175 | | |
78 | 176 | | |
79 | 177 | | |
| |||
345 | 443 | | |
346 | 444 | | |
347 | 445 | | |
| 446 | + | |
348 | 447 | | |
349 | 448 | | |
350 | 449 | | |
| |||
862 | 961 | | |
863 | 962 | | |
864 | 963 | | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
865 | 973 | | |
866 | 974 | | |
867 | 975 | | |
| |||
1000 | 1108 | | |
1001 | 1109 | | |
1002 | 1110 | | |
| 1111 | + | |
1003 | 1112 | | |
1004 | 1113 | | |
1005 | 1114 | | |
| |||
1031 | 1140 | | |
1032 | 1141 | | |
1033 | 1142 | | |
| 1143 | + | |
1034 | 1144 | | |
1035 | 1145 | | |
1036 | 1146 | | |
| |||
1092 | 1202 | | |
1093 | 1203 | | |
1094 | 1204 | | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
1095 | 1235 | | |
1096 | 1236 | | |
1097 | 1237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
153 | 158 | | |
154 | 159 | | |
155 | 160 | | |
| |||
199 | 204 | | |
200 | 205 | | |
201 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
202 | 218 | | |
203 | 219 | | |
204 | 220 | | |
| |||
0 commit comments