From f015dea5399731dd07c50c58f842e713b60b041b Mon Sep 17 00:00:00 2001 From: Michal Rakowski Date: Tue, 10 Sep 2019 16:05:32 +0200 Subject: [PATCH] cas_disk: Add mandatory blk_mq_ops filed required by some kernels Signed-off-by: Michal Rakowski --- configure.d/1_blk_mq.conf | 32 ++++++++++++++++++++++++++++++++ modules/cas_disk/exp_obj.c | 7 +++++-- 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 configure.d/1_blk_mq.conf diff --git a/configure.d/1_blk_mq.conf b/configure.d/1_blk_mq.conf new file mode 100644 index 0000000..df49e84 --- /dev/null +++ b/configure.d/1_blk_mq.conf @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright(c) 2012-2019 Intel Corporation +# SPDX-License-Identifier: BSD-3-Clause-Clear +# + +. $(dirname $3)/conf_framework + +check() { + cur_name=$(basename $2) + config_file_path=$1 + if compile_module $cur_name "struct blk_mq_ops ops; ops.map_queue;" "linux/blk-mq.h" + then + echo $cur_name "1" >> $config_file_path + else + echo $cur_name "2" >> $config_file_path + fi +} + +apply() { + case "$1" in + "1") + add_define "CAS_BLK_MQ_OPS_MAP_QUEUE" ;; + "2") + return 0 ;; + + *) + exit 1 + esac +} + +conf_run $@ diff --git a/modules/cas_disk/exp_obj.c b/modules/cas_disk/exp_obj.c index 79e0bae..da536ac 100644 --- a/modules/cas_disk/exp_obj.c +++ b/modules/cas_disk/exp_obj.c @@ -428,7 +428,7 @@ static int _casdsk_exp_obj_init_kobject(struct casdsk_disk *dsk) return result; } -static CAS_BLK_STATUS_T _casdsk_exp_obj_queue_qr(struct blk_mq_hw_ctx *hctx, +static CAS_BLK_STATUS_T _casdsk_exp_obj_queue_rq(struct blk_mq_hw_ctx *hctx, const struct blk_mq_queue_data *bd) { struct casdsk_disk *dsk = hctx->driver_data; @@ -456,7 +456,10 @@ static CAS_BLK_STATUS_T _casdsk_exp_obj_queue_qr(struct blk_mq_hw_ctx *hctx, } static struct blk_mq_ops casdsk_mq_ops = { - .queue_rq = _casdsk_exp_obj_queue_qr, + .queue_rq = _casdsk_exp_obj_queue_rq, +#ifdef CAS_BLK_MQ_OPS_MAP_QUEUE + .map_queue = blk_mq_map_queue, +#endif }; static void _casdsk_init_queues(struct casdsk_disk *dsk)