Skip to content

Commit

Permalink
Add support for kernel v6.9
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
  • Loading branch information
robertbaldyga committed Jul 8, 2024
1 parent 4ad71a5 commit d3a1ce8
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
9 changes: 9 additions & 0 deletions configure.d/1_bdev_open_by_path.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ check() {
elif compile_module $cur_name "bdev_open_by_path(NULL, 0, NULL, NULL);" "linux/blkdev.h"
then
echo $cur_name 3 >> $config_file_path
elif compile_module $cur_name "bdev_file_open_by_path(NULL, 0, NULL, NULL);" "linux/blkdev.h"
then
echo $cur_name 4 >> $config_file_path
else
echo $cur_name X >> $config_file_path
fi
Expand All @@ -45,6 +48,12 @@ apply() {
bdev_open_by_path(path, mode, holder, NULL)"
add_define "cas_bdev_get_from_handle(handle) \\
(handle->bdev)" ;;
"4")
add_typedef "struct file *cas_bdev_handle_t;"
add_define "cas_bdev_open_by_path(path, mode, holder) \\
bdev_file_open_by_path(path, mode, holder, NULL)"
add_define "cas_bdev_get_from_handle(handle) \\
file_bdev(handle)" ;;
*)
exit 1
esac
Expand Down
6 changes: 6 additions & 0 deletions configure.d/1_bdev_release.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ check() {
elif compile_module $cur_name "bdev_release(NULL);" "linux/blkdev.h"
then
echo $cur_name 3 >> $config_file_path
elif compile_module $cur_name "bdev_file_open_by_path(NULL, 0, NULL, NULL);" "linux/blkdev.h"
then
echo $cur_name 4 >> $config_file_path
else
echo $cur_name X >> $config_file_path
fi
Expand All @@ -36,6 +39,9 @@ apply() {
"3")
add_define "cas_bdev_release(handle, mode, holder) \\
bdev_release(handle)" ;;
"4")
add_define "cas_bdev_release(handle, mode, holder) \\
fput(handle)" ;;
*)
exit 1
esac
Expand Down
33 changes: 30 additions & 3 deletions configure.d/2_alloc_disk.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
#
# Copyright(c) 2012-2022 Intel Corporation
# Copyright(c) 2024 Huawei Technologies
# SPDX-License-Identifier: BSD-3-Clause
#

Expand All @@ -10,11 +11,17 @@
check() {
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "blk_mq_alloc_disk(NULL, NULL);" "linux/blk-mq.h"
if compile_module $cur_name "blk_mq_alloc_disk(NULL, NULL, NULL);" "linux/blk-mq.h"
then
echo $cur_name 1 >> $config_file_path
else
elif compile_module $cur_name "blk_mq_alloc_disk(NULL, NULL);" "linux/blk-mq.h"
then
echo $cur_name 2 >> $config_file_path
elif compile_module $cur_name "alloc_disk(0);" "linux/genhd.h"
then
echo $cur_name 3 >> $config_file_path
else
echo $cur_name X >> $config_file_path
fi
}

Expand All @@ -25,7 +32,7 @@ apply() {
static inline int cas_alloc_mq_disk(struct gendisk **gd, struct request_queue **queue,
struct blk_mq_tag_set *tag_set)
{
*gd = blk_mq_alloc_disk(tag_set, NULL);
*gd = blk_mq_alloc_disk(tag_set, NULL, NULL);
if (!(*gd))
return -ENOMEM;
Expand All @@ -41,6 +48,26 @@ apply() {
;;

"2")
add_function "
static inline int cas_alloc_mq_disk(struct gendisk **gd, struct request_queue **queue,
struct blk_mq_tag_set *tag_set)
{
*gd = blk_mq_alloc_disk(tag_set, NULL);
if (!(*gd))
return -ENOMEM;
*queue = (*gd)->queue;
return 0;
}"
add_function "
static inline void cas_cleanup_mq_disk(struct gendisk *gd)
{
cas_cleanup_disk(gd);
}"
;;

"3")

add_function "
static inline int cas_alloc_mq_disk(struct gendisk **gd, struct request_queue **queue,
Expand Down
2 changes: 1 addition & 1 deletion ocf

0 comments on commit d3a1ce8

Please sign in to comment.