From 143d09c8d4913f336a3185821a0f1bf50b8003a5 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Sat, 17 Aug 2013 20:12:40 -0400 Subject: [PATCH] LU-2800 autoconf: remove LC_RW_TREE_LOCK test address_space.tree_lock has been a spinlock since v2.6.26. We can remove the test and the dead code. Change-Id: Ia9204ab7dfe76d053483244347f9a7194ac4e416 Signed-off-by: Jeff Mahoney Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/5340 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 26 -------------------------- lustre/include/linux/lustre_compat25.h | 8 -------- lustre/include/linux/lustre_patchless_compat.h | 8 -------- lustre/llite/dir.c | 6 +++--- lustre/llite/llite_lib.c | 4 ++-- 5 files changed, 5 insertions(+), 47 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index bd5e8ae..cad617a 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -329,29 +329,6 @@ AC_DEFUN([LC_CONFIG_GSS], fi ]) -# 2.6.12 - -# ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock -# yet tree_lock is converted from rwlock to spin_lock since v2.6.26 -AC_DEFUN([LC_RW_TREE_LOCK], -[AC_MSG_CHECKING([if kernel has tree_lock as rwlock]) -tmp_flags="$EXTRA_KCFLAGS" -EXTRA_KCFLAGS="-Werror" -LB_LINUX_TRY_COMPILE([ - #include -],[ - struct address_space a; - - write_lock(&a.tree_lock); -],[ - AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock]) -],[ - AC_MSG_RESULT([no]) -]) -EXTRA_KCFLAGS="$tmp_flags" -]) - #2.6.18 + RHEL5 (fc6) # raid5-zerocopy patch @@ -1403,9 +1380,6 @@ AC_DEFUN([LC_PROG_LINUX], LC_CONFIG_RMTCLIENT LC_CONFIG_GSS - # 2.6.12 - LC_RW_TREE_LOCK - # raid5-zerocopy patch LC_PAGE_CONSTANT diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index c15c69d..c23e559 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -148,14 +148,6 @@ static inline struct file *ll_dentry_open(struct path *path, int flags, # define inode_dio_done(i) up_read(&(i)->i_alloc_sem) #endif -#ifdef HAVE_RW_TREE_LOCK -#define TREE_READ_LOCK_IRQ(mapping) read_lock_irq(&(mapping)->tree_lock) -#define TREE_READ_UNLOCK_IRQ(mapping) read_unlock_irq(&(mapping)->tree_lock) -#else -#define TREE_READ_LOCK_IRQ(mapping) spin_lock_irq(&(mapping)->tree_lock) -#define TREE_READ_UNLOCK_IRQ(mapping) spin_unlock_irq(&(mapping)->tree_lock) -#endif - #ifndef FS_HAS_FIEMAP #define FS_HAS_FIEMAP (0) #endif diff --git a/lustre/include/linux/lustre_patchless_compat.h b/lustre/include/linux/lustre_patchless_compat.h index 1876f94..c948cda 100644 --- a/lustre/include/linux/lustre_patchless_compat.h +++ b/lustre/include/linux/lustre_patchless_compat.h @@ -54,21 +54,13 @@ static inline void ll_remove_from_page_cache(struct page *page) BUG_ON(!PageLocked(page)); -#ifdef HAVE_RW_TREE_LOCK - write_lock_irq(&mapping->tree_lock); -#else spin_lock_irq(&mapping->tree_lock); -#endif radix_tree_delete(&mapping->page_tree, page->index); page->mapping = NULL; mapping->nrpages--; __dec_zone_page_state(page, NR_FILE_PAGES); -#ifdef HAVE_RW_TREE_LOCK - write_unlock_irq(&mapping->tree_lock); -#else spin_unlock_irq(&mapping->tree_lock); -#endif } #else /* HAVE_REMOVE_FROM_PAGE_CACHE */ #define ll_remove_from_page_cache(page) remove_from_page_cache(page) diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 870a94c..c90c543 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -273,14 +273,14 @@ static struct page *ll_dir_page_locate(struct inode *dir, __u64 *hash, struct page *page; int found; - TREE_READ_LOCK_IRQ(mapping); + spin_lock_irq(&mapping->tree_lock); found = radix_tree_gang_lookup(&mapping->page_tree, (void **)&page, offset, 1); if (found > 0) { struct lu_dirpage *dp; page_cache_get(page); - TREE_READ_UNLOCK_IRQ(mapping); + spin_unlock_irq(&mapping->tree_lock); /* * In contrast to find_lock_page() we are sure that directory * page cannot be truncated (while DLM lock is held) and, @@ -324,7 +324,7 @@ static struct page *ll_dir_page_locate(struct inode *dir, __u64 *hash, } } else { - TREE_READ_UNLOCK_IRQ(mapping); + spin_unlock_irq(&mapping->tree_lock); page = NULL; } return page; diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index afb5cd1..42e666f 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1924,8 +1924,8 @@ void ll_delete_inode(struct inode *inode) /* Workaround for LU-118 */ if (inode->i_data.nrpages) { - TREE_READ_LOCK_IRQ(&inode->i_data); - TREE_READ_UNLOCK_IRQ(&inode->i_data); + spin_lock_irq(&inode->i_data.tree_lock); + spin_unlock_irq(&inode->i_data.tree_lock); LASSERTF(inode->i_data.nrpages == 0, "inode=%lu/%u(%p) nrpages=%lu, see " "http://jira.whamcloud.com/browse/LU-118\n", -- 1.8.3.1