From: Peng Tao Date: Mon, 23 Jan 2012 05:08:46 +0000 (+0800) Subject: LU-709 build: cleanup LC_SEQ_LOCK/FILEMAP_FDATAWRITE_RANGE X-Git-Tag: 2.2.52~39 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=65a176f32e4606922bba52a2f670eae51bd36570 LU-709 build: cleanup LC_SEQ_LOCK/FILEMAP_FDATAWRITE_RANGE 1. struct seq_file has lock instead of semaphore since v2.6.17 and seq_file lock is not used in Lustre 2. filemap_fdatawrite_range is exported since v2.6.27 andRHEL v2.6.18 back ported it. So all kernels Lustre supports now have it. Signed-off-by: Peng Tao Change-Id: I5730852789a5c19350eebb65fd61baf2a6512626 Reviewed-on: http://review.whamcloud.com/2321 Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index b0dcb51..e1a6146 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -841,7 +841,7 @@ EXTRA_KCFLAGS="$tmp_flags" ]) # LC_UMOUNTBEGIN_HAS_VFSMOUNT -# after 2.6.18 umount_begin has different parameters +# 2.6.18~2.6.25 umount_begin has different parameters AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT], [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block]) tmp_flags="$EXTRA_KCFLAGS" @@ -870,39 +870,6 @@ LB_LINUX_TRY_COMPILE([ EXTRA_KCFLAGS="$tmp_flags" ]) -# LC_SEQ_LOCK -# after 2.6.18 seq_file has lock intead of sem -AC_DEFUN([LC_SEQ_LOCK], -[AC_MSG_CHECKING([if struct seq_file has lock field]) -LB_LINUX_TRY_COMPILE([ - #include -],[ - struct seq_file seq; - - mutex_unlock(&seq.lock); -],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SEQ_LOCK, 1, - [after 2.6.18 seq_file has lock intead of sem]) -],[ - AC_MSG_RESULT(NO) -]) -]) - -# -# LC_EXPORT_FILEMAP_FDATAWRITE_RANGE -# -# No standard kernels export this -# -AC_DEFUN([LC_EXPORT_FILEMAP_FDATAWRITE_RANGE], -[LB_CHECK_SYMBOL_EXPORT([filemap_fdatawrite_range], -[mm/filemap.c],[ -AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE, 1, - [filemap_fdatawrite_range is exported by the kernel]) -],[ -]) -]) - # LC_FLUSH_OWNER_ID # starting from 2.6.18 the file_operations .flush # method has a new "fl_owner_t id" parameter @@ -2141,8 +2108,6 @@ AC_DEFUN([LC_PROG_LINUX], LC_NR_PAGECACHE LC_STATFS_DENTRY_PARAM LC_UMOUNTBEGIN_HAS_VFSMOUNT - LC_SEQ_LOCK - LC_EXPORT_FILEMAP_FDATAWRITE_RANGE LC_FLUSH_OWNER_ID if test x$enable_server = xyes ; then LC_EXPORT_INVALIDATE_MAPPING_PAGES diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index d6d46e4..8e07133 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -138,14 +138,6 @@ do {cfs_mutex_lock_nested(&(inode)->i_mutex, I_MUTEX_PARENT); } while(0) #define LOCK_INODE_MUTEX_PARENT(inode) LOCK_INODE_MUTEX(inode) #endif /* HAVE_INODE_I_MUTEX */ -#ifdef HAVE_SEQ_LOCK -#define LL_SEQ_LOCK(seq) cfs_mutex_lock(&(seq)->lock) -#define LL_SEQ_UNLOCK(seq) cfs_mutex_unlock(&(seq)->lock) -#else -#define LL_SEQ_LOCK(seq) cfs_down(&(seq)->sem) -#define LL_SEQ_UNLOCK(seq) cfs_up(&(seq)->sem) -#endif - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) #define d_child d_u.d_child #define d_rcu d_u.d_rcu @@ -347,43 +339,6 @@ static inline int mapping_has_pages(struct address_space *mapping) #define LASSERT_I_ALLOC_SEM_READ_LOCKED(i) LASSERT(down_write_trylock(&(i)->i_alloc_sem) == 0) #include /* for generic_writepages */ -#ifndef HAVE_FILEMAP_FDATAWRITE_RANGE -#include /* for mapping->backing_dev_info */ -static inline int filemap_fdatawrite_range(struct address_space *mapping, - loff_t start, loff_t end) -{ - int rc; - struct writeback_control wbc = { - .sync_mode = WB_SYNC_ALL, - .nr_to_write = (end - start + PAGE_SIZE - 1) >> PAGE_SHIFT, - }; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) - wbc.range_start = start; - wbc.range_end = end; -#else - wbc.start = start; - wbc.end = end; -#endif - -#ifdef HAVE_MAPPING_CAP_WRITEBACK_DIRTY - if (!mapping_cap_writeback_dirty(mapping)) - rc = 0; -#else - if (mapping->backing_dev_info->memory_backed) - rc = 0; -#endif - /* do_writepages() */ - else if (mapping->a_ops->writepages) - rc = mapping->a_ops->writepages(mapping, &wbc); - else - rc = generic_writepages(mapping, &wbc); - return rc; -} -#else -int filemap_fdatawrite_range(struct address_space *mapping, - loff_t start, loff_t end); -#endif /* HAVE_FILEMAP_FDATAWRITE_RANGE */ #ifndef HAVE_ATOMIC_MNT_COUNT static inline unsigned int mnt_get_count(struct vfsmount *mnt)