summaryrefslogtreecommitdiff
blob: f139e732e7de927eff3074a9a9b2ec62c46618ac (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
From 43227c1624e919efcd0cd035516c1776be55ac08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Elio=20'Flameeyes'=20Petten=C3=B2?= <flameeyes@gmail.com>
Date: Sun, 18 Oct 2009 12:41:28 +0200
Subject: [PATCH] Fix building with Linux kernel 2.6.32 and later.

With commit 18f2ee705d98034b0f229a3202d827468d4bffd9 of the Linux kernel,
the sync_page_range() function has been removed.

This patch changes it to filemap_write_and_wait_range() as done for the XFS
driver in the kernel (commit af0f4414f343429971d33b0dd8dccc85c1f3dcd2).
---
 kernel/file-io.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/kernel/file-io.c b/kernel/file-io.c
index dbf7b1c..e4c3fea 100644
--- a/kernel/file-io.c
+++ b/kernel/file-io.c
@@ -8,6 +8,7 @@
 #include <linux/blkdev.h>
 #include <linux/parser.h>
 #include <linux/writeback.h>
+#include <linux/version.h>
 
 #include "iscsi.h"
 #include "iscsi_dbg.h"
@@ -88,7 +89,12 @@ static int fileio_sync(struct iet_volume *lu, struct tio *tio)
 		count = lu->blk_cnt << lu->blk_shift;
 	}
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32)
 	res = sync_page_range(inode, mapping, ppos, count);
+#else
+	res = filemap_write_and_wait_range(mapping, ppos,
+					   ppos + count -1);
+#endif
 	if (res) {
 		eprintk("I/O error: syncing pages failed: %d\n", res);
 		return -EIO;
-- 
1.6.5