Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scst_lib: Fix bio_kmalloc usage to match change in Linux kernel v5.19 #124

Merged
merged 1 commit into from
Jan 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions scst/src/scst_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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) && \
Expand Down Expand Up @@ -8325,7 +8345,16 @@ static struct request *__blk_map_kern_sg(struct request_queue *q,
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;
}
Expand Down