From: Gleb C. <lna...@ya...> - 2023-05-10 10:41:59
|
Commit: ae5aa8c GitHub URL: https://github.com/SCST-project/scst/commit/ae5aa8ca36b331b89961d60baf34b48b156c5cff Author: Brian Meagher Date: 2023-05-10T13:39:05+03:00 Log Message: ----------- scst_lib: Fix bio_kmalloc usage to match change in Linux kernel v5.19 In kernel commit 066ff571011d ("block: turn bio_kmalloc into a simple kmalloc wrapper"), the order of arguments to bio_kmalloc changed, as did its semantics. Modified Paths: -------------- scst/src/scst_lib.c | 29 +++++++++++++++ 1 file changed, 29 insertions(+) =================================================================== diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 559cd91..4e0f47b 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -7968,7 +7968,16 @@ static void blk_bio_map_kern_endio(struct bio *bio) } } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) + /* + * See commit 066ff571011d ("block: turn bio_kmalloc into a simple + * kmalloc wrapper"). + */ + bio_uninit(bio); + kfree(bio); +#else bio_put(bio); +#endif return; } @@ -8242,11 +8251,22 @@ static struct request *__blk_map_kern_sg(struct request_queue *q, int rc; if (need_new_bio) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) + /* + * See commit 066ff571011d ("block: turn + * bio_kmalloc into a simple kmalloc wrapper"). + */ + bio = bio_kmalloc(max_nr_vecs, gfp_mask); +#else bio = bio_kmalloc(gfp_mask, max_nr_vecs); +#endif if (bio == NULL) { rq = ERR_PTR(-ENOMEM); goto out_free_bios; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) + bio_init(bio, NULL, bio->bi_inline_vecs, max_nr_vecs, 0); +#endif if (!reading) #if (!defined(CONFIG_SUSE_KERNEL) && \ @@ -8325,7 +8345,16 @@ out_free_bios: while (hbio != NULL) { bio = hbio; hbio = hbio->bi_next; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) + /* + * See commit 066ff571011d ("block: turn bio_kmalloc into a + * simple kmalloc wrapper"). + */ + bio_uninit(bio); + kfree(bio); +#else bio_put(bio); +#endif } goto out; } |