From: Liu Xuezhao Date: Mon, 8 Oct 2012 08:54:30 +0000 (+0800) Subject: LU-1337 llite: kernel 3.4 touch_atime switchs to 1 argument X-Git-Tag: 2.3.57~5 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=474009df25886377ca09945f809b0738b85d1569 LU-1337 llite: 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 Change-Id: I1a0478459538376761b96e1dc65328eeeef60d0f Reviewed-on: http://review.whamcloud.com/3578 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: Andreas Dilger --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 0cbd114..f4ec1c5 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 +],[ + 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]) diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 5ae75b7..2e6f062 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -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)