Merge pull request #1640 from robertbaldyga/kernel-6.14-bdev-fix
Fix bdev handling on kernel v6.14
This commit is contained in:
commit
767eea8f1a
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright(c) 2012-2022 Intel Corporation
|
# Copyright(c) 2012-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2025 Huawei Technologies
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ apply() {
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
"1")
|
"1")
|
||||||
add_function "
|
add_function "
|
||||||
static inline void cas_cleanup_disk(struct gendisk *gd)
|
static inline void _cas_cleanup_disk(struct gendisk *gd)
|
||||||
{
|
{
|
||||||
blk_cleanup_disk(gd);
|
blk_cleanup_disk(gd);
|
||||||
}"
|
}"
|
||||||
@ -31,7 +32,7 @@ apply() {
|
|||||||
"2")
|
"2")
|
||||||
|
|
||||||
add_function "
|
add_function "
|
||||||
static inline void cas_cleanup_disk(struct gendisk *gd)
|
static inline void _cas_cleanup_disk(struct gendisk *gd)
|
||||||
{
|
{
|
||||||
put_disk(gd);
|
put_disk(gd);
|
||||||
}"
|
}"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright(c) 2012-2022 Intel Corporation
|
# Copyright(c) 2012-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2025 Huawei Technologies
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -33,7 +34,8 @@ apply() {
|
|||||||
add_function "
|
add_function "
|
||||||
static inline void cas_cleanup_queue(struct request_queue *q)
|
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() {
|
check() {
|
||||||
cur_name=$(basename $2)
|
cur_name=$(basename $2)
|
||||||
config_file_path=$1
|
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
|
then
|
||||||
echo $cur_name 1 >> $config_file_path
|
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
|
then
|
||||||
echo $cur_name 2 >> $config_file_path
|
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
|
then
|
||||||
echo $cur_name 3 >> $config_file_path
|
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
|
else
|
||||||
echo $cur_name X >> $config_file_path
|
echo $cur_name X >> $config_file_path
|
||||||
fi
|
fi
|
||||||
@ -30,7 +33,28 @@ apply() {
|
|||||||
"1")
|
"1")
|
||||||
add_typedef "struct queue_limits cas_queue_limits_t;"
|
add_typedef "struct queue_limits cas_queue_limits_t;"
|
||||||
add_function "
|
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)
|
struct blk_mq_tag_set *tag_set, cas_queue_limits_t *lim)
|
||||||
{
|
{
|
||||||
*gd = blk_mq_alloc_disk(tag_set, lim, NULL);
|
*gd = blk_mq_alloc_disk(tag_set, lim, NULL);
|
||||||
@ -42,16 +66,16 @@ apply() {
|
|||||||
return 0;
|
return 0;
|
||||||
}"
|
}"
|
||||||
add_function "
|
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_typedef "void* cas_queue_limits_t;"
|
||||||
add_function "
|
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)
|
struct blk_mq_tag_set *tag_set, cas_queue_limits_t *lim)
|
||||||
{
|
{
|
||||||
*gd = blk_mq_alloc_disk(tag_set, NULL);
|
*gd = blk_mq_alloc_disk(tag_set, NULL);
|
||||||
@ -63,16 +87,16 @@ apply() {
|
|||||||
return 0;
|
return 0;
|
||||||
}"
|
}"
|
||||||
add_function "
|
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_typedef "void* cas_queue_limits_t;"
|
||||||
add_function "
|
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)
|
struct blk_mq_tag_set *tag_set, cas_queue_limits_t *lim)
|
||||||
{
|
{
|
||||||
*gd = alloc_disk(1);
|
*gd = alloc_disk(1);
|
||||||
@ -90,7 +114,7 @@ apply() {
|
|||||||
}"
|
}"
|
||||||
|
|
||||||
add_function "
|
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);
|
blk_cleanup_queue(gd->queue);
|
||||||
gd->queue = NULL;
|
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;
|
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);
|
&queue_limits);
|
||||||
if (result) {
|
if (result) {
|
||||||
goto error_alloc_mq_disk;
|
goto error_alloc_mq_disk;
|
||||||
@ -506,7 +506,8 @@ int cas_exp_obj_create(struct cas_disk *dsk, const char *dev_name,
|
|||||||
goto error_set_geometry;
|
goto error_set_geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cas_add_disk(gd))
|
result = cas_add_disk(gd);
|
||||||
|
if (result)
|
||||||
goto error_add_disk;
|
goto error_add_disk;
|
||||||
|
|
||||||
result = sysfs_create_group(&disk_to_dev(gd)->kobj, &device_attr_group);
|
result = sysfs_create_group(&disk_to_dev(gd)->kobj, &device_attr_group);
|
||||||
@ -528,7 +529,7 @@ error_set_geometry:
|
|||||||
exp_obj->private = NULL;
|
exp_obj->private = NULL;
|
||||||
_cas_exp_obj_clear_dev_t(dsk);
|
_cas_exp_obj_clear_dev_t(dsk);
|
||||||
error_exp_obj_set_dev_t:
|
error_exp_obj_set_dev_t:
|
||||||
cas_cleanup_mq_disk(gd);
|
cas_cleanup_disk(gd);
|
||||||
exp_obj->gd = NULL;
|
exp_obj->gd = NULL;
|
||||||
error_alloc_mq_disk:
|
error_alloc_mq_disk:
|
||||||
error_set_queue_limits:
|
error_set_queue_limits:
|
||||||
|
Loading…
Reference in New Issue
Block a user