From be41e2ce0d71a707da703e6f8e82d397be839d23 Mon Sep 17 00:00:00 2001 From: yangsheng Date: Sat, 11 Jan 2014 03:46:06 +0800 Subject: [PATCH] LU-4416 mem: truncate_pagecache oldsize removed 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 Change-Id: Iba9ccebb73e7e8df3179ef1d68507b7403b117a7 Reviewed-on: http://review.whamcloud.com/8800 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 20 ++++++++++++++++++++ lustre/include/linux/lustre_compat25.h | 6 ++++++ lustre/llite/vvp_io.c | 4 +--- lustre/osd-ldiskfs/osd_io.c | 4 +--- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index f070c08..db0f02a 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 +],[ + 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 @@ -1466,6 +1483,9 @@ AC_DEFUN([LC_PROG_LINUX], 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 diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 6187194..24412f2 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -330,4 +330,10 @@ static inline struct dentry *d_make_root(struct inode *root) # 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 */ diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index ceb5ba6..f15e066 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -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; - loff_t oldsize; /* * 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; } - oldsize = inode->i_size; i_size_write(inode, size); - truncate_pagecache(inode, oldsize, size); + ll_truncate_pagecache(inode, size); ll_inode_size_unlock(inode); return result; } diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index 2ef7771..eeae025 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -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; - loff_t oldsize; 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; - oldsize=inode->i_size; 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); -- 1.8.3.1