Commit d2311e6
btrfs: relocation: Delay reloc tree deletion after merge_reloc_roots
Relocation code will drop btrfs_root::reloc_root as soon as
merge_reloc_root() finishes.
However later qgroup code will need to access btrfs_root::reloc_root
after merge_reloc_root() for delayed subtree rescan.
So alter the timming of resetting btrfs_root:::reloc_root, make it
happens after transaction commit.
With this patch, we will introduce a new btrfs_root::state,
BTRFS_ROOT_DEAD_RELOC_TREE, to info part of btrfs_root::reloc_tree user
that although btrfs_root::reloc_tree is still non-NULL, but still it's
not used any more.
The lifespan of btrfs_root::reloc tree will become:
Old behavior | New
------------------------------------------------------------------------
btrfs_init_reloc_root() --- | btrfs_init_reloc_root() ---
set reloc_root | | set reloc_root |
| | |
| | |
merge_reloc_root() | | merge_reloc_root() |
|- btrfs_update_reloc_root() --- | |- btrfs_update_reloc_root() -+-
clear btrfs_root::reloc_root | set ROOT_DEAD_RELOC_TREE |
| record root into dirty |
| roots rbtree |
| |
| reloc_block_group() Or |
| btrfs_recover_relocation() |
| | After transaction commit |
| |- clean_dirty_subvols() ---
| clear btrfs_root::reloc_root
During ROOT_DEAD_RELOC_TREE set lifespan, the only user of
btrfs_root::reloc_tree should be qgroup.
Since reloc root needs a longer life-span, this patch will also delay
btrfs_drop_snapshot() call.
Now btrfs_drop_snapshot() is called in clean_dirty_subvols().
This patch will increase the size of btrfs_root by 16 bytes.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>1 parent 119e80d commit d2311e6
3 files changed
Lines changed: 84 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1199 | 1199 | | |
1200 | 1200 | | |
1201 | 1201 | | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
1202 | 1209 | | |
1203 | 1210 | | |
1204 | 1211 | | |
| |||
1311 | 1318 | | |
1312 | 1319 | | |
1313 | 1320 | | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
1314 | 1329 | | |
1315 | 1330 | | |
1316 | 1331 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1176 | 1176 | | |
1177 | 1177 | | |
1178 | 1178 | | |
| 1179 | + | |
1179 | 1180 | | |
1180 | 1181 | | |
1181 | 1182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
| |||
1467 | 1469 | | |
1468 | 1470 | | |
1469 | 1471 | | |
1470 | | - | |
| 1472 | + | |
| 1473 | + | |
1471 | 1474 | | |
1472 | 1475 | | |
1473 | 1476 | | |
1474 | 1477 | | |
1475 | 1478 | | |
| 1479 | + | |
1476 | 1480 | | |
1477 | 1481 | | |
1478 | | - | |
| 1482 | + | |
1479 | 1483 | | |
1480 | 1484 | | |
1481 | 1485 | | |
| |||
2120 | 2124 | | |
2121 | 2125 | | |
2122 | 2126 | | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
2123 | 2179 | | |
2124 | 2180 | | |
2125 | 2181 | | |
| |||
2258 | 2314 | | |
2259 | 2315 | | |
2260 | 2316 | | |
2261 | | - | |
2262 | | - | |
2263 | | - | |
2264 | | - | |
2265 | | - | |
2266 | | - | |
2267 | | - | |
| 2317 | + | |
| 2318 | + | |
2268 | 2319 | | |
2269 | 2320 | | |
2270 | 2321 | | |
| |||
2409 | 2460 | | |
2410 | 2461 | | |
2411 | 2462 | | |
2412 | | - | |
2413 | | - | |
2414 | | - | |
2415 | | - | |
2416 | | - | |
2417 | | - | |
2418 | | - | |
2419 | | - | |
2420 | 2463 | | |
2421 | 2464 | | |
2422 | 2465 | | |
| |||
4078 | 4121 | | |
4079 | 4122 | | |
4080 | 4123 | | |
| 4124 | + | |
| 4125 | + | |
| 4126 | + | |
4081 | 4127 | | |
4082 | 4128 | | |
4083 | 4129 | | |
| |||
4172 | 4218 | | |
4173 | 4219 | | |
4174 | 4220 | | |
| 4221 | + | |
4175 | 4222 | | |
4176 | 4223 | | |
4177 | 4224 | | |
| |||
4467 | 4514 | | |
4468 | 4515 | | |
4469 | 4516 | | |
| 4517 | + | |
| 4518 | + | |
| 4519 | + | |
| 4520 | + | |
4470 | 4521 | | |
4471 | 4522 | | |
4472 | 4523 | | |
| |||
0 commit comments