summaryrefslogtreecommitdiffstats
path: root/testing/flashcache-grsec/kernel-3.18.patch
blob: ba0dc631a35aba9f2e160fd7466189a2daf8f9d8 (plain)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
From 387fce7bf2143b55147ce4822cd68f694c0bc49a Mon Sep 17 00:00:00 2001
From: Mohan Srinivasan <mohan@fb.com>
Date: Mon, 3 Nov 2014 11:57:38 -0800
Subject: [PATCH] 3.17. 3.18 compilation fixes.

Summary:
3.17. 3.18 compilation fixes.

Test Plan:

Reviewers:

CC:

Task ID: #

Blame Rev:
---
 src/flashcache_conf.c   | 32 ++++++++++++++++++++++++++++-
 src/flashcache_procfs.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/src/flashcache_conf.c b/src/flashcache_conf.c
index 36d1e25..ad20539 100644
--- a/src/flashcache_conf.c
+++ b/src/flashcache_conf.c
@@ -91,12 +91,14 @@ static void flashcache_sync_for_remove(struct cache_c *dmc);
 
 extern char *flashcache_sw_version;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
 static int
 flashcache_wait_schedule(void *unused)
 {
 	schedule();
 	return 0;
 }
+#endif
 
 static int 
 flashcache_jobs_init(void)
@@ -1222,13 +1224,21 @@ flashcache_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		seq_io_move_to_lruhead(dmc, &dmc->seq_recent_ios[i]);
 	}
 	dmc->seq_io_tail = &dmc->seq_recent_ios[0];
-
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
 	(void)wait_on_bit_lock(&flashcache_control->synch_flags, FLASHCACHE_UPDATE_LIST,
 			       flashcache_wait_schedule, TASK_UNINTERRUPTIBLE);
+#else
+	(void)wait_on_bit_lock(&flashcache_control->synch_flags, FLASHCACHE_UPDATE_LIST,
+			       TASK_UNINTERRUPTIBLE);
+#endif
 	dmc->next_cache = cache_list_head;
 	cache_list_head = dmc;
 	clear_bit(FLASHCACHE_UPDATE_LIST, &flashcache_control->synch_flags);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
 	smp_mb__after_clear_bit();
+#else
+	smp_mb__after_atomic();
+#endif
 	wake_up_bit(&flashcache_control->synch_flags, FLASHCACHE_UPDATE_LIST);
 
 	for (i = 0 ; i < dmc->size ; i++) {
@@ -1438,10 +1448,16 @@ flashcache_dtr(struct dm_target *ti)
 	VERIFY(dmc->num_blacklist_pids == 0);
 	dm_put_device(ti, dmc->disk_dev);
 	dm_put_device(ti, dmc->cache_dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
 	(void)wait_on_bit_lock(&flashcache_control->synch_flags, 
 			       FLASHCACHE_UPDATE_LIST,
 			       flashcache_wait_schedule, 
 			       TASK_UNINTERRUPTIBLE);
+#else
+	(void)wait_on_bit_lock(&flashcache_control->synch_flags, 
+			       FLASHCACHE_UPDATE_LIST,
+			       TASK_UNINTERRUPTIBLE);
+#endif
 	nodepp = &cache_list_head;
 	while (*nodepp != NULL) {
 		if (*nodepp == dmc) {
@@ -1451,7 +1467,11 @@ flashcache_dtr(struct dm_target *ti)
 		nodepp = &((*nodepp)->next_cache);
 	}
 	clear_bit(FLASHCACHE_UPDATE_LIST, &flashcache_control->synch_flags);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
 	smp_mb__after_clear_bit();
+#else
+	smp_mb__after_atomic();
+#endif
 	wake_up_bit(&flashcache_control->synch_flags, FLASHCACHE_UPDATE_LIST);
 	kfree(dmc);
 }
@@ -1735,10 +1755,16 @@ flashcache_notify_reboot(struct notifier_block *this,
 {
 	struct cache_c *dmc;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
 	(void)wait_on_bit_lock(&flashcache_control->synch_flags, 
 			       FLASHCACHE_UPDATE_LIST,
 			       flashcache_wait_schedule, 
 			       TASK_UNINTERRUPTIBLE);
+#else
+	(void)wait_on_bit_lock(&flashcache_control->synch_flags, 
+			       FLASHCACHE_UPDATE_LIST,
+			       TASK_UNINTERRUPTIBLE);
+#endif
 	for (dmc = cache_list_head ; 
 	     dmc != NULL ; 
 	     dmc = dmc->next_cache) {
@@ -1750,7 +1776,11 @@ flashcache_notify_reboot(struct notifier_block *this,
 		}
 	}
 	clear_bit(FLASHCACHE_UPDATE_LIST, &flashcache_control->synch_flags);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
 	smp_mb__after_clear_bit();
+#else
+	smp_mb__after_atomic();
+#endif
 	wake_up_bit(&flashcache_control->synch_flags, FLASHCACHE_UPDATE_LIST);
 	return NOTIFY_DONE;
 }
diff --git a/src/flashcache_procfs.c b/src/flashcache_procfs.c
index 2ff33c0..23c5a81 100644
--- a/src/flashcache_procfs.c
+++ b/src/flashcache_procfs.c
@@ -70,12 +70,18 @@ static char *flashcache_cons_sysctl_devname(struct cache_c *dmc);
 #define FLASHCACHE_PROC_ROOTDIR_NAME	"flashcache"
 
 static int
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+flashcache_io_latency_init(struct ctl_table *table, int write,
+			   void __user *buffer,
+			   size_t *length, loff_t *ppos)
+#else
 flashcache_io_latency_init(ctl_table *table, int write,
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
 			   struct file *file,
 #endif
 			   void __user *buffer,
 			   size_t *length, loff_t *ppos)
+#endif
 {
 	struct cache_c *dmc = (struct cache_c *)table->extra1;
 
@@ -97,12 +103,18 @@ flashcache_io_latency_init(ctl_table *table, int write,
 }
 
 static int 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+flashcache_sync_sysctl(struct ctl_table *table, int write,
+		       void __user *buffer, 
+		       size_t *length, loff_t *ppos)
+#else
 flashcache_sync_sysctl(ctl_table *table, int write,
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
 		       struct file *file, 
 #endif
 		       void __user *buffer, 
 		       size_t *length, loff_t *ppos)
+#endif
 {
 	struct cache_c *dmc = (struct cache_c *)table->extra1;
 
@@ -123,12 +135,18 @@ flashcache_sync_sysctl(ctl_table *table, int write,
 }
 
 static int 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+flashcache_zerostats_sysctl(struct ctl_table *table, int write,
+			    void __user *buffer, 
+			    size_t *length, loff_t *ppos)
+#else
 flashcache_zerostats_sysctl(ctl_table *table, int write,
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
 			    struct file *file, 
 #endif
 			    void __user *buffer, 
 			    size_t *length, loff_t *ppos)
+#endif
 {
 	struct cache_c *dmc = (struct cache_c *)table->extra1;
 
@@ -151,12 +169,18 @@ flashcache_zerostats_sysctl(ctl_table *table, int write,
 }
 
 static int 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+flashcache_fallow_clean_speed_sysctl(struct ctl_table *table, int write,
+				     void __user *buffer, 
+				     size_t *length, loff_t *ppos)
+#else
 flashcache_fallow_clean_speed_sysctl(ctl_table *table, int write,
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
 				     struct file *file, 
 #endif
 				     void __user *buffer, 
 				     size_t *length, loff_t *ppos)
+#endif
 {
 	struct cache_c *dmc = (struct cache_c *)table->extra1;
 
@@ -176,12 +200,18 @@ flashcache_fallow_clean_speed_sysctl(ctl_table *table, int write,
 }
 
 static int
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+flashcache_dirty_thresh_sysctl(struct ctl_table *table, int write,
+			       void __user *buffer, 
+			       size_t *length, loff_t *ppos)
+#else
 flashcache_dirty_thresh_sysctl(ctl_table *table, int write,
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
 			       struct file *file, 
 #endif
 			       void __user *buffer, 
 			       size_t *length, loff_t *ppos)
+#endif
 {
 	struct cache_c *dmc = (struct cache_c *)table->extra1;
 
@@ -204,12 +234,18 @@ flashcache_dirty_thresh_sysctl(ctl_table *table, int write,
 }
 
 static int
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+flashcache_lru_hot_pct_sysctl(struct ctl_table *table, int write,
+			      void __user *buffer, 
+			      size_t *length, loff_t *ppos)
+#else
 flashcache_lru_hot_pct_sysctl(ctl_table *table, int write,
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
 			       struct file *file, 
 #endif
 			       void __user *buffer, 
 			       size_t *length, loff_t *ppos)
+#endif
 {
 	struct cache_c *dmc = (struct cache_c *)table->extra1;
 
@@ -236,10 +272,17 @@ flashcache_lru_hot_pct_sysctl(ctl_table *table, int write,
 
 static struct flashcache_writeback_sysctl_table {
 	struct ctl_table_header *sysctl_header;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+	struct ctl_table	vars[FLASHCACHE_NUM_WRITEBACK_SYSCTLS];
+	struct ctl_table	dev[2];
+	struct ctl_table	dir[2];
+	struct ctl_table	root[2];
+#else
 	ctl_table		vars[FLASHCACHE_NUM_WRITEBACK_SYSCTLS];
 	ctl_table		dev[2];
 	ctl_table		dir[2];
 	ctl_table		root[2];
+#endif
 } flashcache_writeback_sysctl = {
 	.vars = {
 		{
@@ -510,10 +553,17 @@ static struct flashcache_writeback_sysctl_table {
 
 static struct flashcache_writethrough_sysctl_table {
 	struct ctl_table_header *sysctl_header;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+	struct ctl_table	vars[FLASHCACHE_NUM_WRITETHROUGH_SYSCTLS];
+	struct ctl_table	dev[2];
+	struct ctl_table	dir[2];
+	struct ctl_table	root[2];
+#else
 	ctl_table		vars[FLASHCACHE_NUM_WRITETHROUGH_SYSCTLS];
 	ctl_table		dev[2];
 	ctl_table		dir[2];
 	ctl_table		root[2];
+#endif
 } flashcache_writethrough_sysctl = {
 	.vars = {
 		{
@@ -668,7 +718,11 @@ static struct flashcache_writethrough_sysctl_table {
 };
 
 int *
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+flashcache_find_sysctl_data(struct cache_c *dmc, struct ctl_table *vars)
+#else
 flashcache_find_sysctl_data(struct cache_c *dmc, ctl_table *vars)
+#endif
 {
 	if (strcmp(vars->procname, "io_latency_hist") == 0)
 		return &dmc->sysctl_io_latency_hist;