Whamcloud - gitweb
LU-1337 llite: kernel 3.4 touch_atime switchs to 1 argument
authorLiu Xuezhao <xuezhao.liu@emc.com>
Mon, 8 Oct 2012 08:54:30 +0000 (16:54 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 5 Dec 2012 14:09:37 +0000 (09:09 -0500)
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
Reviewed-on: http://review.whamcloud.com/3578
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/llite/dir.c

index 0cbd114..f4ec1c5 100644 (file)
@@ -2010,6 +2010,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
@@ -2169,6 +2188,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])
index 5ae75b7..2e6f062 100644 (file)
@@ -598,6 +598,9 @@ static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
        int                     hash64  = sbi->ll_flags & LL_SBI_64BIT_HASH;
        int                     api32   = ll_need_32bit_api(sbi);
        int                     rc;
+#ifdef HAVE_TOUCH_ATIME_1ARG
+       struct path             path;
+#endif
        ENTRY;
 
        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) pos %lu/%llu "
@@ -623,14 +626,20 @@ static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
                 else
                         filp->f_pos = pos;
         }
-        filp->f_version = inode->i_version;
-        touch_atime(filp->f_vfsmnt, filp->f_dentry);
+       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
 
 out:
-        if (!rc)
-                ll_stats_ops_tally(sbi, LPROC_LL_READDIR, 1);
+       if (!rc)
+               ll_stats_ops_tally(sbi, LPROC_LL_READDIR, 1);
 
-        RETURN(rc);
+       RETURN(rc);
 }
 
 int ll_send_mgc_param(struct obd_export *mgc, char *string)