在 2022/02/25 10:40, Ming Lei 写道:
+static inline struct blk_mq_hw_ctx *queue_hctx(struct request_queue *q, int id)
+{
+ struct blk_mq_hw_ctx *hctx;
+
+ rcu_read_lock();
+ hctx = *(rcu_dereference(q->queue_hw_ctx) + id);
+ rcu_read_unlock();
+
+ return hctx;
+}
queue_hctx() should be moved into linux/blk-mq.h, otherwise feel free to
add:
Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx>
Thanks for the review, I will send a new patch and move queue_hctx.
Kuai
Also it should be fine to implement queue_for_each_hw_ctx() as list, then we
can avoid the allocation for q->queue_hw_ctx without extra cost. I will work
toward that direction for improving the code.
Thanks,
Ming
.