block: Remove BLK_STS_ZONE_RESOURCE
authorDamien Le Moal <dlemoal@kernel.org>
Mon, 8 Apr 2024 01:41:19 +0000 (10:41 +0900)
committerJens Axboe <axboe@kernel.dk>
Wed, 17 Apr 2024 14:44:03 +0000 (08:44 -0600)
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>
block/blk-mq.c
drivers/scsi/scsi_lib.c
include/linux/blk_types.h

index 6f9cc1c4d4fb32de68d92a513325bff2923af785..9f2d9970eeba0b2fbc4d660d9a893073c8390908 100644 (file)
@@ -1921,19 +1921,6 @@ static void blk_mq_handle_dev_resource(struct request *rq,
        __blk_mq_requeue_request(rq);
 }
 
-static void blk_mq_handle_zone_resource(struct request *rq,
-                                       struct list_head *zone_list)
-{
-       /*
-        * If we end up here it is because we cannot dispatch a request to a
-        * specific zone due to LLD level zone-write locking or other zone
-        * related resource not being available. In this case, set the request
-        * aside in zone_list for retrying it later.
-        */
-       list_add(&rq->queuelist, zone_list);
-       __blk_mq_requeue_request(rq);
-}
-
 enum prep_dispatch {
        PREP_DISPATCH_OK,
        PREP_DISPATCH_NO_TAG,
@@ -2019,7 +2006,6 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
        struct request *rq;
        int queued;
        blk_status_t ret = BLK_STS_OK;
-       LIST_HEAD(zone_list);
        bool needs_resource = false;
 
        if (list_empty(list))
@@ -2061,23 +2047,11 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
                case BLK_STS_DEV_RESOURCE:
                        blk_mq_handle_dev_resource(rq, list);
                        goto out;
-               case BLK_STS_ZONE_RESOURCE:
-                       /*
-                        * Move the request to zone_list and keep going through
-                        * the dispatch list to find more requests the drive can
-                        * accept.
-                        */
-                       blk_mq_handle_zone_resource(rq, &zone_list);
-                       needs_resource = true;
-                       break;
                default:
                        blk_mq_end_request(rq, ret);
                }
        } while (!list_empty(list));
 out:
-       if (!list_empty(&zone_list))
-               list_splice_tail_init(&zone_list, list);
-
        /* If we didn't flush the entire list, we could have told the driver
         * there was more coming, but that turned out to be a lie.
         */
index 2e28e2360c85740d0b3ebb391785ee111c78d47b..9ca96116bd3325c0df08b528c996079b78569b72 100644 (file)
@@ -1870,7 +1870,6 @@ out_put_budget:
        case BLK_STS_OK:
                break;
        case BLK_STS_RESOURCE:
-       case BLK_STS_ZONE_RESOURCE:
                if (scsi_device_blocked(sdev))
                        ret = BLK_STS_DEV_RESOURCE;
                break;
index 29b3170431e72932f68b4893450f3462d9c0138b..ffe0c112b128826a18aaf1718b254587a89a58d4 100644 (file)
@@ -136,18 +136,6 @@ typedef u16 blk_short_t;
  */
 #define BLK_STS_DEV_RESOURCE   ((__force blk_status_t)13)
 
-/*
- * BLK_STS_ZONE_RESOURCE is returned from the driver to the block layer if zone
- * related resources are unavailable, but the driver can guarantee the queue
- * will be rerun in the future once the resources become available again.
- *
- * This is different from BLK_STS_DEV_RESOURCE in that it explicitly references
- * a zone specific resource and IO to a different zone on the same device could
- * still be served. Examples of that are zones that are write-locked, but a read
- * to the same zone could be served.
- */
-#define BLK_STS_ZONE_RESOURCE  ((__force blk_status_t)14)
-
 /*
  * BLK_STS_ZONE_OPEN_RESOURCE is returned from the driver in the completion
  * path if the device returns a status indicating that too many zone resources
@@ -155,7 +143,7 @@ typedef u16 blk_short_t;
  * after the number of open zones decreases below the device's limits, which is
  * reported in the request_queue's max_open_zones.
  */
-#define BLK_STS_ZONE_OPEN_RESOURCE     ((__force blk_status_t)15)
+#define BLK_STS_ZONE_OPEN_RESOURCE     ((__force blk_status_t)14)
 
 /*
  * BLK_STS_ZONE_ACTIVE_RESOURCE is returned from the driver in the completion
@@ -164,20 +152,20 @@ typedef u16 blk_short_t;
  * after the number of active zones decreases below the device's limits, which
  * is reported in the request_queue's max_active_zones.
  */
-#define BLK_STS_ZONE_ACTIVE_RESOURCE   ((__force blk_status_t)16)
+#define BLK_STS_ZONE_ACTIVE_RESOURCE   ((__force blk_status_t)15)
 
 /*
  * BLK_STS_OFFLINE is returned from the driver when the target device is offline
  * or is being taken offline. This could help differentiate the case where a
  * device is intentionally being shut down from a real I/O error.
  */
-#define BLK_STS_OFFLINE                ((__force blk_status_t)17)
+#define BLK_STS_OFFLINE                ((__force blk_status_t)16)
 
 /*
  * BLK_STS_DURATION_LIMIT is returned from the driver when the target device
  * aborted the command because it exceeded one of its Command Duration Limits.
  */
-#define BLK_STS_DURATION_LIMIT ((__force blk_status_t)18)
+#define BLK_STS_DURATION_LIMIT ((__force blk_status_t)17)
 
 /**
  * blk_path_error - returns true if error may be path related