Open CAS Linux kernel 5.18 support
This patch introduces the support for 5.18 kernel. Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
This commit is contained in:
45
configure.d/1_add_disk.conf
Normal file
45
configure.d/1_add_disk.conf
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
. $(dirname $3)/conf_framework.sh
|
||||
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "int t=add_disk(NULL);" "linux/blkdev.h" ||
|
||||
compile_module $cur_name "int t=add_disk(NULL);" "linux/genhd.h"
|
||||
then
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
elif compile_module $cur_name "add_disk(NULL);" "linux/genhd.h"
|
||||
then
|
||||
echo $cur_name "2" >> $config_file_path
|
||||
else
|
||||
echo $cur_name "X" >> $config_file_path
|
||||
fi
|
||||
}
|
||||
|
||||
apply() {
|
||||
case "$1" in
|
||||
"1")
|
||||
add_function "
|
||||
static inline int cas_add_disk(struct gendisk *gd)
|
||||
{
|
||||
return add_disk(gd);
|
||||
}" ;;
|
||||
|
||||
"2")
|
||||
add_function "
|
||||
static inline int cas_add_disk(struct gendisk *gd)
|
||||
{
|
||||
add_disk(gd);
|
||||
return 0;
|
||||
}" ;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
conf_run $@
|
||||
@@ -9,7 +9,8 @@
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "struct gendisk *disk = NULL; struct xarray xa; xa = disk->part_tbl;" "linux/genhd.h"
|
||||
if compile_module $cur_name "struct gendisk *disk = NULL; struct xarray xa; xa = disk->part_tbl;" "linux/genhd.h" ||
|
||||
compile_module $cur_name "struct gendisk *disk = NULL; struct xarray xa; xa = disk->part_tbl;" "linux/blkdev.h"
|
||||
then
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
elif compile_module $cur_name "struct block_device bd; bd = *disk_part_iter_next(NULL);" "linux/blk_types.h"
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "struct gendisk *disk = NULL; struct xarray xa; xa = disk->part_tbl;" "linux/genhd.h"
|
||||
if compile_module $cur_name "struct gendisk *disk = NULL; struct xarray xa; xa = disk->part_tbl;" "linux/blkdev.h" ||
|
||||
compile_module $cur_name "struct gendisk *disk = NULL; struct xarray xa; xa = disk->part_tbl;" "linux/genhd.h"
|
||||
then
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
elif compile_module $cur_name "struct gendisk *disk = NULL; struct disk_part_tbl *ptbl; ptbl = disk->part_tbl;" "linux/genhd.h"
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "bdev_nr_sectors(NULL);" "linux/genhd.h"
|
||||
|
||||
if compile_module $cur_name "bdev_nr_sectors(NULL);" "linux/blkdev.h" || compile_module $cur_name "bdev_nr_sectors(NULL);" "linux/genhd.h"
|
||||
then
|
||||
echo $cur_name 1 >> $config_file_path
|
||||
elif compile_module $cur_name "struct block_device *bd; bd->bd_part->nr_sects;" "linux/blk_types.h" "linux/genhd.h"
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "struct block_device *bd; bdev_whole(bd);" "linux/blk_types.h" "linux/genhd.h"
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "struct block_device *bd; bdev_whole(bd);" "linux/blk_types.h" "linux/genhd.h" ||
|
||||
compile_module $cur_name "struct block_device *bd; bdev_whole(bd);" "linux/blk_types.h" "linux/blkdev.h"
|
||||
then
|
||||
echo $cur_name 1 >> $config_file_path
|
||||
elif compile_module $cur_name "struct block_device *bd; bd->bd_contains;" "linux/blk_types.h" "linux/fs.h"
|
||||
|
||||
43
configure.d/1_bio_alloc.conf
Normal file
43
configure.d/1_bio_alloc.conf
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
. $(dirname $3)/conf_framework.sh
|
||||
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "void *t=bio_alloc(0,0);" "linux/bio.h"
|
||||
then
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
elif compile_module $cur_name "void *t=bio_alloc(NULL,0,0,0);" "linux/bio.h"
|
||||
then
|
||||
echo $cur_name "2" >> $config_file_path
|
||||
else
|
||||
echo $cur_name "X" >> $config_file_path
|
||||
fi
|
||||
}
|
||||
|
||||
apply() {
|
||||
case "$1" in
|
||||
"1")
|
||||
add_function "static inline struct bio *cas_bio_alloc(struct block_device *bdev, gfp_t gfp_mask, unsigned short num_vecs)
|
||||
{
|
||||
(void)bdev;
|
||||
return bio_alloc(gfp_mask, num_vecs);
|
||||
}" ;;
|
||||
"2")
|
||||
add_function "static inline struct bio *cas_bio_alloc(struct block_device *bdev, gfp_t gfp_mask, unsigned short num_vecs)
|
||||
{
|
||||
BUG_ON(!bdev);
|
||||
return bio_alloc(bdev, num_vecs, 0, gfp_mask);
|
||||
}" ;;
|
||||
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
conf_run $@
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
. $(dirname $3)/conf_framework.sh
|
||||
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "bio_clone(NULL, 0);" "linux/bio.h"
|
||||
then
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
elif compile_module $cur_name "bio_clone_kmalloc(NULL, 0);" "linux/bio.h"
|
||||
then
|
||||
echo $cur_name "2" >> $config_file_path
|
||||
elif compile_module $cur_name "bio_clone_fast(NULL, 0, NULL);" "linux/bio.h"
|
||||
then
|
||||
echo $cur_name "3" >> $config_file_path
|
||||
else
|
||||
echo $cur_name "X" >> $config_file_path
|
||||
fi
|
||||
}
|
||||
|
||||
apply() {
|
||||
case "$1" in
|
||||
"1")
|
||||
add_function "static inline struct bio *cas_bio_clone(struct bio *bio, gfp_t gfp_mask)
|
||||
{
|
||||
return bio_clone(bio, gfp_mask);
|
||||
}" ;;
|
||||
"2")
|
||||
add_function "static inline struct bio *cas_bio_clone(struct bio *bio, gfp_t gfp_mask)
|
||||
{
|
||||
return bio_clone_kmalloc(bio, gfp_mask);
|
||||
}" ;;
|
||||
"3")
|
||||
add_function "static inline struct bio *cas_bio_clone(struct bio *bio, gfp_t gfp_mask)
|
||||
{
|
||||
return bio_clone_fast(bio, gfp_mask, NULL);
|
||||
}" ;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
conf_run $@
|
||||
@@ -11,8 +11,8 @@ check() {
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "struct bio b = {}; bio_dev(&b); b.bi_bdev = NULL;" "linux/bio.h" "linux/genhd.h"
|
||||
then
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
elif compile_module $cur_name "struct bio b = {}; bio_dev(&b); b.bi_disk = NULL;" "linux/bio.h"
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
elif compile_module $cur_name "struct bio b = {}; bio_dev(&b); b.bi_disk = NULL;" "linux/bio.h" "linux/genhd.h"
|
||||
then
|
||||
echo $cur_name "2" >> $config_file_path
|
||||
elif compile_module $cur_name "struct bio b; b.bi_bdev = NULL;" "linux/bio.h"
|
||||
|
||||
35
configure.d/1_cas_blkdev_default_rq.conf
Normal file
35
configure.d/1_cas_blkdev_default_rq.conf
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
. $(dirname $3)/conf_framework.sh
|
||||
|
||||
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "int x = BLKDEV_DEFAULT_RQ;" "linux/blk-mq.h"
|
||||
then
|
||||
echo $cur_name 1 >> $config_file_path
|
||||
elif compile_module $cur_name "int x = BLKDEV_MAX_RQ;" "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_BLKDEV_DEFAULT_RQ (BLKDEV_DEFAULT_RQ)" ;;
|
||||
"2")
|
||||
add_define "CAS_BLKDEV_DEFAULT_RQ (BLKDEV_MAX_RQ)" ;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
conf_run $@
|
||||
40
configure.d/1_cas_flags.conf
Normal file
40
configure.d/1_cas_flags.conf
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
. $(dirname $3)/conf_framework.sh
|
||||
|
||||
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "int x = GENHD_FL_NO_PART_SCAN | GENHD_FL_EXT_DEVT;" "linux/genhd.h"
|
||||
then
|
||||
echo $cur_name 1 >> $config_file_path
|
||||
elif compile_module $cur_name "int x = GENHD_FL_EXT_DEVT;" "linux/genhd.h"
|
||||
then
|
||||
echo $cur_name 2 >> $config_file_path
|
||||
elif compile_module $cur_name "int x = GENHD_FL_NO_PART;" "linux/blkdev.h"
|
||||
then
|
||||
echo $cur_name 3 >> $config_file_path
|
||||
else
|
||||
echo $cur_name X >> $config_file_path
|
||||
fi
|
||||
}
|
||||
|
||||
apply() {
|
||||
case "$1" in
|
||||
"1")
|
||||
add_define "_CAS_GENHD_FLAGS (GENHD_FL_NO_PART_SCAN | GENHD_FL_EXT_DEVT)" ;;
|
||||
"2")
|
||||
add_define "_CAS_GENHD_FLAGS (GENHD_FL_EXT_DEVT)" ;;
|
||||
"3")
|
||||
add_define "_CAS_GENHD_FLAGS (GENHD_FL_NO_PART)" ;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
conf_run $@
|
||||
32
configure.d/1_complete_and_exit.conf
Normal file
32
configure.d/1_complete_and_exit.conf
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
. $(dirname $3)/conf_framework.sh
|
||||
|
||||
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "kthread_complete_and_exit(NULL, 0);" "linux/kthread.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_COMPLETE_AND_EXIT(compl, code) kthread_complete_and_exit(compl, code)" ;;
|
||||
"2")
|
||||
add_define "CAS_COMPLETE_AND_EXIT(compl, code) complete_and_exit(compl, code)" ;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
conf_run $@
|
||||
36
configure.d/1_get_disk_max_part.conf
Normal file
36
configure.d/1_get_disk_max_part.conf
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
. $(dirname $3)/conf_framework.sh
|
||||
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "disk_max_parts(NULL);" "linux/genhd.h"
|
||||
then
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
elif compile_module $cur_name "int i = DISK_MAX_PARTS;" "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 "GET_DISK_MAX_PARTS(x) disk_max_parts(x)"
|
||||
;;
|
||||
"2")
|
||||
add_define "GET_DISK_MAX_PARTS(x) DISK_MAX_PARTS"
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
conf_run $@
|
||||
32
configure.d/1_module_put_and_exit.conf
Normal file
32
configure.d/1_module_put_and_exit.conf
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
. $(dirname $3)/conf_framework.sh
|
||||
|
||||
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "module_put_and_kthread_exit(0);" "linux/module.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_MODULE_PUT_AND_EXIT(code) module_put_and_kthread_exit(code)" ;;
|
||||
"2")
|
||||
add_define "CAS_MODULE_PUT_AND_EXIT(code) module_put_and_exit(code)" ;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
conf_run $@
|
||||
@@ -15,10 +15,15 @@ check() {
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
elif compile_module $cur_name "struct queue_limits q; q.max_write_zeroes_sectors;" "linux/blkdev.h"
|
||||
then
|
||||
echo $cur_name "2" >> $config_file_path
|
||||
if compile_module $cur_name "struct queue_limits q; q.max_write_same_sectors;" "linux/blkdev.h"
|
||||
then
|
||||
echo $cur_name "2" >> $config_file_path
|
||||
else
|
||||
echo $cur_name "3" >> $config_file_path
|
||||
fi
|
||||
elif compile_module $cur_name "struct queue_limits q; q.max_write_same_sectors;" "linux/blkdev.h"
|
||||
then
|
||||
echo $cur_name "3" >> $config_file_path
|
||||
echo $cur_name "4" >> $config_file_path
|
||||
else
|
||||
echo $cur_name "X" >> $config_file_path
|
||||
fi
|
||||
@@ -55,7 +60,18 @@ apply() {
|
||||
exp_q->limits.max_write_same_sectors = 0;
|
||||
exp_q->limits.max_write_zeroes_sectors = 0;
|
||||
}" ;;
|
||||
"3")
|
||||
"3")
|
||||
add_function "
|
||||
static inline void cas_copy_queue_limits(struct request_queue *exp_q,
|
||||
struct request_queue *cache_q, struct request_queue *core_q)
|
||||
{
|
||||
exp_q->limits = cache_q->limits;
|
||||
exp_q->limits.max_sectors = core_q->limits.max_sectors;
|
||||
exp_q->limits.max_hw_sectors = core_q->limits.max_hw_sectors;
|
||||
exp_q->limits.max_segments = core_q->limits.max_segments;
|
||||
exp_q->limits.max_write_zeroes_sectors = 0;
|
||||
}" ;;
|
||||
"4")
|
||||
add_function "
|
||||
static inline void cas_copy_queue_limits(struct request_queue *exp_q,
|
||||
struct request_queue *cache_q, struct request_queue *core_q)
|
||||
@@ -66,6 +82,8 @@ apply() {
|
||||
exp_q->limits.max_segments = core_q->limits.max_segments;
|
||||
exp_q->limits.max_write_same_sectors = 0;
|
||||
}" ;;
|
||||
|
||||
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
|
||||
@@ -12,7 +12,8 @@ check() {
|
||||
if compile_module $cur_name "bdev_disk_changed((struct block_device *)NULL, false);" "linux/genhd.h"
|
||||
then
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
elif compile_module $cur_name "bdev_disk_changed((struct gendisk *)NULL, false);" "linux/genhd.h"
|
||||
elif compile_module $cur_name "bdev_disk_changed((struct gendisk *)NULL, false);" "linux/genhd.h" ||
|
||||
compile_module $cur_name "bdev_disk_changed((struct gendisk *)NULL, false);" "linux/blkdev.h"
|
||||
then
|
||||
echo $cur_name "2" >> $config_file_path
|
||||
else
|
||||
|
||||
@@ -6,26 +6,16 @@
|
||||
|
||||
. $(dirname $3)/conf_framework.sh
|
||||
|
||||
# submit_bio() can be defined in "bio.h" or in "fs.h"
|
||||
# If it is defind in fs.h, three possibilities are available:
|
||||
# * it takes one argument and retuns non-void
|
||||
# * it takes two arguments and returns non-void
|
||||
# * it takse two arguments and is void-type
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "submit_bio(NULL);" "linux/bio.h"
|
||||
if compile_module $cur_name "submit_bio(NULL);" "linux/bio.h" ||
|
||||
compile_module $cur_name "submit_bio(NULL);" "linux/fs.h"
|
||||
then
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
elif compile_module $cur_name "submit_bio(NULL);" "linux/fs.h"
|
||||
then
|
||||
echo $cur_name "2" >> $config_file_path
|
||||
elif compile_module $cur_name "void *t=submit_bio(0, NULL);" "linux/fs.h"
|
||||
then
|
||||
echo $cur_name "4" >> $config_file_path
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
elif compile_module $cur_name "submit_bio(0, NULL);" "linux/fs.h"
|
||||
then
|
||||
echo $cur_name "4" >> $config_file_path
|
||||
echo $cur_name "2" >> $config_file_path
|
||||
else
|
||||
echo $cur_name "X" >> $config_file_path
|
||||
fi
|
||||
@@ -35,26 +25,14 @@ apply() {
|
||||
case "$1" in
|
||||
"1")
|
||||
add_function "
|
||||
static inline blk_qc_t cas_submit_bio(int rw, struct bio *bio)
|
||||
static inline void cas_submit_bio(int rw, struct bio *bio)
|
||||
{
|
||||
CAS_BIO_OP_FLAGS(bio) |= rw;
|
||||
return submit_bio(bio);
|
||||
submit_bio(bio);
|
||||
}" ;;
|
||||
|
||||
"2")
|
||||
add_function "
|
||||
static inline blk_qc_t cas_submit_bio(int rw, struct bio *bio)
|
||||
{
|
||||
CAS_BIO_OP_FLAGS(bio) |= rw;
|
||||
return submit_bio(bio);
|
||||
}" ;;
|
||||
"3")
|
||||
add_function "
|
||||
static inline blk_qc_t cas_submit_bio(int rw, struct bio *bio)
|
||||
{
|
||||
return submit_bio(rw, bio);
|
||||
}" ;;
|
||||
"4")
|
||||
add_function "
|
||||
static inline void cas_submit_bio(int rw, struct bio *bio)
|
||||
{
|
||||
submit_bio(rw, bio);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2021 Intel Corporation
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
|
||||
obj-m += test_mod.o
|
||||
|
||||
MAKE_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
@@ -13,9 +13,9 @@ check_cflag=$(shell echo "" | \
|
||||
if [ $$? -eq 0 ]; then echo 1; else echo 0; fi; )
|
||||
|
||||
ifeq ($(call check_cflag,-Werror=int-conversion), 1)
|
||||
EXTRA_CFLAGS += -Werror=int-conversion
|
||||
EXTRA_CFLAGS += -Werror=int-conversion
|
||||
endif
|
||||
|
||||
KBUILD_CFLAGS += -Wno-error
|
||||
all:
|
||||
make -C $(KERNEL_DIR) M=$(MAKE_DIR) modules
|
||||
clean:
|
||||
|
||||
Reference in New Issue
Block a user