Package: dm-writeboost
Version: 2.2.3-1
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu yakkety ubuntu-patch

Dear Maintainer,

with kernel 4.8 the bi_rw element of the request queue struct was
replaced by bi_op and bi_op_flags.
The additional compat code ensures the module with also compile
with 4.8 kernels running on the target DKMS system. Without this
the dkms install step fails for 4.8 kernels.

In Ubuntu, the attached patch was applied to achieve the following:

  * Fix FTBS in dkms with 4.8+ kernels (LP: #1625054).


Thanks for considering the patch.


-- System Information:
Debian Release: jessie/sid
  APT prefers trusty-updates
  APT policy: (500, 'trusty-updates'), (500, 'trusty-security'), (500, 
'trusty-proposed'), (500, 'trusty'), (100, 'trusty-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13.0-96-generic (SMP w/8 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru dm-writeboost-2.2.3/debian/changelog dm-writeboost-2.2.3/debian/changelog
diff -Nru dm-writeboost-2.2.3/debian/patches/add-compat-4.8.patch dm-writeboost-2.2.3/debian/patches/add-compat-4.8.patch
--- dm-writeboost-2.2.3/debian/patches/add-compat-4.8.patch	1970-01-01 01:00:00.000000000 +0100
+++ dm-writeboost-2.2.3/debian/patches/add-compat-4.8.patch	2016-09-21 15:51:36.000000000 +0200
@@ -0,0 +1,226 @@
+Description: Fix FTBS of DKMS package with 4.8+ kernels
+ Add compat code to handle rename/split of bi_rw.
+Author: Stefan Bader <stefan.ba...@canonical.com>
+Index: dm-writeboost-2.2.3/src/dm-writeboost-daemon.c
+===================================================================
+--- dm-writeboost-2.2.3.orig/src/dm-writeboost-daemon.c	2016-08-02 12:22:48.000000000 +0200
++++ dm-writeboost-2.2.3/src/dm-writeboost-daemon.c	2016-09-21 14:04:10.461288077 +0200
+@@ -77,7 +77,11 @@ void flush_proc(struct work_struct *work
+ 
+ 	struct dm_io_request io_req = {
+ 		.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 		.bi_rw = WRITE,
++#else
++		.bi_op = REQ_OP_WRITE,
++#endif
+ 		.notify.fn = NULL,
+ 		.mem.type = DM_IO_VMA,
+ 		.mem.ptr.addr = rambuf->data,
+@@ -143,7 +147,11 @@ static void submit_writeback_io(struct w
+ 	if (writeback_io->data_bits == 255) {
+ 		struct dm_io_request io_req_w = {
+ 			.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 			.bi_rw = WRITE,
++#else
++			.bi_op = REQ_OP_WRITE,
++#endif
+ 			.notify.fn = writeback_endio,
+ 			.notify.context = wb,
+ 			.mem.type = DM_IO_VMA,
+@@ -168,7 +176,11 @@ static void submit_writeback_io(struct w
+ 
+ 			io_req_w = (struct dm_io_request) {
+ 				.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 				.bi_rw = WRITE,
++#else
++				.bi_op = REQ_OP_WRITE,
++#endif
+ 				.notify.fn = writeback_endio,
+ 				.notify.context = wb,
+ 				.mem.type = DM_IO_VMA,
+@@ -259,7 +271,11 @@ static int fill_writeback_seg(struct wb_
+ 
+ 	struct dm_io_request io_req_r = {
+ 		.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 		.bi_rw = READ,
++#else
++		.bi_op = REQ_OP_READ,
++#endif
+ 		.notify.fn = NULL,
+ 		.mem.type = DM_IO_VMA,
+ 		.mem.ptr.addr = writeback_seg->buf,
+@@ -483,7 +499,12 @@ static void update_superblock_record(str
+ 
+ 	io_req = (struct dm_io_request) {
+ 		.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 		.bi_rw = WRITE_FUA,
++#else
++		.bi_op = REQ_OP_WRITE,
++		.bi_op_flags = WRITE_FUA,
++#endif
+ 		.notify.fn = NULL,
+ 		.mem.type = DM_IO_KMEM,
+ 		.mem.ptr.addr = buf,
+Index: dm-writeboost-2.2.3/src/dm-writeboost-metadata.c
+===================================================================
+--- dm-writeboost-2.2.3.orig/src/dm-writeboost-metadata.c	2016-08-02 12:22:48.000000000 +0200
++++ dm-writeboost-2.2.3/src/dm-writeboost-metadata.c	2016-09-21 14:04:10.473288076 +0200
+@@ -321,7 +321,11 @@ static int read_superblock_header(struct
+ 
+ 	io_req_sup = (struct dm_io_request) {
+ 		.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 		.bi_rw = READ,
++#else
++		.bi_op = REQ_OP_READ,
++#endif
+ 		.notify.fn = NULL,
+ 		.mem.type = DM_IO_KMEM,
+ 		.mem.ptr.addr = buf,
+@@ -386,7 +390,12 @@ static int format_superblock_header(stru
+ 
+ 	io_req_sup = (struct dm_io_request) {
+ 		.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 		.bi_rw = WRITE_FUA,
++#else
++		.bi_op = REQ_OP_WRITE,
++		.bi_op_flags = WRITE_FUA,
++#endif
+ 		.notify.fn = NULL,
+ 		.mem.type = DM_IO_KMEM,
+ 		.mem.ptr.addr = buf,
+@@ -480,7 +489,11 @@ static int format_all_segment_headers(st
+ 	for (i = 0; i < wb->nr_segments; i++) {
+ 		struct dm_io_request io_req_seg = {
+ 			.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 			.bi_rw = WRITE,
++#else
++			.bi_op = REQ_OP_WRITE,
++#endif
+ 			.notify.fn = format_segmd_endio,
+ 			.notify.context = &context,
+ 			.mem.type = DM_IO_KMEM,
+@@ -654,7 +667,11 @@ static int read_superblock_record(struct
+ 
+ 	io_req = (struct dm_io_request) {
+ 		.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 		.bi_rw = READ,
++#else
++		.bi_op = REQ_OP_READ,
++#endif
+ 		.notify.fn = NULL,
+ 		.mem.type = DM_IO_KMEM,
+ 		.mem.ptr.addr = buf,
+@@ -683,7 +700,11 @@ static int read_whole_segment(void *buf,
+ {
+ 	struct dm_io_request io_req = {
+ 		.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 		.bi_rw = READ,
++#else
++		.bi_op = REQ_OP_READ,
++#endif
+ 		.notify.fn = NULL,
+ 		.mem.type = DM_IO_VMA,
+ 		.mem.ptr.addr = buf,
+@@ -775,7 +796,11 @@ static int apply_metablock_device(struct
+ 
+ 			io_req = (struct dm_io_request) {
+ 				.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 				.bi_rw = WRITE,
++#else
++				.bi_op = REQ_OP_WRITE,
++#endif
+ 				.notify.fn = NULL,
+ 				.mem.type = DM_IO_KMEM,
+ 				.mem.ptr.addr = wio.data + (i << 9),
+@@ -826,7 +851,11 @@ static int read_segment_header(void *buf
+ {
+ 	struct dm_io_request io_req = {
+ 		.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 		.bi_rw = READ,
++#else
++		.bi_op = REQ_OP_READ,
++#endif
+ 		.notify.fn = NULL,
+ 		.mem.type = DM_IO_KMEM,
+ 		.mem.ptr.addr = buf,
+Index: dm-writeboost-2.2.3/src/dm-writeboost-target.c
+===================================================================
+--- dm-writeboost-2.2.3.orig/src/dm-writeboost-target.c	2016-08-02 12:22:48.000000000 +0200
++++ dm-writeboost-2.2.3/src/dm-writeboost-target.c	2016-09-21 14:05:17.625287422 +0200
+@@ -106,9 +106,16 @@ int wb_io_internal(struct wb_device *wb,
+ 			eb = *err_bits;
+ 
+ 		format_dev_t(buf, dev);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 		DMERR("%s() I/O error(%d), bits(%lu), dev(%s), sector(%llu), rw(%d)",
+ 		      caller, err, eb,
+ 		      buf, (unsigned long long) regions->sector, io_req->bi_rw);
++#else
++		DMERR("%s() I/O error(%d), bits(%lu), dev(%s), sector(%llu), op(%d), op_flags(%d)",
++		      caller, err, eb,
++		      buf, (unsigned long long) regions->sector,
++		      io_req->bi_op, io_req->bi_op_flags);
++#endif
+ 	}
+ 
+ 	return err;
+@@ -532,7 +539,11 @@ static int fill_payload_by_backing(struc
+ 
+ 	io_req = (struct dm_io_request) {
+ 		.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 		.bi_rw = READ,
++#else
++		.bi_op = REQ_OP_READ,
++#endif
+ 		.notify.fn = NULL,
+ 		.mem.type = DM_IO_KMEM,
+ 		.mem.ptr.addr = buf + (offset << 9),
+@@ -584,7 +595,11 @@ static void *read_mb(struct wb_device *w
+ 
+ 		io_req = (struct dm_io_request) {
+ 			.client = wb->io_client,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 			.bi_rw = READ,
++#else
++			.bi_op = REQ_OP_READ,
++#endif
+ 			.notify.fn = NULL,
+ 			.mem.type = DM_IO_KMEM,
+ 			.mem.ptr.addr = result + (i << 9),
+@@ -828,7 +843,11 @@ static int complete_process_write(struct
+ 	 * bio with REQ_FUA has data.
+ 	 * For such bio, we first treat it like a normal bio and then as a REQ_FLUSH bio.
+ 	 */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 	if (bio->bi_rw & REQ_FUA) {
++#else
++	if (bio->bi_opf & REQ_FUA) {
++#endif
+ 		queue_barrier_io(wb, bio);
+ 		return DM_MAPIO_SUBMITTED;
+ 	}
+@@ -1012,7 +1031,11 @@ static int writeboost_map(struct dm_targ
+ 	struct per_bio_data *pbd = per_bio_data(wb, bio);
+ 	pbd->type = PBD_NONE;
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 	if (bio->bi_rw & REQ_FLUSH)
++#else
++	if (bio->bi_opf & REQ_PREFLUSH)
++#endif
+ 		return process_flush_bio(wb, bio);
+ 
+ 	return process_bio(wb, bio);
diff -Nru dm-writeboost-2.2.3/debian/patches/series dm-writeboost-2.2.3/debian/patches/series
--- dm-writeboost-2.2.3/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ dm-writeboost-2.2.3/debian/patches/series	2016-09-21 14:03:20.000000000 +0200
@@ -0,0 +1 @@
+add-compat-4.8.patch

Reply via email to