File: compat-4.8.patch

package info (click to toggle)
flashcache 3.1.3%2Bgit20150701-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,116 kB
  • ctags: 1,310
  • sloc: ansic: 9,797; sh: 403; perl: 329; makefile: 201
file content (121 lines) | stat: -rw-r--r-- 4,268 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
Description: Fix FTBS on target systems running 4.8+ kernels
 The bi_rw field was split into bi_op and bi_op_flags. Right now it looked
 like the created IOs would be only plain READ or WRITE ones. If this ever
 changes, then the whole call chain needs some update.
 While looking at the source fix one warning and one potential bug of not
 properly guarding an if section with { }.
Author: Stefan Bader <stefan.bader@canonical.com>

Index: flashcache-3.1.3+git20150701/src/flashcache_ioctl.c
===================================================================
--- flashcache-3.1.3+git20150701.orig/src/flashcache_ioctl.c	2016-09-22 12:19:34.000000000 +0200
+++ flashcache-3.1.3+git20150701/src/flashcache_ioctl.c	2016-09-22 12:50:04.946286707 +0200
@@ -541,7 +541,6 @@ flashcache_message(struct dm_target *ti,
 
 	/* Decode the sub-command. */
 	if (strcmp(argv[1], "add") == 0) {
-		int rr;
 		if (argc != 3)
 			return -EINVAL;
 
Index: flashcache-3.1.3+git20150701/src/flashcache_kcopy.c
===================================================================
--- flashcache-3.1.3+git20150701.orig/src/flashcache_kcopy.c	2015-07-02 01:09:43.000000000 +0200
+++ flashcache-3.1.3+git20150701/src/flashcache_kcopy.c	2016-09-22 12:50:04.962286707 +0200
@@ -279,7 +279,11 @@ dm_io_async_pagelist_IO(struct flashcach
 {
 	struct dm_io_request iorq;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
 	iorq.bi_rw = rw;
+#else
+	iorq.bi_op = rw;
+#endif
 	iorq.mem.type = DM_IO_PAGE_LIST;
 	iorq.mem.ptr.pl = pl;
 	iorq.mem.offset = 0;
Index: flashcache-3.1.3+git20150701/src/flashcache_main.c
===================================================================
--- flashcache-3.1.3+git20150701.orig/src/flashcache_main.c	2015-07-02 01:09:43.000000000 +0200
+++ flashcache-3.1.3+git20150701/src/flashcache_main.c	2016-09-22 12:50:04.962286707 +0200
@@ -116,7 +116,11 @@ int dm_io_async_bvec_pl(unsigned int num
 {
 	struct dm_io_request iorq;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
 	iorq.bi_rw = rw;
+#else
+	iorq.bi_op = rw;
+#endif
 	iorq.mem.type = DM_IO_PAGE_LIST;
 	iorq.mem.ptr.pl = pl;
 	iorq.mem.offset = 0;
@@ -140,7 +144,11 @@ int dm_io_async_bvec(unsigned int num_re
 {
 	struct dm_io_request iorq;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
 	iorq.bi_rw = rw;
+#else
+	iorq.bi_op = rw;
+#endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
 	iorq.mem.type = DM_IO_BIO;
 	iorq.mem.ptr.bio = bio;	
@@ -325,7 +333,7 @@ flashcache_io_callback(unsigned long err
 			}
 		} else {
 			dmc->flashcache_errors.ssd_write_errors++;
-			if (dmc->cache_mode == FLASHCACHE_WRITE_THROUGH)
+			if (dmc->cache_mode == FLASHCACHE_WRITE_THROUGH) {
 				/* 
 				 * We don't know if the IO failed because of a ssd write
 				 * error or a disk write error. Bump up both.
@@ -335,6 +343,7 @@ flashcache_io_callback(unsigned long err
 				 */
 			        disk_error = -EIO;
 				dmc->flashcache_errors.disk_write_errors++;
+			}
 		}
 		break;
 	}
@@ -2052,7 +2061,11 @@ flashcache_write(struct cache_c *dmc, st
 #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_rw & REQ_FLUSH)
+#else
+#define bio_barrier(bio)	((bio)->bi_opf & REQ_PREFLUSH)
+#endif
 #endif
 #endif
 #endif
Index: flashcache-3.1.3+git20150701/src/flashcache_subr.c
===================================================================
--- flashcache-3.1.3+git20150701.orig/src/flashcache_subr.c	2016-09-22 12:19:34.000000000 +0200
+++ flashcache-3.1.3+git20150701/src/flashcache_subr.c	2016-09-22 12:50:04.962286707 +0200
@@ -848,7 +848,11 @@ flashcache_dm_io_async_vm(struct cache_c
 	unsigned long error_bits = 0;
 	int error;
 	struct dm_io_request io_req = {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
 		.bi_rw = rw,
+#else
+		.bi_op = rw,
+#endif
 		.mem.type = DM_IO_VMA,
 		.mem.ptr.vma = data,
 		.mem.offset = 0,
@@ -936,7 +940,11 @@ flashcache_dm_io_sync_vm(struct cache_c
 	unsigned long error_bits = 0;
 	int error;
 	struct dm_io_request io_req = {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
 		.bi_rw = rw,
+#else
+		.bi_op = rw,
+#endif
 		.mem.type = DM_IO_VMA,
 		.mem.ptr.vma = data,
 		.mem.offset = 0,