Skip to content

Commit

Permalink
Added support for 5.9 kernels and later
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoutoupis committed Jan 21, 2021
1 parent 2ff42a1 commit ec4f417
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Release 7.x ###

- module: Updated for 5.9 kernels and later

### Release 7.0.1 ###

- misc: Fixed typo in utility Makefile
Expand Down
17 changes: 16 additions & 1 deletion module/rapiddisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <linux/radix-tree.h>
#include <linux/io.h>

#define VERSION_STR "7.0.1"
#define VERSION_STR "7.0.0"
#define PREFIX "rapiddisk"
#define BYTES_PER_SECTOR 512
#define MAX_RDSKS 128
Expand Down Expand Up @@ -102,7 +102,11 @@ static int rdsk_ioctl(struct block_device *, fmode_t,
unsigned int, unsigned long);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
static blk_qc_t rdsk_submit_bio(struct bio *);
#else
static blk_qc_t rdsk_make_request(struct request_queue *, struct bio *);
#endif
#else
static void rdsk_make_request(struct request_queue *, struct bio *);
#endif
Expand Down Expand Up @@ -477,7 +481,11 @@ static void
#else
static int
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
rdsk_submit_bio(struct bio *bio)
#else
rdsk_make_request(struct request_queue *q, struct bio *bio)
#endif
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
struct rdsk_device *rdsk = bio->bi_disk->private_data;
Expand Down Expand Up @@ -664,6 +672,9 @@ static int rdsk_ioctl(struct block_device *bdev, fmode_t mode,

static const struct block_device_operations rdsk_fops = {
.owner = THIS_MODULE,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
.submit_bio = rdsk_submit_bio,
#endif
.ioctl = rdsk_ioctl,
};

Expand Down Expand Up @@ -708,7 +719,11 @@ static int attach_device(int size)
INIT_RADIX_TREE(&rdsk->rdsk_pages, GFP_ATOMIC);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
rdsk->rdsk_queue = blk_alloc_queue(NUMA_NO_NODE);
#else
rdsk->rdsk_queue = blk_alloc_queue(rdsk_make_request, NUMA_NO_NODE);
#endif
if (!rdsk->rdsk_queue)
goto out_free_dev;
#else
Expand Down

0 comments on commit ec4f417

Please sign in to comment.