Commit daa0fde
btrfs: zoned: fix data relocation block group reservation
btrfs_zoned_reserve_data_reloc_bg() is called on mount and at that point,
all data block groups belong to the primary data space_info. So, we don't
find anything in the data relocation space_info.
Also, the condition "bg->used > 0" can select a block group with full of
zone_unusable bytes for the candidate. As we cannot allocate from the block
group, it is useless to reserve it as the data relocation block group.
Furthermore, because of the space_info separation, we need to migrate the
selected block group to the data relocation space_info. If not, the extent
allocator cannot use the block group to do the allocation.
This commit fixes these three issues.
Fixes: e606ff985ec7 ("btrfs: zoned: reserve data_reloc block group on mount")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>1 parent f0ba0e7 commit daa0fde
1 file changed
+47
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
2519 | 2520 | | |
2520 | 2521 | | |
2521 | 2522 | | |
2522 | | - | |
| 2523 | + | |
2523 | 2524 | | |
2524 | 2525 | | |
2525 | 2526 | | |
2526 | 2527 | | |
2527 | | - | |
| 2528 | + | |
2528 | 2529 | | |
2529 | 2530 | | |
2530 | 2531 | | |
| |||
2538 | 2539 | | |
2539 | 2540 | | |
2540 | 2541 | | |
2541 | | - | |
2542 | 2542 | | |
2543 | 2543 | | |
2544 | 2544 | | |
2545 | | - | |
| 2545 | + | |
2546 | 2546 | | |
| 2547 | + | |
2547 | 2548 | | |
2548 | | - | |
| 2549 | + | |
2549 | 2550 | | |
2550 | 2551 | | |
2551 | | - | |
2552 | | - | |
| 2552 | + | |
| 2553 | + | |
2553 | 2554 | | |
2554 | 2555 | | |
2555 | 2556 | | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
2556 | 2588 | | |
2557 | 2589 | | |
2558 | 2590 | | |
| |||
2567 | 2599 | | |
2568 | 2600 | | |
2569 | 2601 | | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
2570 | 2605 | | |
2571 | 2606 | | |
2572 | 2607 | | |
| 2608 | + | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
2573 | 2613 | | |
2574 | | - | |
2575 | 2614 | | |
2576 | 2615 | | |
2577 | 2616 | | |
| |||
0 commit comments