Commit 29459c3
block: Fix zone write plugging handling of devices with a runt zone
A zoned device may have a last sequential write required zone that is
smaller than other zones. However, all tests to check if a zone write
plug write offset exceeds the zone capacity use the same capacity
value stored in the gendisk zone_capacity field. This is incorrect for a
zoned device with a last runt (smaller) zone.
Add the new field last_zone_capacity to struct gendisk to store the
capacity of the last zone of the device. blk_revalidate_seq_zone() and
blk_revalidate_conv_zone() are both modified to get this value when
disk_zone_is_last() returns true. Similarly to zone_capacity, the value
is first stored using the last_zone_capacity field of struct
blk_revalidate_zone_args. Once zone revalidation of all zones is done,
this is used to set the gendisk last_zone_capacity field.
The checks to determine if a zone is full or if a sector offset in a
zone exceeds the zone capacity in disk_should_remove_zone_wplug(),
disk_zone_wplug_abort_unaligned(), blk_zone_write_plug_init_request(),
and blk_zone_wplug_prepare_bio() are modified to use the new helper
functions disk_zone_is_full() and disk_zone_wplug_is_full().
disk_zone_is_full() uses the zone index to determine if the zone being
tested is the last one of the disk and uses the either the disk
zone_capacity or last_zone_capacity accordingly.
Fixes: dd291d7 ("block: Introduce zone write plugging")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20240530054035.491497-4-dlemoal@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent cd63999 commit 29459c3
2 files changed
+28
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
458 | 472 | | |
459 | 473 | | |
460 | 474 | | |
| |||
548 | 562 | | |
549 | 563 | | |
550 | 564 | | |
551 | | - | |
| 565 | + | |
552 | 566 | | |
553 | 567 | | |
554 | 568 | | |
| |||
669 | 683 | | |
670 | 684 | | |
671 | 685 | | |
672 | | - | |
673 | 686 | | |
674 | 687 | | |
675 | 688 | | |
676 | 689 | | |
677 | 690 | | |
678 | | - | |
| 691 | + | |
679 | 692 | | |
680 | 693 | | |
681 | 694 | | |
| |||
914 | 927 | | |
915 | 928 | | |
916 | 929 | | |
917 | | - | |
918 | 930 | | |
919 | 931 | | |
920 | 932 | | |
| |||
938 | 950 | | |
939 | 951 | | |
940 | 952 | | |
941 | | - | |
| 953 | + | |
942 | 954 | | |
943 | 955 | | |
944 | 956 | | |
| |||
984 | 996 | | |
985 | 997 | | |
986 | 998 | | |
987 | | - | |
| 999 | + | |
988 | 1000 | | |
989 | 1001 | | |
990 | 1002 | | |
| |||
1561 | 1573 | | |
1562 | 1574 | | |
1563 | 1575 | | |
| 1576 | + | |
1564 | 1577 | | |
1565 | 1578 | | |
1566 | 1579 | | |
| |||
1605 | 1618 | | |
1606 | 1619 | | |
1607 | 1620 | | |
| 1621 | + | |
1608 | 1622 | | |
1609 | 1623 | | |
1610 | 1624 | | |
| |||
1622 | 1636 | | |
1623 | 1637 | | |
1624 | 1638 | | |
| 1639 | + | |
1625 | 1640 | | |
1626 | 1641 | | |
1627 | 1642 | | |
| |||
1673 | 1688 | | |
1674 | 1689 | | |
1675 | 1690 | | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
1676 | 1694 | | |
1677 | 1695 | | |
1678 | 1696 | | |
| |||
1703 | 1721 | | |
1704 | 1722 | | |
1705 | 1723 | | |
1706 | | - | |
1707 | | - | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
1708 | 1727 | | |
1709 | 1728 | | |
1710 | 1729 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| |||
0 commit comments