diff --git a/configure.d/1_bdev_open_by_path.conf b/configure.d/1_bdev_open_by_path.conf index ddceced97..6c5dd6cac 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 5d9dff386..1425ebf53 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 d0af88f60..98473a3e5 100644 --- a/configure.d/2_alloc_disk.conf +++ b/configure.d/2_alloc_disk.conf @@ -10,11 +10,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 } @@ -25,7 +31,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; @@ -41,6 +47,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,