Followup-For: Bug #1069945 Control: tag -1 patch Attached is a patch that I plan to NMU. It fixes support for recent kernels in stable, testing, sid. It also fixes some dkms packaging issues (and simplifies the dkms packaging part even further).
I've submitted some of these changes for bookworm-pu: #1077916 Andreas PS: if the salsa repository were up-to-date, you could get a merge request with these changes
diff -Nru rapiddisk-9.1.0/debian/changelog rapiddisk-9.1.0/debian/changelog --- rapiddisk-9.1.0/debian/changelog 2024-07-22 15:57:51.000000000 +0200 +++ rapiddisk-9.1.0/debian/changelog 2024-08-03 21:15:54.000000000 +0200 @@ -1,3 +1,18 @@ +rapiddisk (9.1.0-3.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Drop -dkms suffix from dkms module name. + * Use dkms.conf from upstream. + * dkms.conf: Set BUILD_EXCLUSIVE_KERNEL_MIN="2.6.39" for using kstrto*(). + * Drop unused obsolete patches. + * Fix module build for Linux <4.3. + * Fix module build for Linux 6.1.83, 6.6.23, 6.7.11, 6.8.2. + (Closes: #1069945) + * Fix module build for Linux 6.9. + * Fix module build for Linux 6.10. + + -- Andreas Beckmann <a...@debian.org> Sat, 03 Aug 2024 21:15:54 +0200 + rapiddisk (9.1.0-3) unstable; urgency=medium * Bump standards version to 4.7.0. diff -Nru rapiddisk-9.1.0/debian/dkms rapiddisk-9.1.0/debian/dkms --- rapiddisk-9.1.0/debian/dkms 2023-01-31 14:28:59.000000000 +0100 +++ rapiddisk-9.1.0/debian/dkms 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -PACKAGE_NAME="rapiddisk-dkms" -PACKAGE_VERSION="#MODULE_VERSION#" -MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build" -CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean" -AUTOINSTALL=yes -BUILT_MODULE_NAME[0]="rapiddisk" -BUILT_MODULE_NAME[1]="rapiddisk-cache" -DEST_MODULE_LOCATION[0]=/extra -DEST_MODULE_LOCATION[1]=/extra diff -Nru rapiddisk-9.1.0/debian/docs rapiddisk-9.1.0/debian/docs --- rapiddisk-9.1.0/debian/docs 2023-01-31 14:28:59.000000000 +0100 +++ rapiddisk-9.1.0/debian/docs 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -doc/API.txt diff -Nru rapiddisk-9.1.0/debian/patches/0001-Support-linux-5.19.patch rapiddisk-9.1.0/debian/patches/0001-Support-linux-5.19.patch --- rapiddisk-9.1.0/debian/patches/0001-Support-linux-5.19.patch 2023-01-31 14:28:59.000000000 +0100 +++ rapiddisk-9.1.0/debian/patches/0001-Support-linux-5.19.patch 1970-01-01 01:00:00.000000000 +0100 @@ -1,53 +0,0 @@ -From: Andrea Righi <andrea.ri...@canonical.com> -Subject: [PATCH] Support linux 5.19. -Source: upstream, https://github.com/pkoutoupis/rapiddisk/pull/116/commits/48e901f08fc1199d917d15e4c68b8a6fec822e1a - -Signed-off-by: Andrea Righi <andrea.ri...@canonical.com> ---- - module/rapiddisk.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -Index: rapiddisk-8.2.0/module/rapiddisk.c -=================================================================== ---- rapiddisk-8.2.0.orig/module/rapiddisk.c -+++ rapiddisk-8.2.0/module/rapiddisk.c -@@ -633,6 +633,18 @@ io_error: - #endif - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) -+static inline int bdev_openers(struct block_device *bdev) -+{ -+ return atomic_read(&bdev->bd_openers); -+} -+#else -+static inline int bdev_openers(struct block_device *bdev) -+{ -+ return bdev->bd_openers; -+} -+#endif -+ - static int rdsk_ioctl(struct block_device *bdev, fmode_t mode, - unsigned int cmd, unsigned long arg) - { -@@ -660,7 +672,7 @@ static int rdsk_ioctl(struct block_devic - mutex_lock(&bdev->bd_mutex); - #endif - error = -EBUSY; -- if (bdev->bd_openers <= 1) { -+ if (bdev_openers(bdev) <= 1) { - #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) - #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0) || (defined(RHEL_MAJOR) && RHEL_MAJOR == 8 && RHEL_MINOR >= 4) - invalidate_bdev(bdev); -@@ -805,7 +817,11 @@ static int attach_device(int size) - disk->queue->nr_requests = nr_requests; - disk->queue->limits.discard_granularity = PAGE_SIZE; - disk->queue->limits.max_discard_sectors = UINT_MAX; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) -+ blk_queue_max_discard_sectors(disk->queue, 0); -+#else - blk_queue_flag_set(QUEUE_FLAG_DISCARD, disk->queue); -+#endif - blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue); - #else - rdsk->rdsk_queue->limits.max_sectors = (max_sectors * 2); diff -Nru rapiddisk-9.1.0/debian/patches/0002-Adding-Linux-kernel-6.0-support-133.patch rapiddisk-9.1.0/debian/patches/0002-Adding-Linux-kernel-6.0-support-133.patch --- rapiddisk-9.1.0/debian/patches/0002-Adding-Linux-kernel-6.0-support-133.patch 2023-01-31 14:28:59.000000000 +0100 +++ rapiddisk-9.1.0/debian/patches/0002-Adding-Linux-kernel-6.0-support-133.patch 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -From: Petros Koutoupis <pet...@petroskoutoupis.com> -Date: Wed, 5 Oct 2022 12:47:15 +0000 -Subject: [PATCH] Adding Linux kernel 6.0 support (#133) - -Origin: upstream ---- - module/rapiddisk-cache.c | 4 ++++ - 1 file changed, 4 insertions(+) - -Index: rapiddisk/module/rapiddisk-cache.c -=================================================================== ---- rapiddisk.orig/module/rapiddisk-cache.c -+++ rapiddisk/module/rapiddisk-cache.c -@@ -175,8 +175,12 @@ int dm_io_async_bvec(unsigned int num_re - struct dm_io_request iorq; - - #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0) -+ (rw == WRITE) ? (iorq.bi_opf = REQ_OP_WRITE) : (iorq.bi_opf = REQ_OP_READ); -+#else - iorq.bi_op = rw; - iorq.bi_op_flags = 0; -+#endif - #else - iorq.bi_rw = rw; - #endif diff -Nru rapiddisk-9.1.0/debian/patches/Linux-4.3.patch rapiddisk-9.1.0/debian/patches/Linux-4.3.patch --- rapiddisk-9.1.0/debian/patches/Linux-4.3.patch 1970-01-01 01:00:00.000000000 +0100 +++ rapiddisk-9.1.0/debian/patches/Linux-4.3.patch 2024-08-03 21:15:54.000000000 +0200 @@ -0,0 +1,20 @@ +Author: Andreas Beckmann <a...@debian.org> +Description: fix module build for Linux <4.3 + +--- a/module/rapiddisk.c ++++ b/module/rapiddisk.c +@@ -648,12 +648,14 @@ out: + return; + #endif + #endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0) + io_error: + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0) + bio->bi_status= err; + #else + bio->bi_error = err; + #endif ++#endif + bio_io_error(bio); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0) + #if LINUX_VERSION_CODE < KERNEL_VERSION(5,16,0) diff -Nru rapiddisk-9.1.0/debian/patches/Linux-6.10.patch rapiddisk-9.1.0/debian/patches/Linux-6.10.patch --- rapiddisk-9.1.0/debian/patches/Linux-6.10.patch 1970-01-01 01:00:00.000000000 +0100 +++ rapiddisk-9.1.0/debian/patches/Linux-6.10.patch 2024-08-03 21:15:54.000000000 +0200 @@ -0,0 +1,30 @@ +Author: Andreas Beckmann <a...@debian.org> +Description: fix module build for Linux 6.10 +Bug: https://github.com/pkoutoupis/rapiddisk/issues/187 + +--- a/module/rapiddisk-cache.c ++++ b/module/rapiddisk-cache.c +@@ -1041,7 +1041,11 @@ static int cache_ctr(struct dm_target *t + goto construct_fail5; + } + } else { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) ++ dmc->size = bdev_nr_sectors(dmc->cache_dev->bdev); ++#else + dmc->size = to_sector(dmc->cache_dev->bdev->bd_inode->i_size); ++#endif + } + + if (argc >= 4) { +@@ -1077,7 +1081,11 @@ static int cache_ctr(struct dm_target *t + do_div(tmpsize, dmc->assoc); + dmc->size = tmpsize * dmc->assoc; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) ++ dev_size = bdev_nr_sectors(dmc->cache_dev->bdev); ++#else + dev_size = to_sector(dmc->cache_dev->bdev->bd_inode->i_size); ++#endif + data_size = dmc->size * dmc->block_size; + if (data_size > dev_size) { + DMERR("Requested cache size exceeds the cache device's capacity (%lu>%lu)", diff -Nru rapiddisk-9.1.0/debian/patches/Linux-6.8.patch rapiddisk-9.1.0/debian/patches/Linux-6.8.patch --- rapiddisk-9.1.0/debian/patches/Linux-6.8.patch 1970-01-01 01:00:00.000000000 +0100 +++ rapiddisk-9.1.0/debian/patches/Linux-6.8.patch 2024-08-03 21:15:54.000000000 +0200 @@ -0,0 +1,22 @@ +Author: Andreas Beckmann <a...@debian.org> +Description: fix module build for Linux 6.1.83, 6.6.23, 6.7.11, 6.8.2 +Bug: https://github.com/pkoutoupis/rapiddisk/issues/184 +Bug-Debian: https://bugs.debian.org/1069945 + +--- a/module/rapiddisk-cache.c ++++ b/module/rapiddisk-cache.c +@@ -195,7 +210,14 @@ int dm_io_async_bvec(unsigned int num_re + iorq.notify.context = context; + iorq.client = dmc->io_client; + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,2)) || \ ++ ((LINUX_VERSION_CODE >= KERNEL_VERSION(6,7,11)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6,8,0))) || \ ++ ((LINUX_VERSION_CODE >= KERNEL_VERSION(6,6,23)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6,7,0))) || \ ++ ((LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,83)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0))) ++ return dm_io(&iorq, num_regions, where, NULL, IOPRIO_DEFAULT); ++#else + return dm_io(&iorq, num_regions, where, NULL); ++#endif + } + + static int jobs_init(void) diff -Nru rapiddisk-9.1.0/debian/patches/Linux-6.9.patch rapiddisk-9.1.0/debian/patches/Linux-6.9.patch --- rapiddisk-9.1.0/debian/patches/Linux-6.9.patch 1970-01-01 01:00:00.000000000 +0100 +++ rapiddisk-9.1.0/debian/patches/Linux-6.9.patch 2024-08-03 21:15:54.000000000 +0200 @@ -0,0 +1,26 @@ +Author: Andreas Beckmann <a...@debian.org> +Description: fix module build for Linux 6.9 +Bug: https://github.com/pkoutoupis/rapiddisk/issues/185 + +--- 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); diff -Nru rapiddisk-9.1.0/debian/patches/deduplicate.patch rapiddisk-9.1.0/debian/patches/deduplicate.patch --- rapiddisk-9.1.0/debian/patches/deduplicate.patch 1970-01-01 01:00:00.000000000 +0100 +++ rapiddisk-9.1.0/debian/patches/deduplicate.patch 2024-08-03 21:15:54.000000000 +0200 @@ -0,0 +1,16 @@ +--- 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 diff -Nru rapiddisk-9.1.0/debian/patches/dkms_conf.patch rapiddisk-9.1.0/debian/patches/dkms_conf.patch --- rapiddisk-9.1.0/debian/patches/dkms_conf.patch 1970-01-01 01:00:00.000000000 +0100 +++ rapiddisk-9.1.0/debian/patches/dkms_conf.patch 2024-08-03 21:15:54.000000000 +0200 @@ -0,0 +1,14 @@ +Author: Andreas Beckmann <a...@debian.org> +Description: update dkms.conf + +--- a/module/dkms.conf ++++ b/module/dkms.conf +@@ -5,4 +5,7 @@ BUILT_MODULE_NAME[1]="rapiddisk-cache" + DEST_MODULE_LOCATION[0]="/kernel/rapiddisk/" + DEST_MODULE_LOCATION[1]="/kernel/rapiddisk/" + AUTOINSTALL="yes" +-REMAKE_INITRD="yes" ++ ++# kstrto*() were introduced in v2.6.39-rc1 by "kstrto*: converting strings to ++# integers done (hopefully) right" (33ee3b2e2eb9b4b6c64dcf9ed66e2ac3124e748c) ++BUILD_EXCLUSIVE_KERNEL_MIN="2.6.39" diff -Nru rapiddisk-9.1.0/debian/patches/series rapiddisk-9.1.0/debian/patches/series --- rapiddisk-9.1.0/debian/patches/series 2023-02-03 07:45:15.000000000 +0100 +++ rapiddisk-9.1.0/debian/patches/series 2024-08-03 21:15:54.000000000 +0200 @@ -1,2 +1,6 @@ -#0001-Support-linux-5.19.patch -#0002-Adding-Linux-kernel-6.0-support-133.patch +dkms_conf.patch +Linux-4.3.patch +Linux-6.8.patch +deduplicate.patch +Linux-6.9.patch +Linux-6.10.patch diff -Nru rapiddisk-9.1.0/debian/rapiddisk-dkms.dkms rapiddisk-9.1.0/debian/rapiddisk-dkms.dkms --- rapiddisk-9.1.0/debian/rapiddisk-dkms.dkms 1970-01-01 01:00:00.000000000 +0100 +++ rapiddisk-9.1.0/debian/rapiddisk-dkms.dkms 2024-08-03 21:15:54.000000000 +0200 @@ -0,0 +1 @@ +module/dkms.conf diff -Nru rapiddisk-9.1.0/debian/rapiddisk-dkms.docs rapiddisk-9.1.0/debian/rapiddisk-dkms.docs --- rapiddisk-9.1.0/debian/rapiddisk-dkms.docs 1970-01-01 01:00:00.000000000 +0100 +++ rapiddisk-9.1.0/debian/rapiddisk-dkms.docs 2024-08-03 21:15:54.000000000 +0200 @@ -0,0 +1,2 @@ +doc/API.txt +module/rapiddisk.txt diff -Nru rapiddisk-9.1.0/debian/rules rapiddisk-9.1.0/debian/rules --- rapiddisk-9.1.0/debian/rules 2023-01-31 14:28:59.000000000 +0100 +++ rapiddisk-9.1.0/debian/rules 2024-08-03 21:15:54.000000000 +0200 @@ -27,6 +27,5 @@ # dh_auto_install # -rm debian/tmp/lib/modules/*/kernel/drivers/block/rapiddisk*.ko -override_dh_dkms-indep: - dh_install module/* usr/src/$(pdkms)-$(DEB_VERSION_UPSTREAM) - dh_dkms -V $(DEB_VERSION_UPSTREAM) +execute_after_dh_install-indep: + dh_install -p$(pdkms) module/Makefile module/*.c usr/src/$(sname)-$(DEB_VERSION_UPSTREAM)