aboutsummaryrefslogtreecommitdiff
blob: 3fa2ddb229f4e922a8372b669ce258a2655e800c (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
From 2ab84dda5f7de4bd2bd00256ee8cdbd329633811 Mon Sep 17 00:00:00 2001
From: Peng Tao <tao.peng@emc.com>
Date: Wed, 22 Aug 2012 17:57:04 +0800
Subject: [PATCH 12/13] LU-1337 llite: kernel 3.5 renames end_writeback to
 clear_inode

kernel commit dbd5768f8 renames end_writeback to clear_inode,
which used to exist for ~2.6.36 kernels.

Signed-off-by: Peng Tao <tao.peng@emc.com>
Change-Id: I2435e820092085c0fb55539818f4bad9e48ff386
---
 lustre/autoconf/lustre-core.m4         | 22 ++++++++++++++++++++++
 lustre/include/linux/lustre_compat25.h |  3 +++
 lustre/llite/llite_lib.c               |  4 +---
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index e563921..66555cc 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -2031,6 +2031,25 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# 3.5 renames end_writeback() back to clear_inode()...
+# see kernel commit dbd5768f87ff6fb0a4fe09c4d7b6c4a24de99430
+#
+AC_DEFUN([LC_HAVE_CLEAR_INODE],
+[AC_MSG_CHECKING([if have clear_inode])
+LB_LINUX_TRY_COMPILE([
+	#include <linux/fs.h>
+],[
+	clear_inode((struct inode *)NULL);
+],[
+	AC_DEFINE(HAVE_CLEAR_INODE, 1,
+		  [have clear_inode])
+	AC_MSG_RESULT([yes])
+],[
+	AC_MSG_RESULT([no])
+])
+])
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -2193,6 +2212,9 @@ AC_DEFUN([LC_PROG_LINUX],
 	 LC_TOUCH_ATIME_1ARG
 	 LC_HAVE_D_MAKE_ROOT
 
+	 # 3.5
+	 LC_HAVE_CLEAR_INODE
+
          #
          if test x$enable_server = xyes ; then
              AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h
index 321892a..e9ff0e2 100644
--- a/lustre/include/linux/lustre_compat25.h
+++ b/lustre/include/linux/lustre_compat25.h
@@ -816,6 +816,9 @@ static inline struct dentry *d_make_root(struct inode *root_inode)
 	return res;
 }
 #endif
+#ifndef HAVE_CLEAR_INODE
+#define clear_inode(i)		end_writeback(i)
+#endif
 
 #endif /* __KERNEL__ */
 #endif /* _COMPAT25_H */
diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
index 1db4903..26659f4 100644
--- a/lustre/llite/llite_lib.c
+++ b/lustre/llite/llite_lib.c
@@ -1892,10 +1892,8 @@ void ll_delete_inode(struct inode *inode)
 
 #ifdef HAVE_SBOPS_EVICT_INODE
         ll_clear_inode(inode);
-        end_writeback(inode);
-#else
-        clear_inode(inode);
 #endif
+        clear_inode(inode);
 
         EXIT;
 }
-- 
1.7.12