Thread (30 messages) 30 messages, 6 authors, 2019-03-28

Re: [PATCH 1/5] blk-mq: Export reading mq request state

From: Keith Busch <hidden>
Date: 2019-03-08 18:15:21
Also in: linux-nvme

On Fri, Mar 08, 2019 at 10:07:23AM -0800, Bart Van Assche wrote:
On Fri, 2019-03-08 at 10:40 -0700, Keith Busch wrote:
quoted
Drivers may need to know the state of their requets.
Hi Keith,

What makes you think that drivers should be able to check the state of their
requests? Please elaborate.
Patches 4 and 5 in this series.
 
quoted
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index faed9d9eb84c..db113aee48bb 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -241,6 +241,15 @@ struct request {
 	struct request *next_rq;
 };
 
+/**
+ * blk_mq_rq_state() - read the current MQ_RQ_* state of a request
+ * @rq: target request.
+ */
+static inline enum mq_rq_state blk_mq_rq_state(struct request *rq)
+{
+	return READ_ONCE(rq->state);
+}
Please also explain how drivers can use this function without triggering a
race condition with the code that modifies rq->state.
Either queisced or within a timeout handler that already locks the
request lifetime.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help