Merge pull request #1053 from hammerg/fix_kernel_5.12_v2
Add a support for kernel 5.12
This commit is contained in:
commit
1f15724b88
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2021 Intel Corporation
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
@ -9,15 +9,18 @@
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "struct block_device bd; bd = *disk_part_iter_next(NULL);" "linux/blk_types.h" "linux/genhd.h"
|
||||
if 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 hd_struct hd; hd = *disk_part_iter_next(NULL);" "linux/genhd.h"
|
||||
then
|
||||
elif compile_module $cur_name "struct block_device bd; bd = *disk_part_iter_next(NULL);" "linux/blk_types.h"
|
||||
then
|
||||
echo $cur_name "2" >> $config_file_path
|
||||
elif compile_module $cur_name "struct hd_struct hd; hd = *disk_part_iter_next(NULL);" "linux/genhd.h"
|
||||
then
|
||||
echo $cur_name "3" >> $config_file_path
|
||||
else
|
||||
echo $cur_name "X" >> $config_file_path
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
apply() {
|
||||
@ -25,6 +28,23 @@ apply() {
|
||||
"1")
|
||||
add_function "
|
||||
static inline int cas_bd_get_next_part(struct block_device *bd)
|
||||
{
|
||||
int part_no = 0;
|
||||
struct gendisk *disk = bd->bd_disk;
|
||||
struct block_device *part;
|
||||
unsigned long idx;
|
||||
|
||||
xa_for_each(&disk->part_tbl, idx, part) {
|
||||
if ((part_no = part->bd_partno)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return part_no;
|
||||
}" ;;
|
||||
"2")
|
||||
add_function "
|
||||
static inline int cas_bd_get_next_part(struct block_device *bd)
|
||||
{
|
||||
int part_no = 0;
|
||||
struct gendisk *disk = bd->bd_disk;
|
||||
@ -44,7 +64,7 @@ apply() {
|
||||
|
||||
return part_no;
|
||||
}" ;;
|
||||
"2")
|
||||
"3")
|
||||
add_function "
|
||||
static inline int cas_bd_get_next_part(struct block_device *bd)
|
||||
{
|
||||
|
61
configure.d/1_bd_part_count.conf
Normal file
61
configure.d/1_bd_part_count.conf
Normal file
@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
. $(dirname $3)/conf_framework
|
||||
|
||||
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"
|
||||
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"
|
||||
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_blk_get_part_count(struct block_device *bdev)
|
||||
{
|
||||
struct block_device *part;
|
||||
unsigned long idx;
|
||||
int count = 0;
|
||||
|
||||
xa_for_each(&bdev->bd_disk->part_tbl, idx, part) {
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}" ;;
|
||||
"2")
|
||||
add_function "
|
||||
static inline int cas_blk_get_part_count(struct block_device *bdev)
|
||||
{
|
||||
struct disk_part_tbl *ptbl;
|
||||
int i, count = 0;
|
||||
|
||||
rcu_read_lock();
|
||||
ptbl = rcu_dereference(bdev->bd_disk->part_tbl);
|
||||
for (i = 0; i < ptbl->len; ++i) {
|
||||
if (rcu_access_pointer(ptbl->part[i]))
|
||||
count++;
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
return count;
|
||||
}" ;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
conf_run $@
|
@ -9,12 +9,15 @@
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "struct bio b;bio_dev(&b);" "linux/bio.h" "linux/genhd.h"
|
||||
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;b.bi_bdev" "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"
|
||||
then
|
||||
echo $cur_name "2" >> $config_file_path
|
||||
elif compile_module $cur_name "struct bio b; b.bi_bdev = NULL" "linux/bio.h"
|
||||
then
|
||||
echo $cur_name "3" >> $config_file_path
|
||||
else
|
||||
echo $cur_name "X" >> $config_file_path
|
||||
fi
|
||||
@ -26,8 +29,13 @@ apply() {
|
||||
add_define "CAS_BIO_SET_DEV(bio, bdev) \\
|
||||
bio_set_dev(bio, bdev)"
|
||||
add_define "CAS_BIO_GET_DEV(bio) \\
|
||||
bio->bi_disk" ;;
|
||||
bio->bi_bdev->bd_disk" ;;
|
||||
"2")
|
||||
add_define "CAS_BIO_SET_DEV(bio, bdev) \\
|
||||
bio_set_dev(bio, bdev)"
|
||||
add_define "CAS_BIO_GET_DEV(bio) \\
|
||||
bio->bi_disk" ;;
|
||||
"3")
|
||||
add_define "CAS_BIO_SET_DEV(bio, bdev) \\
|
||||
bio->bi_bdev = bdev"
|
||||
add_define "CAS_BIO_GET_DEV(bio) \\
|
||||
|
32
configure.d/1_module_mutex.conf
Normal file
32
configure.d/1_module_mutex.conf
Normal file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
. $(dirname $3)/conf_framework
|
||||
|
||||
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "mutex_lock(&module_mutex);" "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 "MODULE_MUTEX_SUPPORTED 1" ;;
|
||||
"2")
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
conf_run $@
|
@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
#include "cas_cache.h"
|
||||
#include "utils/utils_blk.h"
|
||||
#include "threads.h"
|
||||
|
||||
extern u32 max_writeback_queue_size;
|
||||
|
@ -46,7 +46,7 @@ MODULE_PARM_DESC(seq_cut_off_mb,
|
||||
ocf_ctx_t cas_ctx;
|
||||
struct casdsk_functions_mapper casdisk_functions;
|
||||
|
||||
#ifdef SYMBOL_LOOKUP_SUPPORTED
|
||||
#if defined(SYMBOL_LOOKUP_SUPPORTED) && defined(MODULE_MUTEX_SUPPORTED)
|
||||
|
||||
struct exported_symbol {
|
||||
char *name;
|
||||
@ -83,7 +83,9 @@ int static cas_find_symbol(void *data, const char *namebuf,
|
||||
|
||||
int static cas_casdisk_lookup_funtions(void)
|
||||
{
|
||||
#ifdef MODULE_MUTEX_SUPPORTED
|
||||
mutex_lock(&module_mutex);
|
||||
#endif
|
||||
cas_lookup_symbol(casdsk_disk_detach);
|
||||
cas_lookup_symbol(casdsk_exp_obj_destroy);
|
||||
cas_lookup_symbol(casdsk_exp_obj_create);
|
||||
@ -105,7 +107,9 @@ int static cas_casdisk_lookup_funtions(void)
|
||||
cas_lookup_symbol(casdsk_disk_open);
|
||||
cas_lookup_symbol(casdsk_disk_clear_pt);
|
||||
cas_lookup_symbol(casdsk_exp_obj_get_gendisk);
|
||||
#ifdef MODULE_MUTEX_SUPPORTED
|
||||
mutex_unlock(&module_mutex);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright(c) 2012-2021 Intel Corporation
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "utils_blk.h"
|
||||
|
||||
int cas_blk_get_part_count(struct block_device *bdev)
|
||||
{
|
||||
struct disk_part_tbl *ptbl;
|
||||
int i, count = 0;
|
||||
|
||||
rcu_read_lock();
|
||||
ptbl = rcu_dereference(bdev->bd_disk->part_tbl);
|
||||
for (i = 0; i < ptbl->len; ++i) {
|
||||
if (rcu_access_pointer(ptbl->part[i]))
|
||||
count++;
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
return count;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright(c) 2012-2021 Intel Corporation
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef UTILS_BLK_H_
|
||||
#define UTILS_BLK_H_
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/genhd.h>
|
||||
|
||||
int cas_blk_get_part_count(struct block_device *bdev);
|
||||
|
||||
#endif /* UTILS_BLK_H_ */
|
Loading…
Reference in New Issue
Block a user