From da6633129150a89ddb4f0fc147f4f91b31593c14 Mon Sep 17 00:00:00 2001 From: Petros Koutoupis Date: Fri, 28 Oct 2016 14:23:34 -0500 Subject: [PATCH] Adding 4.8 & 4.9 kernel support and releasing 4.4 --- CHANGELOG | 5 ++++ module/Makefile | 2 +- module/dkms.conf | 2 +- module/rapiddisk-cache.c | 14 +++++++++--- module/rapiddisk.c | 33 +++++++++++++++++++++++++-- pkg-mgmt/debian/changelog | 5 ++++ pkg-mgmt/debian/control | 2 +- pkg-mgmt/debian/postinst | 6 ++--- pkg-mgmt/debian/prerm | 2 +- pkg-mgmt/spec/rapiddisk.spec.opensuse | 5 +++- pkg-mgmt/spec/rapiddisk.spec.rhel | 5 +++- src/Makefile | 0 src/archive.c | 0 src/common.h | 2 +- src/core.c | 0 src/crypt.c | 0 src/main.c | 0 17 files changed, 68 insertions(+), 15 deletions(-) mode change 100755 => 100644 module/Makefile mode change 100755 => 100644 src/Makefile mode change 100755 => 100644 src/archive.c mode change 100755 => 100644 src/common.h mode change 100755 => 100644 src/core.c mode change 100755 => 100644 src/crypt.c mode change 100755 => 100644 src/main.c diff --git a/CHANGELOG b/CHANGELOG index a9c8de0..7ce2d18 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +*** Release 4.4 *** + +- kernel: Update to 4.8 and 4.9 kernels. +- build: Cleaned up Makefiles (thanks Marcel!) + *** Release 4.3 *** - kernel: Add support for the 4.7 kernel (patch supplied by Marcel Huber) diff --git a/module/Makefile b/module/Makefile old mode 100755 new mode 100644 index 583a49a..df4ada4 --- a/module/Makefile +++ b/module/Makefile @@ -1,4 +1,4 @@ -VERSION = 4.3 +VERSION = 4.4 ifeq ($(KSRC),) KSRC := /lib/modules/$(shell uname -r)/build diff --git a/module/dkms.conf b/module/dkms.conf index 94ebd8e..2b508bd 100644 --- a/module/dkms.conf +++ b/module/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="rapiddisk" -PACKAGE_VERSION="4.3" +PACKAGE_VERSION="4.4" BUILT_MODULE_NAME[0]="rapiddisk" BUILT_MODULE_NAME[1]="rapiddisk-cache" DEST_MODULE_LOCATION[0]="/kernel/rapiddisk/" diff --git a/module/rapiddisk-cache.c b/module/rapiddisk-cache.c index ead04a8..95c5963 100644 --- a/module/rapiddisk-cache.c +++ b/module/rapiddisk-cache.c @@ -47,7 +47,7 @@ } \ } while (0) -#define VERSION_STR "4.3" +#define VERSION_STR "4.4" #define DM_MSG_PREFIX "rapiddisk-cache" #define READCACHE 1 @@ -167,7 +167,11 @@ int dm_io_async_bvec(unsigned int num_regions, struct dm_io_region *where, struct cache_context *dmc = job->dmc; struct dm_io_request iorq; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) + iorq.bi_op = rw; +#else iorq.bi_rw = rw; +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0) iorq.mem.type = DM_IO_BIO; iorq.mem.ptr.bio = bio; @@ -768,10 +772,14 @@ static void cache_write(struct cache_context *dmc, struct bio *bio) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37) #define bio_barrier(bio) ((bio)->bi_rw & REQ_HARDBARRIER) #else +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) +#define bio_barrier(bio) ((bio)->bi_opf & REQ_PREFLUSH) +#else #define bio_barrier(bio) ((bio)->bi_rw & REQ_FLUSH) #endif #endif #endif +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) int rc_map(struct dm_target *ti, struct bio *bio) @@ -1186,7 +1194,7 @@ cache_status(struct dm_target *ti, status_type_t type, unsigned status_flags, static struct target_type cache_target = { .name = "rapiddisk-cache", - .version = {4, 3, 0}, + .version = {4, 4, 0}, .module = THIS_MODULE, .ctr = cache_ctr, .dtr = cache_dtr, @@ -1228,4 +1236,4 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Petros Koutoupis "); MODULE_DESCRIPTION("RapidDisk-Cache DM target is a write-through caching target with RapidDisk volumes."); MODULE_VERSION(VERSION_STR); -MODULE_INFO(Copyright, "Copyright 2010 - 2015 Petros Koutoupis"); +MODULE_INFO(Copyright, "Copyright 2010 - 2016 Petros Koutoupis"); diff --git a/module/rapiddisk.c b/module/rapiddisk.c index ef6fccf..c38306c 100644 --- a/module/rapiddisk.c +++ b/module/rapiddisk.c @@ -29,7 +29,7 @@ #include #include -#define VERSION_STR "4.3" +#define VERSION_STR "4.4" #define PREFIX "rapiddisk" #define BYTES_PER_SECTOR 512 #define MAX_RDSKS 128 @@ -94,7 +94,11 @@ module_param(rd_max_nr, int, S_IRUGO); MODULE_PARM_DESC(rd_max_nr, " Maximum number of RAM Disks. (Default = 128)"); static int rdsk_do_bvec(struct rdsk_device *, struct page *, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) + unsigned int, unsigned int, bool, sector_t); +#else unsigned int, unsigned int, int, sector_t); +#endif static int rdsk_ioctl(struct block_device *, fmode_t, unsigned int, unsigned long); #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) @@ -422,12 +426,20 @@ static void copy_from_rdsk(void *dst, struct rdsk_device *rdsk, } static int rdsk_do_bvec(struct rdsk_device *rdsk, struct page *page, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) + unsigned int len, unsigned int off, bool is_write, +#else unsigned int len, unsigned int off, int rw, +#endif sector_t sector){ void *mem; int err = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) + if (is_write) { +#else if (rw != READ) { +#endif err = copy_to_rdsk_setup(rdsk, sector, len); if (err) goto out; @@ -437,7 +449,11 @@ static int rdsk_do_bvec(struct rdsk_device *rdsk, struct page *page, #else mem = kmap_atomic(page, KM_USER0); #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) + if (!is_write) { +#else if (rw == READ) { +#endif copy_from_rdsk(mem + off, rdsk, sector, len); flush_dcache_page(page); } else { @@ -466,7 +482,9 @@ rdsk_make_request(struct request_queue *q, struct bio *bio) { struct block_device *bdev = bio->bi_bdev; struct rdsk_device *rdsk = bdev->bd_disk->private_data; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0) int rw; +#endif sector_t sector; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0) struct bio_vec bvec; @@ -490,8 +508,12 @@ rdsk_make_request(struct request_queue *q, struct bio *bio) #endif err = 0; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,336) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) + if (unlikely(bio_op(bio) == REQ_OP_DISCARD)) { +#else if (unlikely(bio->bi_rw & REQ_DISCARD)) { +#endif if (sector & ((PAGE_SIZE >> SECTOR_SHIFT) - 1) || #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0) bio->bi_iter.bi_size & ~PAGE_MASK) @@ -511,16 +533,23 @@ rdsk_make_request(struct request_queue *q, struct bio *bio) goto out; } #endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0) rw = bio_rw(bio); if (rw == READA) rw = READ; +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0) bio_for_each_segment(bvec, bio, iter) { unsigned int len = bvec.bv_len; err = rdsk_do_bvec(rdsk, bvec.bv_page, len, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) + bvec.bv_offset, op_is_write(bio_op(bio)), sector); +#else bvec.bv_offset, rw, sector); +#endif #else bio_for_each_segment(bvec, bio, i) { unsigned int len = bvec->bv_len; diff --git a/pkg-mgmt/debian/changelog b/pkg-mgmt/debian/changelog index 07d1026..eeeafbe 100644 --- a/pkg-mgmt/debian/changelog +++ b/pkg-mgmt/debian/changelog @@ -1,3 +1,8 @@ +rapiddisk (4.4-1) released; urgency=medium + +* kernel: Update to 4.8 and 4.9 kernels. +* build: Cleaned up Makefiles (thanks Marcel!) + rapiddisk (4.3-1) released; urgency=medium * kernel: Add support for the 4.7 kernel (patch supplied by Marcel Huber) diff --git a/pkg-mgmt/debian/control b/pkg-mgmt/debian/control index 7c3e5d7..0eda860 100755 --- a/pkg-mgmt/debian/control +++ b/pkg-mgmt/debian/control @@ -1,5 +1,5 @@ Package: rapiddisk -Version: 4.3-1 +Version: 4.4-1 Section: base Priority: optional Architecture: amd64 diff --git a/pkg-mgmt/debian/postinst b/pkg-mgmt/debian/postinst index 8e56bda..b4ce3d0 100755 --- a/pkg-mgmt/debian/postinst +++ b/pkg-mgmt/debian/postinst @@ -16,9 +16,9 @@ fi case "$1" in configure) - dkms add -m rapiddisk -v 4.3 - dkms build -m rapiddisk -v 4.3 - dkms install -m rapiddisk -v 4.3 + dkms add -m rapiddisk -v 4.4 + dkms build -m rapiddisk -v 4.4 + dkms install -m rapiddisk -v 4.4 echo "rapiddisk max_sectors=2048 nr_requests=1024" >> /etc/modules echo "rapiddisk-cache" >> /etc/modules echo "dm_mod" >> /etc/modules diff --git a/pkg-mgmt/debian/prerm b/pkg-mgmt/debian/prerm index 39af0f0..bfdb0ab 100755 --- a/pkg-mgmt/debian/prerm +++ b/pkg-mgmt/debian/prerm @@ -14,7 +14,7 @@ fi case "$1" in remove|upgrade|deconfigure) - dkms remove -m rapiddisk -v 4.3 --all + dkms remove -m rapiddisk -v 4.4 --all ;; failed-upgrade) diff --git a/pkg-mgmt/spec/rapiddisk.spec.opensuse b/pkg-mgmt/spec/rapiddisk.spec.opensuse index 90c5ff9..f32e93b 100644 --- a/pkg-mgmt/spec/rapiddisk.spec.opensuse +++ b/pkg-mgmt/spec/rapiddisk.spec.opensuse @@ -1,6 +1,6 @@ Summary: The RapidDisk software defined advanced RAM drive and storage caching solution. Name: rapiddisk -Version: 4.3 +Version: 4.4 Release: 1 License: General Public License Version 2 Group: Applications/System @@ -85,6 +85,9 @@ rm -rf %{buildroot} %doc %attr(0444,root,root) /usr/share/man/man1/* %changelog +* Fri Oct 28 2016 Petros Koutoupis +- kernel: Update to 4.8 and 4.9 kernels. +- build: Cleaned up Makefiles (thanks Marcel!) * Fri Aug 12 2016 Petros Koutoupis - kernel: Add support for the 4.7 kernel (patch supplied by Marcel Huber) * Sun May 22 2016 Petros Koutoupis diff --git a/pkg-mgmt/spec/rapiddisk.spec.rhel b/pkg-mgmt/spec/rapiddisk.spec.rhel index 35feb46..bf2c286 100644 --- a/pkg-mgmt/spec/rapiddisk.spec.rhel +++ b/pkg-mgmt/spec/rapiddisk.spec.rhel @@ -1,6 +1,6 @@ Summary: The RapidDisk software defined advanced RAM drive and storage caching solution. Name: rapiddisk -Version: 4.3 +Version: 4.4 Release: 1 License: General Public License Version 2 Group: Applications/System @@ -85,6 +85,9 @@ rm -rf %{buildroot} %doc %attr(0444,root,root) /usr/share/man/man1/* %changelog +* Fri Oct 28 2016 Petros Koutoupis +- kernel: Update to 4.8 and 4.9 kernels. +- build: Cleaned up Makefiles (thanks Marcel!) * Fri Aug 12 2016 Petros Koutoupis - kernel: Add support for the 4.7 kernel (patch supplied by Marcel Huber) * Sun May 22 2016 Petros Koutoupis diff --git a/src/Makefile b/src/Makefile old mode 100755 new mode 100644 diff --git a/src/archive.c b/src/archive.c old mode 100755 new mode 100644 diff --git a/src/common.h b/src/common.h old mode 100755 new mode 100644 index 72cbaba..c1a4b8c --- a/src/common.h +++ b/src/common.h @@ -26,7 +26,7 @@ #define UTIL "rapiddisk" #define COPYRIGHT "Copyright 2011-2016 Petros Koutoupis" -#define VERSION_NUM "4.3" +#define VERSION_NUM "4.4" #define SUCCESS 0x0 #define NAMELEN 0x100 #define BYTES_PER_SECTOR 0x200 diff --git a/src/core.c b/src/core.c old mode 100755 new mode 100644 diff --git a/src/crypt.c b/src/crypt.c old mode 100755 new mode 100644 diff --git a/src/main.c b/src/main.c old mode 100755 new mode 100644