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
|
From 9e6789a41f3b1afd1a8a2575a4abbc49f0b10727 Mon Sep 17 00:00:00 2001
From: Liu Xuezhao <xuezhao.liu@emc.com>
Date: Thu, 9 Aug 2012 10:34:49 +0800
Subject: [PATCH 09/13] LU-1337 vfs: kernel 3.4 touch_atime switchs to 1
argument
touch_atime switchs to use 1 argument of struct path since
kernel 3.4 (commit 68ac1234fb949b66941d94dce4157742799fc581).
Add LC_TOUCH_ATIME_1ARG/HAVE_TOUCH_ATIME_1ARG to check it.
Signed-off-by: Liu Xuezhao <xuezhao.liu@emc.com>
Change-Id: I1a0478459538376761b96e1dc65328eeeef60d0f
---
lustre/autoconf/lustre-core.m4 | 22 ++++++++++++++++++++++
lustre/llite/dir.c | 9 +++++++++
2 files changed, 31 insertions(+)
diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index 15f58ab..3b3115c 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -2009,6 +2009,25 @@ EXTRA_KCFLAGS="$tmp_flags"
])
#
+# 3.4 switchs touch_atime to struct path
+# see kernel commit 68ac1234fb949b66941d94dce4157742799fc581
+#
+AC_DEFUN([LC_TOUCH_ATIME_1ARG],
+[AC_MSG_CHECKING([if touch_atime use one argument])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ touch_atime((struct path *)NULL);
+],[
+ AC_DEFINE(HAVE_TOUCH_ATIME_1ARG, 1,
+ [touch_atime use one argument])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
# LC_PROG_LINUX
#
# Lustre linux kernel checks
@@ -2168,6 +2187,9 @@ AC_DEFUN([LC_PROG_LINUX],
LC_SUPEROPS_USE_DENTRY
LC_INODEOPS_USE_UMODE_T
+ # 3.4
+ LC_TOUCH_ATIME_1ARG
+
#
if test x$enable_server = xyes ; then
AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c
index f985625..f418631 100644
--- a/lustre/llite/dir.c
+++ b/lustre/llite/dir.c
@@ -500,6 +500,9 @@ int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH;
struct page *page;
struct ll_dir_chain chain;
+#ifdef HAVE_TOUCH_ATIME_1ARG
+ struct path path;
+#endif
int done;
int rc;
ENTRY;
@@ -627,7 +630,13 @@ int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
filp->f_pos = pos;
}
filp->f_version = inode->i_version;
+#ifdef HAVE_TOUCH_ATIME_1ARG
+ path.mnt = filp->f_vfsmnt;
+ path.dentry = filp->f_dentry;
+ touch_atime(&path);
+#else
touch_atime(filp->f_vfsmnt, filp->f_dentry);
+#endif
ll_dir_chain_fini(&chain);
--
1.7.12
|