Skip to content

Commit 63b5385

Browse files
damien-lemoalaxboe
authored andcommitted
block: Remove BLK_STS_ZONE_RESOURCE
The zone append emulation of the scsi disk driver was the only driver using BLK_STS_ZONE_RESOURCE. With this code removed, BLK_STS_ZONE_RESOURCE is now unused. Remove this macro definition and simplify blk_mq_dispatch_rq_list() where this status code was handled. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Tested-by: Hans Holmberg <hans.holmberg@wdc.com> Tested-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20240408014128.205141-20-dlemoal@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent d2a9b5f commit 63b5385

3 files changed

Lines changed: 4 additions & 43 deletions

File tree

block/blk-mq.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,19 +1921,6 @@ static void blk_mq_handle_dev_resource(struct request *rq,
19211921
__blk_mq_requeue_request(rq);
19221922
}
19231923

1924-
static void blk_mq_handle_zone_resource(struct request *rq,
1925-
struct list_head *zone_list)
1926-
{
1927-
/*
1928-
* If we end up here it is because we cannot dispatch a request to a
1929-
* specific zone due to LLD level zone-write locking or other zone
1930-
* related resource not being available. In this case, set the request
1931-
* aside in zone_list for retrying it later.
1932-
*/
1933-
list_add(&rq->queuelist, zone_list);
1934-
__blk_mq_requeue_request(rq);
1935-
}
1936-
19371924
enum prep_dispatch {
19381925
PREP_DISPATCH_OK,
19391926
PREP_DISPATCH_NO_TAG,
@@ -2019,7 +2006,6 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
20192006
struct request *rq;
20202007
int queued;
20212008
blk_status_t ret = BLK_STS_OK;
2022-
LIST_HEAD(zone_list);
20232009
bool needs_resource = false;
20242010

20252011
if (list_empty(list))
@@ -2061,23 +2047,11 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
20612047
case BLK_STS_DEV_RESOURCE:
20622048
blk_mq_handle_dev_resource(rq, list);
20632049
goto out;
2064-
case BLK_STS_ZONE_RESOURCE:
2065-
/*
2066-
* Move the request to zone_list and keep going through
2067-
* the dispatch list to find more requests the drive can
2068-
* accept.
2069-
*/
2070-
blk_mq_handle_zone_resource(rq, &zone_list);
2071-
needs_resource = true;
2072-
break;
20732050
default:
20742051
blk_mq_end_request(rq, ret);
20752052
}
20762053
} while (!list_empty(list));
20772054
out:
2078-
if (!list_empty(&zone_list))
2079-
list_splice_tail_init(&zone_list, list);
2080-
20812055
/* If we didn't flush the entire list, we could have told the driver
20822056
* there was more coming, but that turned out to be a lie.
20832057
*/

drivers/scsi/scsi_lib.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1870,7 +1870,6 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
18701870
case BLK_STS_OK:
18711871
break;
18721872
case BLK_STS_RESOURCE:
1873-
case BLK_STS_ZONE_RESOURCE:
18741873
if (scsi_device_blocked(sdev))
18751874
ret = BLK_STS_DEV_RESOURCE;
18761875
break;

include/linux/blk_types.h

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -136,26 +136,14 @@ typedef u16 blk_short_t;
136136
*/
137137
#define BLK_STS_DEV_RESOURCE ((__force blk_status_t)13)
138138

139-
/*
140-
* BLK_STS_ZONE_RESOURCE is returned from the driver to the block layer if zone
141-
* related resources are unavailable, but the driver can guarantee the queue
142-
* will be rerun in the future once the resources become available again.
143-
*
144-
* This is different from BLK_STS_DEV_RESOURCE in that it explicitly references
145-
* a zone specific resource and IO to a different zone on the same device could
146-
* still be served. Examples of that are zones that are write-locked, but a read
147-
* to the same zone could be served.
148-
*/
149-
#define BLK_STS_ZONE_RESOURCE ((__force blk_status_t)14)
150-
151139
/*
152140
* BLK_STS_ZONE_OPEN_RESOURCE is returned from the driver in the completion
153141
* path if the device returns a status indicating that too many zone resources
154142
* are currently open. The same command should be successful if resubmitted
155143
* after the number of open zones decreases below the device's limits, which is
156144
* reported in the request_queue's max_open_zones.
157145
*/
158-
#define BLK_STS_ZONE_OPEN_RESOURCE ((__force blk_status_t)15)
146+
#define BLK_STS_ZONE_OPEN_RESOURCE ((__force blk_status_t)14)
159147

160148
/*
161149
* BLK_STS_ZONE_ACTIVE_RESOURCE is returned from the driver in the completion
@@ -164,20 +152,20 @@ typedef u16 blk_short_t;
164152
* after the number of active zones decreases below the device's limits, which
165153
* is reported in the request_queue's max_active_zones.
166154
*/
167-
#define BLK_STS_ZONE_ACTIVE_RESOURCE ((__force blk_status_t)16)
155+
#define BLK_STS_ZONE_ACTIVE_RESOURCE ((__force blk_status_t)15)
168156

169157
/*
170158
* BLK_STS_OFFLINE is returned from the driver when the target device is offline
171159
* or is being taken offline. This could help differentiate the case where a
172160
* device is intentionally being shut down from a real I/O error.
173161
*/
174-
#define BLK_STS_OFFLINE ((__force blk_status_t)17)
162+
#define BLK_STS_OFFLINE ((__force blk_status_t)16)
175163

176164
/*
177165
* BLK_STS_DURATION_LIMIT is returned from the driver when the target device
178166
* aborted the command because it exceeded one of its Command Duration Limits.
179167
*/
180-
#define BLK_STS_DURATION_LIMIT ((__force blk_status_t)18)
168+
#define BLK_STS_DURATION_LIMIT ((__force blk_status_t)17)
181169

182170
/**
183171
* blk_path_error - returns true if error may be path related

0 commit comments

Comments
 (0)