Allocate bdev suitable for submit_bio()
Starting from kernel 6.14, submit_bio() is supported only for non-mq bdevs. Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
This commit is contained in:
parent
c4a1923215
commit
72ae9b8161
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# Copyright(c) 2025 Huawei Technologies
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
@ -22,7 +23,7 @@ apply() {
|
||||
case "$1" in
|
||||
"1")
|
||||
add_function "
|
||||
static inline void cas_cleanup_disk(struct gendisk *gd)
|
||||
static inline void _cas_cleanup_disk(struct gendisk *gd)
|
||||
{
|
||||
blk_cleanup_disk(gd);
|
||||
}"
|
||||
@ -31,7 +32,7 @@ apply() {
|
||||
"2")
|
||||
|
||||
add_function "
|
||||
static inline void cas_cleanup_disk(struct gendisk *gd)
|
||||
static inline void _cas_cleanup_disk(struct gendisk *gd)
|
||||
{
|
||||
put_disk(gd);
|
||||
}"
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# Copyright(c) 2025 Huawei Technologies
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
@ -33,7 +34,8 @@ apply() {
|
||||
add_function "
|
||||
static inline void cas_cleanup_queue(struct request_queue *q)
|
||||
{
|
||||
blk_mq_destroy_queue(q);
|
||||
if (queue_is_mq(q))
|
||||
blk_mq_destroy_queue(q);
|
||||
}"
|
||||
;;
|
||||
|
||||
|
@ -11,15 +11,18 @@
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "blk_mq_alloc_disk(NULL, NULL, NULL);" "linux/blk-mq.h"
|
||||
if compile_module $cur_name "blk_alloc_disk(NULL, 0);" "linux/blkdev.h"
|
||||
then
|
||||
echo $cur_name 1 >> $config_file_path
|
||||
elif compile_module $cur_name "blk_mq_alloc_disk(NULL, NULL);" "linux/blk-mq.h"
|
||||
elif compile_module $cur_name "blk_mq_alloc_disk(NULL, 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"
|
||||
elif compile_module $cur_name "blk_mq_alloc_disk(NULL, NULL);" "linux/blk-mq.h"
|
||||
then
|
||||
echo $cur_name 3 >> $config_file_path
|
||||
elif compile_module $cur_name "alloc_disk(0);" "linux/genhd.h"
|
||||
then
|
||||
echo $cur_name 4 >> $config_file_path
|
||||
else
|
||||
echo $cur_name X >> $config_file_path
|
||||
fi
|
||||
@ -30,7 +33,28 @@ apply() {
|
||||
"1")
|
||||
add_typedef "struct queue_limits cas_queue_limits_t;"
|
||||
add_function "
|
||||
static inline int cas_alloc_mq_disk(struct gendisk **gd, struct request_queue **queue,
|
||||
static inline int cas_alloc_disk(struct gendisk **gd, struct request_queue **queue,
|
||||
struct blk_mq_tag_set *tag_set, cas_queue_limits_t *lim)
|
||||
{
|
||||
*gd = blk_alloc_disk(lim, NUMA_NO_NODE);
|
||||
if (IS_ERR(*gd))
|
||||
return PTR_ERR(*gd);
|
||||
|
||||
*queue = (*gd)->queue;
|
||||
|
||||
return 0;
|
||||
}"
|
||||
add_function "
|
||||
static inline void cas_cleanup_disk(struct gendisk *gd)
|
||||
{
|
||||
_cas_cleanup_disk(gd);
|
||||
}"
|
||||
;;
|
||||
|
||||
"2")
|
||||
add_typedef "struct queue_limits cas_queue_limits_t;"
|
||||
add_function "
|
||||
static inline int cas_alloc_disk(struct gendisk **gd, struct request_queue **queue,
|
||||
struct blk_mq_tag_set *tag_set, cas_queue_limits_t *lim)
|
||||
{
|
||||
*gd = blk_mq_alloc_disk(tag_set, lim, NULL);
|
||||
@ -42,16 +66,16 @@ apply() {
|
||||
return 0;
|
||||
}"
|
||||
add_function "
|
||||
static inline void cas_cleanup_mq_disk(struct gendisk *gd)
|
||||
static inline void cas_cleanup_disk(struct gendisk *gd)
|
||||
{
|
||||
cas_cleanup_disk(gd);
|
||||
_cas_cleanup_disk(gd);
|
||||
}"
|
||||
;;
|
||||
|
||||
"2")
|
||||
"3")
|
||||
add_typedef "void* cas_queue_limits_t;"
|
||||
add_function "
|
||||
static inline int cas_alloc_mq_disk(struct gendisk **gd, struct request_queue **queue,
|
||||
static inline int cas_alloc_disk(struct gendisk **gd, struct request_queue **queue,
|
||||
struct blk_mq_tag_set *tag_set, cas_queue_limits_t *lim)
|
||||
{
|
||||
*gd = blk_mq_alloc_disk(tag_set, NULL);
|
||||
@ -63,16 +87,16 @@ apply() {
|
||||
return 0;
|
||||
}"
|
||||
add_function "
|
||||
static inline void cas_cleanup_mq_disk(struct gendisk *gd)
|
||||
static inline void cas_cleanup_disk(struct gendisk *gd)
|
||||
{
|
||||
cas_cleanup_disk(gd);
|
||||
_cas_cleanup_disk(gd);
|
||||
}"
|
||||
;;
|
||||
|
||||
"3")
|
||||
"4")
|
||||
add_typedef "void* cas_queue_limits_t;"
|
||||
add_function "
|
||||
static inline int cas_alloc_mq_disk(struct gendisk **gd, struct request_queue **queue,
|
||||
static inline int cas_alloc_disk(struct gendisk **gd, struct request_queue **queue,
|
||||
struct blk_mq_tag_set *tag_set, cas_queue_limits_t *lim)
|
||||
{
|
||||
*gd = alloc_disk(1);
|
||||
@ -90,7 +114,7 @@ apply() {
|
||||
}"
|
||||
|
||||
add_function "
|
||||
static inline void cas_cleanup_mq_disk(struct gendisk *gd)
|
||||
static inline void cas_cleanup_disk(struct gendisk *gd)
|
||||
{
|
||||
blk_cleanup_queue(gd->queue);
|
||||
gd->queue = NULL;
|
||||
|
@ -474,7 +474,7 @@ int cas_exp_obj_create(struct cas_disk *dsk, const char *dev_name,
|
||||
goto error_set_queue_limits;
|
||||
}
|
||||
|
||||
result = cas_alloc_mq_disk(&gd, &queue, &exp_obj->tag_set,
|
||||
result = cas_alloc_disk(&gd, &queue, &exp_obj->tag_set,
|
||||
&queue_limits);
|
||||
if (result) {
|
||||
goto error_alloc_mq_disk;
|
||||
@ -529,7 +529,7 @@ error_set_geometry:
|
||||
exp_obj->private = NULL;
|
||||
_cas_exp_obj_clear_dev_t(dsk);
|
||||
error_exp_obj_set_dev_t:
|
||||
cas_cleanup_mq_disk(gd);
|
||||
cas_cleanup_disk(gd);
|
||||
exp_obj->gd = NULL;
|
||||
error_alloc_mq_disk:
|
||||
error_set_queue_limits:
|
||||
|
Loading…
Reference in New Issue
Block a user