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:
parent
65bc955d4f
commit
f0af7cb52d
@ -956,17 +956,6 @@ int check_cache_already_added(const char *cache_device) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static void check_cache_scheduler(const char *cache_device, const char *elv_name)
|
||||
{
|
||||
if (strnlen_s(elv_name, MAX_ELEVATOR_NAME) == 3 &&
|
||||
!strncmp(elv_name, "cfq", 3)) {
|
||||
cas_printf(LOG_INFO,
|
||||
"I/O scheduler for cache device %s is %s. This could cause performance drop.\n"
|
||||
"Consider switching I/O scheduler to deadline or noop.\n",
|
||||
cache_device, elv_name);
|
||||
}
|
||||
}
|
||||
|
||||
int start_cache(uint16_t cache_id, unsigned int cache_init,
|
||||
const char *cache_device, ocf_cache_mode_t cache_mode,
|
||||
ocf_cache_line_size_t line_size, int force)
|
||||
@ -1032,8 +1021,6 @@ int start_cache(uint16_t cache_id, unsigned int cache_init,
|
||||
}
|
||||
}
|
||||
|
||||
check_cache_scheduler(cache_device, cmd.cache_elevator);
|
||||
|
||||
check_cache_state_incomplete(cache_id, fd);
|
||||
close(fd);
|
||||
|
||||
|
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:
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/blkpg.h>
|
||||
#include <linux/elevator.h>
|
||||
#include <linux/blk-mq.h>
|
||||
|
||||
#include "disk.h"
|
||||
@ -31,7 +30,10 @@ static inline void bd_release_from_disk(struct block_device *bdev,
|
||||
return bd_unlink_disk_holder(bdev, disk);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
#define KRETURN(x) return
|
||||
#define MAKE_RQ_RET_TYPE void
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
|
||||
#define KRETURN(x) ({ return (x); })
|
||||
#define MAKE_RQ_RET_TYPE blk_qc_t
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
|
||||
@ -161,12 +163,6 @@ out_map_bpart:
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef GENHD_FL_NO_PART_SCAN
|
||||
static int _cas_flags = GENHD_FL_NO_PART_SCAN | GENHD_FL_EXT_DEVT;
|
||||
#else
|
||||
static int _cas_flags = GENHD_FL_EXT_DEVT;
|
||||
#endif
|
||||
|
||||
static int _cas_exp_obj_hide_parts(struct cas_disk *dsk)
|
||||
{
|
||||
struct cas_exp_obj *exp_obj = dsk->exp_obj;
|
||||
@ -177,7 +173,7 @@ static int _cas_exp_obj_hide_parts(struct cas_disk *dsk)
|
||||
/* It is partition, no more job required */
|
||||
return 0;
|
||||
|
||||
if (disk_max_parts(dsk->bd->bd_disk) > 1) {
|
||||
if (GET_DISK_MAX_PARTS(dsk->bd->bd_disk) > 1) {
|
||||
if (_cas_del_partitions(dsk)) {
|
||||
printk(KERN_ERR "Error deleting a partition on thedevice %s\n",
|
||||
gdsk->disk_name);
|
||||
@ -189,11 +185,11 @@ static int _cas_exp_obj_hide_parts(struct cas_disk *dsk)
|
||||
}
|
||||
|
||||
/* Save original flags and minors */
|
||||
exp_obj->gd_flags = gdsk->flags & _cas_flags;
|
||||
exp_obj->gd_flags = gdsk->flags & _CAS_GENHD_FLAGS;
|
||||
exp_obj->gd_minors = gdsk->minors;
|
||||
|
||||
/* Setup disk of bottom device as not partitioned device */
|
||||
gdsk->flags &= ~_cas_flags;
|
||||
gdsk->flags &= ~_CAS_GENHD_FLAGS;
|
||||
gdsk->minors = 1;
|
||||
/* Rescan partitions */
|
||||
cas_reread_partitions(bd);
|
||||
@ -217,7 +213,7 @@ static int _cas_exp_obj_set_dev_t(struct cas_disk *dsk, struct gendisk *gd)
|
||||
{
|
||||
struct cas_exp_obj *exp_obj = dsk->exp_obj;
|
||||
int flags;
|
||||
int minors = disk_max_parts(cas_disk_get_gendisk(dsk));
|
||||
int minors = GET_DISK_MAX_PARTS(cas_disk_get_gendisk(dsk));
|
||||
struct block_device *bdev;
|
||||
|
||||
bdev = cas_disk_get_blkdev(dsk);
|
||||
@ -346,7 +342,7 @@ static void _cas_init_queues(struct cas_disk *dsk)
|
||||
{
|
||||
struct request_queue *q = dsk->exp_obj->queue;
|
||||
struct blk_mq_hw_ctx *hctx;
|
||||
int i;
|
||||
unsigned long i;
|
||||
|
||||
queue_for_each_hw_ctx(q, hctx, i) {
|
||||
if (!hctx->nr_ctx || !hctx->tags)
|
||||
@ -365,7 +361,7 @@ static int _cas_init_tag_set(struct cas_disk *dsk, struct blk_mq_tag_set *set)
|
||||
set->nr_hw_queues = num_online_cpus();
|
||||
set->numa_node = NUMA_NO_NODE;
|
||||
/*TODO: Should we inherit qd from core device? */
|
||||
set->queue_depth = BLKDEV_MAX_RQ;
|
||||
set->queue_depth = CAS_BLKDEV_DEFAULT_RQ;
|
||||
|
||||
set->cmd_size = 0;
|
||||
set->flags = BLK_MQ_F_SHOULD_MERGE | CAS_BLK_MQ_F_STACKING | CAS_BLK_MQ_F_BLOCKING;
|
||||
@ -490,7 +486,8 @@ int cas_exp_obj_create(struct cas_disk *dsk, const char *dev_name,
|
||||
goto error_set_geometry;
|
||||
}
|
||||
|
||||
add_disk(gd);
|
||||
if (cas_add_disk(gd))
|
||||
goto error_add_disk;
|
||||
|
||||
result = bd_claim_by_disk(dsk->bd, dsk, gd);
|
||||
if (result)
|
||||
@ -500,6 +497,7 @@ int cas_exp_obj_create(struct cas_disk *dsk, const char *dev_name,
|
||||
|
||||
error_bd_claim:
|
||||
del_gendisk(dsk->exp_obj->gd);
|
||||
error_add_disk:
|
||||
error_set_geometry:
|
||||
exp_obj->private = NULL;
|
||||
_cas_exp_obj_clear_dev_t(dsk);
|
||||
|
@ -601,12 +601,11 @@ static int exit_instance_finish(void *data)
|
||||
if (result == -KCAS_ERR_WAITING_INTERRUPTED)
|
||||
kfree(ctx);
|
||||
|
||||
module_put_and_exit(0);
|
||||
CAS_MODULE_PUT_AND_EXIT(0);
|
||||
}
|
||||
|
||||
struct _cache_mngt_attach_context {
|
||||
struct _cache_mngt_async_context async;
|
||||
char cache_elevator[MAX_ELEVATOR_NAME];
|
||||
uint64_t min_free_ram;
|
||||
struct ocf_mngt_cache_device_config device_cfg;
|
||||
char cache_path[MAX_STR_LEN];
|
||||
@ -649,7 +648,7 @@ static int cache_start_rollback(void *data)
|
||||
if (result == -KCAS_ERR_WAITING_INTERRUPTED)
|
||||
kfree(ctx);
|
||||
|
||||
module_put_and_exit(0);
|
||||
CAS_MODULE_PUT_AND_EXIT(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2021,7 +2020,7 @@ static void init_instance_complete(struct _cache_mngt_attach_context *ctx,
|
||||
ocf_volume_t cache_obj;
|
||||
struct bd_object *bd_cache_obj;
|
||||
struct block_device *bdev;
|
||||
const char *name;
|
||||
//const char *name;
|
||||
|
||||
cache_obj = ocf_cache_get_volume(cache);
|
||||
BUG_ON(!cache_obj);
|
||||
@ -2033,11 +2032,6 @@ static void init_instance_complete(struct _cache_mngt_attach_context *ctx,
|
||||
if (cas_bdev_whole(bdev) == bdev)
|
||||
cas_reread_partitions(bdev);
|
||||
|
||||
/* Set other back information */
|
||||
name = block_dev_get_elevator_name(
|
||||
cas_disk_get_queue(bd_cache_obj->dsk));
|
||||
if (name)
|
||||
strlcpy(ctx->cache_elevator, name, MAX_ELEVATOR_NAME);
|
||||
}
|
||||
|
||||
static void _cache_mngt_start_complete(ocf_cache_t cache, void *priv, int error)
|
||||
@ -2572,9 +2566,6 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg,
|
||||
if (result)
|
||||
goto err;
|
||||
|
||||
strlcpy(cmd->cache_elevator, context->cache_elevator,
|
||||
MAX_ELEVATOR_NAME);
|
||||
|
||||
result = _cache_start_finalize(cache, cmd->init_cache, false);
|
||||
if (result)
|
||||
goto err;
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <linux/bio.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright(c) 2012-2021 Intel Corporation
|
||||
* Copyright(c) 2012-2022 Intel Corporation
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
@ -51,7 +51,7 @@ static int _cas_io_queue_thread(void *data)
|
||||
/* If we get here, then thread was signalled to terminate.
|
||||
* So, let's complete and exit.
|
||||
*/
|
||||
complete_and_exit(&info->compl, 0);
|
||||
CAS_COMPLETE_AND_EXIT(&info->compl, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -110,7 +110,7 @@ static int _cas_cleaner_thread(void *data)
|
||||
}
|
||||
} while (true);
|
||||
|
||||
complete_and_exit(&info->compl, 0);
|
||||
CAS_COMPLETE_AND_EXIT(&info->compl, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/blkdev.h>
|
||||
|
||||
#include "cas_cache.h"
|
||||
|
||||
#define CAS_DEBUG_IO 0
|
||||
@ -82,57 +81,14 @@ uint64_t block_dev_get_byte_length(ocf_volume_t vol)
|
||||
return sector_length << SECTOR_SHIFT;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 3, 0)
|
||||
static const char *__block_dev_get_elevator_name(struct request_queue *q)
|
||||
{
|
||||
if (q->elevator->elevator_type == NULL)
|
||||
return NULL;
|
||||
|
||||
if (q->elevator->elevator_type->elevator_name == NULL)
|
||||
return NULL;
|
||||
|
||||
if (q->elevator->elevator_type->elevator_name[0] == 0)
|
||||
return NULL;
|
||||
|
||||
return q->elevator->elevator_type->elevator_name;
|
||||
}
|
||||
#else
|
||||
static const char *__block_dev_get_elevator_name(struct request_queue *q)
|
||||
{
|
||||
if (q->elevator->type == NULL)
|
||||
return NULL;
|
||||
|
||||
if (q->elevator->type->elevator_name == NULL)
|
||||
return NULL;
|
||||
|
||||
if (q->elevator->type->elevator_name[0] == 0)
|
||||
return NULL;
|
||||
|
||||
return q->elevator->type->elevator_name;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
const char *block_dev_get_elevator_name(struct request_queue *q)
|
||||
{
|
||||
if (!q)
|
||||
return NULL;
|
||||
|
||||
if (q->elevator == NULL)
|
||||
return NULL;
|
||||
|
||||
return __block_dev_get_elevator_name(q);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static inline struct bio *cas_bd_io_alloc_bio(struct blkio *bdio)
|
||||
static inline struct bio *cas_bd_io_alloc_bio(struct block_device *bdev,
|
||||
struct blkio *bdio)
|
||||
{
|
||||
struct bio *bio
|
||||
= bio_alloc(GFP_NOIO, cas_io_iter_size_left(&bdio->iter));
|
||||
= cas_bio_alloc(bdev, GFP_NOIO, cas_io_iter_size_left(&bdio->iter));
|
||||
|
||||
if (bio)
|
||||
return bio;
|
||||
@ -145,7 +101,7 @@ static inline struct bio *cas_bd_io_alloc_bio(struct blkio *bdio)
|
||||
}
|
||||
|
||||
/* Retry with smaller */
|
||||
return bio_alloc(GFP_NOIO, MAX_LINES_PER_IO);
|
||||
return cas_bio_alloc(bdev, GFP_NOIO, MAX_LINES_PER_IO);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -221,7 +177,7 @@ static void block_dev_submit_flush(struct ocf_io *io)
|
||||
goto out;
|
||||
}
|
||||
|
||||
bio = bio_alloc(GFP_NOIO, 0);
|
||||
bio = cas_bio_alloc(bdev, GFP_NOIO, 0);
|
||||
if (bio == NULL) {
|
||||
CAS_PRINT_RL(KERN_ERR "Couldn't allocate memory for BIO\n");
|
||||
blkio->error = -ENOMEM;
|
||||
@ -281,7 +237,7 @@ void block_dev_submit_discard(struct ocf_io *io)
|
||||
start = io->addr >> SECTOR_SHIFT;
|
||||
|
||||
while (sects) {
|
||||
bio = bio_alloc(GFP_NOIO, 1);
|
||||
bio = cas_bio_alloc(bd, GFP_NOIO, 1);
|
||||
if (!bio) {
|
||||
CAS_PRINT_RL(CAS_KERN_ERR "Couldn't allocate memory for BIO\n");
|
||||
blkio->error = -ENOMEM;
|
||||
@ -390,7 +346,7 @@ static void block_dev_submit_io(struct ocf_io *io)
|
||||
/* Still IO vectors to be sent */
|
||||
|
||||
/* Allocate BIO */
|
||||
struct bio *bio = cas_bd_io_alloc_bio(bdio);
|
||||
struct bio *bio = cas_bd_io_alloc_bio(bdobj->btm_bd, bdio);
|
||||
|
||||
if (!bio) {
|
||||
bdio->error = -ENOMEM;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright(c) 2012-2021 Intel Corporation
|
||||
* Copyright(c) 2012-2022 Intel Corporation
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
@ -12,8 +12,6 @@ int block_dev_open_object(ocf_volume_t vol, void *volume_params);
|
||||
|
||||
void block_dev_close_object(ocf_volume_t vol);
|
||||
|
||||
const char *block_dev_get_elevator_name(struct request_queue *q);
|
||||
|
||||
int block_dev_try_get_io_class(struct bio *bio, int *io_class);
|
||||
|
||||
int block_dev_init(void);
|
||||
|
@ -23,11 +23,6 @@
|
||||
*/
|
||||
#define MAX_STR_LEN PATH_MAX
|
||||
|
||||
/**
|
||||
* Max size of elevator name (including null terminator)
|
||||
*/
|
||||
#define MAX_ELEVATOR_NAME 16
|
||||
|
||||
/** \cond SKIP_IN_DOC */
|
||||
#define CACHE_LIST_ID_LIMIT 20
|
||||
|
||||
@ -76,8 +71,6 @@ struct kcas_start_cache {
|
||||
|
||||
uint64_t min_free_ram; /**< Minimum free RAM memory for cache metadata */
|
||||
|
||||
char cache_elevator[MAX_ELEVATOR_NAME];
|
||||
|
||||
int ext_err_code;
|
||||
};
|
||||
|
||||
@ -391,7 +384,7 @@ struct kcas_standby_activate
|
||||
* 18 * KCAS_IOCTL_GET_CAPABILITIES * DEPRECATED *
|
||||
* 19 * KCAS_IOCTL_UPGRADE * DEPRACATED *
|
||||
* 20 * KCAS_IOCTL_NVME_FORMAT * DEPRECATED *
|
||||
* 21 * KCAS_IOCTL_START_CACHE * OK *
|
||||
* 21 * KCAS_IOCTL_START_CACHE * DEPRECATED *
|
||||
* 22 * KCAS_IOCTL_INSERT_CORE * OK *
|
||||
* 23 * KCAS_IOCTL_REMOVE_CORE * OK *
|
||||
* 24 * KCAS_IOCTL_CACHE_INFO * OK *
|
||||
@ -411,6 +404,7 @@ struct kcas_standby_activate
|
||||
* 38 * KCAS_IOCTL_STANDBY_DETACH * OK *
|
||||
* 39 * KCAS_IOCTL_STANDBY_ACTIVATE * OK *
|
||||
* 40 * KCAS_IOCTL_CORE_INFO * OK *
|
||||
* 41 * KCAS_IOCTL_START_CACHE * OK *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
@ -450,9 +444,6 @@ struct kcas_standby_activate
|
||||
/** List valid cache ids within Open CAS module */
|
||||
#define KCAS_IOCTL_LIST_CACHE _IOWR(KCAS_IOCTL_MAGIC, 17, struct kcas_cache_list)
|
||||
|
||||
/** Start new cache instance, load cache or recover cache */
|
||||
#define KCAS_IOCTL_START_CACHE _IOWR(KCAS_IOCTL_MAGIC, 21, struct kcas_start_cache)
|
||||
|
||||
/** Add core object to an running cache instance */
|
||||
#define KCAS_IOCTL_INSERT_CORE _IOWR(KCAS_IOCTL_MAGIC, 22, struct kcas_insert_core)
|
||||
|
||||
@ -509,6 +500,9 @@ struct kcas_standby_activate
|
||||
/** Rretrieve statisting of a given core object */
|
||||
#define KCAS_IOCTL_CORE_INFO _IOWR(KCAS_IOCTL_MAGIC, 40, struct kcas_core_info)
|
||||
|
||||
/** Start new cache instance, load cache or recover cache */
|
||||
#define KCAS_IOCTL_START_CACHE _IOWR(KCAS_IOCTL_MAGIC, 41, struct kcas_start_cache)
|
||||
|
||||
/**
|
||||
* Extended kernel CAS error codes
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user