scsi: block: Add a helper to cancel atomic queue limit updates
authorChristoph Hellwig <hch@lst.de>
Tue, 9 Apr 2024 14:37:26 +0000 (16:37 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 12 Apr 2024 01:37:48 +0000 (21:37 -0400)
Drivers might have to perform complex actions to determine queue limits,
and those might fail.  Add a helper to cancel a queue limit update that can
be called in those cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20240409143748.980206-2-hch@lst.de
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
include/linux/blkdev.h

index c3e8f7cf96be9e1c10169d2e7afe31696082eb8f..ded7f66dc4b9643fa968c24fd3885b0cd1a4e0c8 100644 (file)
@@ -892,6 +892,19 @@ int queue_limits_commit_update(struct request_queue *q,
                struct queue_limits *lim);
 int queue_limits_set(struct request_queue *q, struct queue_limits *lim);
 
+/**
+ * queue_limits_cancel_update - cancel an atomic update of queue limits
+ * @q:         queue to update
+ *
+ * This functions cancels an atomic update of the queue limits started by
+ * queue_limits_start_update() and should be used when an error occurs after
+ * starting update.
+ */
+static inline void queue_limits_cancel_update(struct request_queue *q)
+{
+       mutex_unlock(&q->limits_lock);
+}
+
 /*
  * Access functions for manipulating queue properties
  */