From f0a52d9e0dd2a9fdab3335e50029fbe8dceba0ad Mon Sep 17 00:00:00 2001 From: Yang Sheng Date: Tue, 23 Sep 2014 02:12:11 +0800 Subject: [PATCH] LU-5584 llite: call truncate_inode_page_final() in evict_inode In evict_inode we should invoke truncate_inode_pages_final() as inode will cleanup. Signed-off-by: Yang Sheng Change-Id: Ifba1014cf997475a248bf3d0898ae373bd3a7f9c Reviewed-on: http://review.whamcloud.com/12009 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 17 +++++++++++++++++ lustre/include/linux/lustre_compat25.h | 4 ++++ lustre/llite/llite_lib.c | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 3293137..b59aa2e 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1490,6 +1490,22 @@ have_bvec_iter, [ ]) # LC_HAVE_BVEC_ITER # +# LC_HAVE_TRUNCATE_IPAGE_FINAL +# +# 3.14 bring truncate_inode_pages_final for evict_inode +# +AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [ +LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final], +truncate_ipages_final, [ + #include +],[ + truncate_inode_pages_final(NULL); +], [ + AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1, + [kernel has truncate_inode_pages_final]) +]) +]) # LC_HAVE_TRUNCATE_IPAGES_FINAL +# # LC_VFS_RENAME_6ARGS # # 3.15 has vfs_rename with 6 args @@ -1627,6 +1643,7 @@ AC_DEFUN([LC_PROG_LINUX], [ # 3.14 LC_HAVE_BVEC_ITER + LC_HAVE_TRUNCATE_IPAGES_FINAL # 3.15 LC_VFS_RENAME_6ARGS diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 79c6db0..e2e46f9 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -367,6 +367,10 @@ static inline int radix_tree_exceptional_entry(void *arg) } #endif +#ifndef HAVE_TRUNCATE_INODE_PAGES_FINAL +# define truncate_inode_pages_final(map) truncate_inode_pages(map, 0) +#endif + #ifndef SIZE_MAX #define SIZE_MAX (~(size_t)0) #endif diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index a398c1b..3d1c9a3 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -2168,7 +2168,7 @@ void ll_delete_inode(struct inode *inode) cl_sync_file_range(inode, 0, OBD_OBJECT_EOF, CL_FSYNC_DISCARD, 1); - truncate_inode_pages(&inode->i_data, 0); + truncate_inode_pages_final(&inode->i_data); /* Workaround for LU-118 */ if (inode->i_data.nrpages) { -- 1.8.3.1