Closed manualinux closed 3 weeks ago
Hello,
I have taken as a reference the modification of openZFS that can be found here. And I have added the following:
struct queue_limits *lim = NULL;
Modifying the following:
disk = rdsk->rdsk_disk = blk_alloc_disk(lim, NUMA_NO_NODE);
It is obvious that you will have to adapt it depending on the kernel that is used, but with these modifications the compilation can be carried out successfully. If more lines of code need to be added, I leave that up to you.
Regards.
What is the latest known compatible kernel that works with the 9.1.0
release?
I'm getting the same build errors with 6.9:
...
[ 24s] /home/abuild/rpmbuild/BUILD/rapiddisk-9.1.0/obj/default/rapiddisk.c: In function ‘attach_device’:
[ 24s] /home/abuild/rpmbuild/BUILD/rapiddisk-9.1.0/obj/default/rapiddisk.c:809:61: error: macro "blk_alloc_disk" requires 2 arguments, but only 1 given
[ 24s] 809 | disk = rdsk->rdsk_disk = blk_alloc_disk(NUMA_NO_NODE);
...
I'd like to try a known working build.
While looking at this issue, I noticed that the blk_alloc_disk()
call is duplicated, the second one overwriting the result from the first, probably causing some memory leak. So lets drop the duplicate one first:
--- a/module/rapiddisk.c
+++ b/module/rapiddisk.c
@@ -813,13 +813,6 @@ static int attach_device(unsigned long n
if (!disk)
goto out_free_queue;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
- disk = rdsk->rdsk_disk = blk_alloc_disk(NUMA_NO_NODE);
-#else
- disk = rdsk->rdsk_disk = alloc_disk(1);
-#endif
- if (!disk)
- goto out_free_queue;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
blk_queue_logical_block_size(disk->queue, BYTES_PER_SECTOR);
blk_queue_physical_block_size(disk->queue, PAGE_SIZE);
#else
Adjust for Linux commit "block: pass a queue_limits argument to blk_alloc_disk" (https://github.com/torvalds/linux/commit/74fa8f9c553f7b5ccab7d103acae63cc2e080465) in v6.9-rc1:
--- a/module/rapiddisk.c
+++ b/module/rapiddisk.c
@@ -805,12 +805,18 @@ static int attach_device(unsigned long n
blk_queue_make_request(rdsk->rdsk_queue, rdsk_make_request);
#endif
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+ disk = rdsk->rdsk_disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
disk = rdsk->rdsk_disk = blk_alloc_disk(NUMA_NO_NODE);
#else
disk = rdsk->rdsk_disk = alloc_disk(1);
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+ if (IS_ERR(disk))
+#else
if (!disk)
+#endif
goto out_free_queue;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
blk_queue_logical_block_size(disk->queue, BYTES_PER_SECTOR);
In the failure case (IS_ERR(disk)
) you could get the actual error returned by the new blk_alloc_disk()
with PTR_ERR(disk)
.
Can you please create a pull request for me to pull and review/merge into master?
EDIT: Oh, and THANK YOU! :-)
Merged https://github.com/pkoutoupis/rapiddisk/pull/189 to master.
When compiling the module with kernel 6.9, the following error message occurs:
Regards