Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: improve blk_zone_wp_offset()

blk_zone_wp_offset() is always called with a struct blk_zone obtained
from the device, that is, it will never see the BLK_ZONE_COND_ACTIVE
condition. However, handling this condition makes this function more
solid and will also avoid issues when propagating cached report requests
to underlying stacked devices is implemented. Add BLK_ZONE_COND_ACTIVE
as a new case in blk_zone_wp_offset() switch.

Also while at it, change the handling of the full condition to return
UINT_MAX for the zone write pointer to reflect the fact that the write
pointer of a full zone is invalid.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Damien Le Moal and committed by
Jens Axboe
bbac6e0f 86a9ce21

+4 -4
+4 -4
block/blk-zoned.c
··· 800 800 case BLK_ZONE_COND_IMP_OPEN: 801 801 case BLK_ZONE_COND_EXP_OPEN: 802 802 case BLK_ZONE_COND_CLOSED: 803 + case BLK_ZONE_COND_ACTIVE: 803 804 return zone->wp - zone->start; 804 - case BLK_ZONE_COND_FULL: 805 - return zone->len; 806 805 case BLK_ZONE_COND_EMPTY: 807 806 return 0; 807 + case BLK_ZONE_COND_FULL: 808 808 case BLK_ZONE_COND_NOT_WP: 809 809 case BLK_ZONE_COND_OFFLINE: 810 810 case BLK_ZONE_COND_READONLY: 811 811 default: 812 812 /* 813 - * Conventional, offline and read-only zones do not have a valid 814 - * write pointer. 813 + * Conventional, full, offline and read-only zones do not have 814 + * a valid write pointer. 815 815 */ 816 816 return UINT_MAX; 817 817 }