]> www.infradead.org Git - users/hch/block.git/commitdiff
block: add a helper to cancel atomic queue limit updates
authorChristoph Hellwig <hch@lst.de>
Wed, 27 Mar 2024 11:09:46 +0000 (12:09 +0100)
committerChristoph Hellwig <hch@lst.de>
Tue, 9 Apr 2024 05:37:12 +0000 (07:37 +0200)
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>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
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
  */