Re: [PATCH 03/13] block: handle zone management operations completions

Damien Le Moal
2025-11-03T06:25:18Z

On 11/1/25 03:01, Bart Van Assche wrote:
> On 10/30/25 11:12 PM, Damien Le Moal wrote:
>> +void blk_zone_mgmt_bio_endio(struct bio *bio)
>> +{
>> + /* If the BIO failed, we have nothing to do. */
>> + if (bio->bi_status != BLK_STS_OK)
>> + return;
>> +
>> + switch (bio_op(bio)) {
>> + case REQ_OP_ZONE_RESET:
>> + blk_zone_reset_bio_endio(bio);
>> + return;
>> + case REQ_OP_ZONE_RESET_ALL:
>> + blk_zone_reset_all_bio_endio(bio);
>> + return;
>> + case REQ_OP_ZONE_FINISH:
>> + blk_zone_finish_bio_endio(bio);
>> + return;
>> + default:
>> + return;
>> + }
>> }
>
> "default: return;" is superfluous and can be left out.

No, it is needed. Otherwise, with GCC 15.2.1, I get:

block/blk-zoned.c: In function ‘blk_zone_mgmt_bio_endio’:
block/blk-zoned.c:778:9: error: enumeration value ‘REQ_OP_READ’ not handled in
switch [-Werror=switch]
778 | switch (bio_op(bio)) {
| ^~~~~~
block/blk-zoned.c:778:9: error: enumeration value ‘REQ_OP_WRITE’ not handled in
switch [-Werror=switch]
block/blk-zoned.c:778:9: error: enumeration value ‘REQ_OP_FLUSH’ not handled in
switch [-Werror=switch]
block/blk-zoned.c:778:9: error: enumeration value ‘REQ_OP_DISCARD’ not handled
in switch [-Werror=switch]
block/blk-zoned.c:778:9: error: enumeration value ‘REQ_OP_SECURE_ERASE’ not
handled in switch [-Werror=switch]
block/blk-zoned.c:778:9: error: enumeration value ‘REQ_OP_ZONE_APPEND’ not
handled in switch [-Werror=switch]
block/blk-zoned.c:778:9: error: enumeration value ‘REQ_OP_WRITE_ZEROES’ not
handled in switch [-Werror=switch]
block/blk-zoned.c:778:9: error: enumeration value ‘REQ_OP_ZONE_OPEN’ not handled
in switch [-Werror=switch]
block/blk-zoned.c:778:9: error: enumeration value ‘REQ_OP_ZONE_CLOSE’ not
handled in switch [-Werror=switch]
block/blk-zoned.c:778:9: error: enumeration value ‘REQ_OP_DRV_IN’ not handled in
switch [-Werror=switch]
block/blk-zoned.c:778:9: error: enumeration value ‘REQ_OP_DRV_OUT’ not handled
in switch [-Werror=switch]
block/blk-zoned.c:778:9: error: enumeration value ‘REQ_OP_LAST’ not handled in
switch [-Werror=switch]

--
Damien Le Moal
Western Digital Research