diff --git a/configure.d/1_bdev_open_by_path.conf b/configure.d/1_bdev_open_by_path.conf index ddceced..6c5dd6c 100644 --- a/configure.d/1_bdev_open_by_path.conf +++ b/configure.d/1_bdev_open_by_path.conf @@ -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 @@ -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 diff --git a/configure.d/1_bdev_release.conf b/configure.d/1_bdev_release.conf index 5d9dff3..1425ebf 100644 --- a/configure.d/1_bdev_release.conf +++ b/configure.d/1_bdev_release.conf @@ -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 @@ -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 diff --git a/configure.d/2_alloc_disk.conf b/configure.d/2_alloc_disk.conf index d0af88f..0686357 100644 --- a/configure.d/2_alloc_disk.conf +++ b/configure.d/2_alloc_disk.conf @@ -1,6 +1,7 @@ #!/bin/bash # # Copyright(c) 2012-2022 Intel Corporation +# Copyright(c) 2024 Huawei Technologies # SPDX-License-Identifier: BSD-3-Clause # @@ -10,17 +11,43 @@ 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 } apply() { case "$1" in "1") + 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, 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); + }" + ;; + + "2") add_function " static inline int cas_alloc_mq_disk(struct gendisk **gd, struct request_queue **queue, struct blk_mq_tag_set *tag_set) @@ -40,7 +67,7 @@ apply() { }" ;; - "2") + "3") add_function " static inline int cas_alloc_mq_disk(struct gendisk **gd, struct request_queue **queue, diff --git a/ocf b/ocf index 7c8ac29..283a897 160000 --- a/ocf +++ b/ocf @@ -1 +1 @@ -Subproject commit 7c8ac29ab982eb33abd42c9049fe42ddc491a7b2 +Subproject commit 283a897eebfd00fd14df271b03861898947de1d3