Whamcloud - gitweb
LU-4416 mem: truncate_pagecache oldsize removed 00/8800/2
authoryangsheng <yang.sheng@intel.com>
Fri, 10 Jan 2014 19:46:06 +0000 (03:46 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 18 Jan 2014 05:53:51 +0000 (05:53 +0000)
truncate_pagecache doesn't need oldsize parameter anymore.
In fact, the oldsize useless in all kernel we supported. so
just remove all things relate to it.

Signed-off-by: yang sheng <yang.sheng@intel.com>
Change-Id: Iba9ccebb73e7e8df3179ef1d68507b7403b117a7
Reviewed-on: http://review.whamcloud.com/8800
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h
lustre/llite/vvp_io.c
lustre/osd-ldiskfs/osd_io.c

index f070c08..db0f02a 100644 (file)
@@ -1362,6 +1362,23 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
 ])
 
 #
+# 3.12 truncate_pagecache without oldsize parameter
+#
+AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE],
+[AC_MSG_CHECKING([if truncate_pagecache with old_size parameter])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/mm.h>
+],[
+       truncate_pagecache(NULL, 0, 0);
+],[
+       AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1, [with oldsize])
+       AC_MSG_RESULT([yes])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -1466,6 +1483,9 @@ AC_DEFUN([LC_PROG_LINUX],
         LC_D_COMPARE_5ARGS
         LC_HAVE_DCOUNT
 
         LC_D_COMPARE_5ARGS
         LC_HAVE_DCOUNT
 
+        # 3.12
+        LC_OLDSIZE_TRUNCATE_PAGECACHE
+
         #
         if test x$enable_server != xno ; then
                LC_FUNC_DEV_SET_RDONLY
         #
         if test x$enable_server != xno ; then
                LC_FUNC_DEV_SET_RDONLY
index 6187194..24412f2 100644 (file)
@@ -330,4 +330,10 @@ static inline struct dentry *d_make_root(struct inode *root)
 # define set_file_inode(file, inode)
 #endif
 
 # define set_file_inode(file, inode)
 #endif
 
+#ifdef HAVE_OLDSIZE_TRUNCATE_PAGECACHE
+#define ll_truncate_pagecache(inode, size) truncate_pagecache(inode, 0, size)
+#else
+#define ll_truncate_pagecache(inode, size) truncate_pagecache(inode, size)
+#endif
+
 #endif /* _COMPAT25_H */
 #endif /* _COMPAT25_H */
index ceb5ba6..f15e066 100644 (file)
@@ -418,7 +418,6 @@ static int vvp_io_setattr_lock(const struct lu_env *env,
 static int vvp_do_vmtruncate(struct inode *inode, size_t size)
 {
        int     result;
 static int vvp_do_vmtruncate(struct inode *inode, size_t size)
 {
        int     result;
-       loff_t oldsize;
 
        /*
         * Only ll_inode_size_lock is taken at this level.
 
        /*
         * Only ll_inode_size_lock is taken at this level.
@@ -429,10 +428,9 @@ static int vvp_do_vmtruncate(struct inode *inode, size_t size)
                ll_inode_size_unlock(inode);
                return result;
        }
                ll_inode_size_unlock(inode);
                return result;
        }
-       oldsize = inode->i_size;
        i_size_write(inode, size);
 
        i_size_write(inode, size);
 
-       truncate_pagecache(inode, oldsize, size);
+       ll_truncate_pagecache(inode, size);
        ll_inode_size_unlock(inode);
        return result;
 }
        ll_inode_size_unlock(inode);
        return result;
 }
index 2ef7771..eeae025 100644 (file)
@@ -1521,7 +1521,6 @@ static int osd_punch(const struct lu_env *env, struct dt_object *dt,
         struct inode       *inode = obj->oo_inode;
         handle_t           *h;
         tid_t               tid;
         struct inode       *inode = obj->oo_inode;
         handle_t           *h;
         tid_t               tid;
-       loff_t             oldsize;
        int                rc = 0, rc2 = 0;
         ENTRY;
 
        int                rc = 0, rc2 = 0;
         ENTRY;
 
@@ -1539,9 +1538,8 @@ static int osd_punch(const struct lu_env *env, struct dt_object *dt,
 
         tid = oh->ot_handle->h_transaction->t_tid;
 
 
         tid = oh->ot_handle->h_transaction->t_tid;
 
-       oldsize=inode->i_size;
        i_size_write(inode, start);
        i_size_write(inode, start);
-       truncate_pagecache(inode, oldsize, start);
+       ll_truncate_pagecache(inode, start);
 #ifdef HAVE_INODEOPS_TRUNCATE
        if (inode->i_op->truncate)
                inode->i_op->truncate(inode);
 #ifdef HAVE_INODEOPS_TRUNCATE
        if (inode->i_op->truncate)
                inode->i_op->truncate(inode);