configure: adapt to kernel 5.1

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
This commit is contained in:
Michal Rakowski 2019-07-22 14:02:16 +02:00
parent 18b879884e
commit 583deef8f6
7 changed files with 127 additions and 7 deletions

View File

@ -0,0 +1,31 @@
#!/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 "blk_end_request_all(NULL, 0)" "linux/blkdev.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_END_REQUEST_ALL blk_end_request_all" ;;
"2")
add_define "CAS_END_REQUEST_ALL blk_mq_end_request" ;;
*)
exit 1
esac
}
conf_run $@

View File

@ -0,0 +1,31 @@
#!/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 "blk_status_t t" "linux/blk_types.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_STATUS_T blk_status_t" ;;
"2")
add_define "CAS_BLK_STATUS_T int" ;;
*)
exit 1
esac
}
conf_run $@

View File

@ -9,12 +9,16 @@
check() {
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "vm_munmap(0, 0)" "linux/mm.h"
if compile_module $cur_name "vm_munmap(0, 0); MAP_PRIVATE;" "linux/mm.h"
then
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "do_munmap(NULL, 0)" "linux/mm.h"
then
echo $cur_name "2" >> $config_file_path
elif compile_module $cur_name "vm_munmap(0, 0); MAP_PRIVATE;" "linux/mm.h"\
"uapi/linux/mman.h"
then
echo $cur_name "3" >> $config_file_path
else
echo $cur_name "X" >> $config_file_path
fi
@ -50,6 +54,21 @@ apply() {
{
return do_munmap(current->mm, start, len);
}" ;;
"3")
add_function "
#include <uapi/asm-generic/mman-common.h>
#include <uapi/linux/mman.h>
static inline unsigned long cas_vm_mmap(struct file *file,
unsigned long addr, unsigned long len)
{
return vm_mmap(file, addr, len, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, 0);
}"
add_function "
static inline int cas_vm_munmap(unsigned long start, size_t len)
{
return vm_munmap(start, len);
}" ;;
*)
exit 1
esac

View File

@ -20,11 +20,11 @@ check() {
apply() {
case "$1" in
"1")
add_define "cas_queue_flag_set_unlocked(flag, request_queue) \\
add_define "CAS_QUEUE_FLAG_SET(flag, request_queue) \\
blk_queue_flag_set(flag, request_queue)" ;;
"2")
add_define "cas_queue_flag_set_unlocked(flag, request_queue) \\
queue_flag_set_unlocked(flag, request_queue)" ;;
add_define "CAS_QUEUE_FLAG_SET(flag, request_queue) \\
queue_flag_set(flag, request_queue)" ;;
*)
exit 1
esac

View File

@ -0,0 +1,38 @@
#!/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 request_queue *q; spin_lock_irq(q->queue_lock);"\
"linux/blkdev.h"
then
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "struct request_queue *q; spin_lock_irq(&q->queue_lock);"\
"linux/blkdev.h"
then
echo $cur_name "2" >> $config_file_path
else
echo $cur_name "X" >> $config_file_path
fi
}
apply() {
case "$1" in
"1")
add_define "CAS_QUEUE_SPIN_LOCK(q) spin_lock_irq(q->queue_lock)"
add_define "CAS_QUEUE_SPIN_UNLOCK(q) spin_unlock_irq(q->queue_lock)" ;;
"2")
add_define "CAS_QUEUE_SPIN_LOCK(q) spin_lock_irq(&q->queue_lock)"
add_define "CAS_QUEUE_SPIN_UNLOCK(q) spin_unlock_irq(&q->queue_lock)" ;;
*)
exit 1
esac
}
conf_run $@

View File

@ -29,6 +29,7 @@ static inline bool _blockdev_can_handle_rq(struct request *rq)
error = __LINE__;
if (unlikely(rq->next_rq))
if (unlikely(CAS_BIDI_RQ(rq)))
error = __LINE__;
if (error != 0) {
@ -686,7 +687,7 @@ static int _blockdev_prep_rq_fn(struct casdsk_disk *dsk, struct request_queue *q
atomic64_inc(&bvol->pending_rqs);
return BLKPREP_OK;
return CAS_BLKPREP_OK;
}
static int _blockdev_prepare_queue(struct casdsk_disk *dsk,

View File

@ -77,7 +77,7 @@ static int _casdsk_exp_obj_prep_rq_fn(struct request_queue *q, struct request *r
if (likely(dsk->exp_obj->ops && dsk->exp_obj->ops->prep_rq_fn))
return dsk->exp_obj->ops->prep_rq_fn(dsk, q, rq, dsk->private);
else
return BLKPREP_OK;
return CAS_BLKPREP_OK;
}
static void _casdsk_exp_obj_request_fn(struct request_queue *q)