]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - block/blk-mq.h
ARM: dts: add support for TX6S with LVDS output
[karo-tx-linux.git] / block / blk-mq.h
index de7b3bbd5bd61d203799cc24af2f8af3f2c6e396..26460884c6cd835202e90b2d5985c827495ca626 100644 (file)
@@ -69,4 +69,49 @@ struct blk_align_bitmap {
        unsigned long depth;
 } ____cacheline_aligned_in_smp;
 
+static inline struct blk_mq_ctx *__blk_mq_get_ctx(struct request_queue *q,
+                                          unsigned int cpu)
+{
+       return per_cpu_ptr(q->queue_ctx, cpu);
+}
+
+/*
+ * This assumes per-cpu software queueing queues. They could be per-node
+ * as well, for instance. For now this is hardcoded as-is. Note that we don't
+ * care about preemption, since we know the ctx's are persistent. This does
+ * mean that we can't rely on ctx always matching the currently running CPU.
+ */
+static inline struct blk_mq_ctx *blk_mq_get_ctx(struct request_queue *q)
+{
+       return __blk_mq_get_ctx(q, get_cpu());
+}
+
+static inline void blk_mq_put_ctx(struct blk_mq_ctx *ctx)
+{
+       put_cpu();
+}
+
+struct blk_mq_alloc_data {
+       /* input parameter */
+       struct request_queue *q;
+       gfp_t gfp;
+       bool reserved;
+
+       /* input & output parameter */
+       struct blk_mq_ctx *ctx;
+       struct blk_mq_hw_ctx *hctx;
+};
+
+static inline void blk_mq_set_alloc_data(struct blk_mq_alloc_data *data,
+               struct request_queue *q, gfp_t gfp, bool reserved,
+               struct blk_mq_ctx *ctx,
+               struct blk_mq_hw_ctx *hctx)
+{
+       data->q = q;
+       data->gfp = gfp;
+       data->reserved = reserved;
+       data->ctx = ctx;
+       data->hctx = hctx;
+}
+
 #endif