From 7e34195296cfac8a1fa90495f7d27a8e11ad1317 Mon Sep 17 00:00:00 2001
From: yangsheng <yangsheng>
Date: Wed, 26 Nov 2008 11:10:01 +0000
Subject: [PATCH] Branch b1_6 b=17153 i=johann, adilger

Remove 2.4 compatibility.
---
 lustre/autoconf/lustre-core.m4         |   3 -
 lustre/include/linux/lprocfs_status.h  |   7 +-
 lustre/include/linux/lustre_compat25.h | 206 +------------------------
 lustre/include/linux/lustre_lite.h     |   7 -
 lustre/include/linux/lustre_net.h      |   4 -
 lustre/include/linux/lustre_user.h     |   3 -
 lustre/include/linux/lvfs_linux.h      |  18 +--
 lustre/include/linux/obd_class.h       |   4 +-
 lustre/include/linux/obd_support.h     |   3 +-
 lustre/include/lustre_disk.h           |  10 +-
 lustre/include/lustre_quota.h          |  41 -----
 lustre/llite/Makefile.in               |   4 -
 lustre/llite/dcache.c                  |  20 +--
 lustre/llite/dir.c                     |   6 +-
 lustre/llite/file.c                    |  33 ----
 lustre/llite/llite_internal.h          |  27 ----
 lustre/llite/llite_lib.c               |  40 -----
 lustre/llite/llite_mmap.c              |   6 +-
 lustre/llite/llite_nfs.c               |  35 -----
 lustre/llite/lproc_llite.c             |   4 -
 lustre/llite/namei.c                   |  16 --
 lustre/llite/rw.c                      |   4 -
 lustre/llite/symlink.c                 |   4 -
 lustre/lov/lproc_lov.c                 |   2 -
 lustre/lvfs/fsfilt_ext3.c              | 138 ++---------------
 lustre/mdc/mdc_request.c               |   9 --
 lustre/mds/handler.c                   |  10 --
 lustre/mds/lproc_mds.c                 |   2 -
 lustre/mds/mds_fs.c                    |   2 -
 lustre/mds/mds_internal.h              |   4 -
 lustre/mds/mds_lib.c                   |   6 +-
 lustre/mds/mds_lov.c                   |   3 +-
 lustre/mds/mds_open.c                  |   8 +-
 lustre/mds/mds_reint.c                 |   2 -
 lustre/mds/mds_xattr.c                 |  11 +-
 lustre/mgc/mgc_request.c               |   8 -
 lustre/mgs/lproc_mgs.c                 |   2 -
 lustre/mgs/mgs_fs.c                    |   2 -
 lustre/obdclass/linux/linux-sysctl.c   |   3 -
 lustre/obdclass/obd_mount.c            |  23 ---
 lustre/obdfilter/filter.c              |  12 +-
 lustre/obdfilter/lproc_obdfilter.c     |   2 -
 lustre/osc/lproc_osc.c                 |   2 -
 lustre/osc/osc_request.c               |   8 -
 lustre/quota/quota_adjust_qunit.c      |   4 -
 lustre/quota/quota_check.c             |   4 -
 lustre/quota/quota_ctl.c               |   4 -
 lustre/quota/quota_interface.c         |   4 -
 48 files changed, 31 insertions(+), 749 deletions(-)

diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index 3aaf8a3ffa..1e40dfc9b5 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -220,9 +220,6 @@ LB_LINUX_TRY_COMPILE([
 	#include <linux/fs.h>
 	#include <linux/version.h>
 ],[
-	#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
-	#error "down_read_trylock broken before 2.4.24"
-	#endif
 	struct inode i;
 	return (char *)&i.i_alloc_sem - (char *)&i;
 ],[
diff --git a/lustre/include/linux/lprocfs_status.h b/lustre/include/linux/lprocfs_status.h
index 146ba7f098..936042c051 100644
--- a/lustre/include/linux/lprocfs_status.h
+++ b/lustre/include/linux/lprocfs_status.h
@@ -57,12 +57,7 @@
 #include <linux/smp.h>
 #include <linux/rwsem.h>
 #include <libcfs/kp30.h>
-
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-#  include <linux/statfs.h>
-# else 
-#  define kstatfs statfs
-# endif
+#include <linux/statfs.h>
 
 #else 
 #  define kstatfs statfs
diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h
index ceefbbefbe..f8a5b1194a 100644
--- a/lustre/include/linux/lustre_compat25.h
+++ b/lustre/include/linux/lustre_compat25.h
@@ -39,8 +39,8 @@
 
 #ifdef __KERNEL__
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) && LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)
-#error sorry, lustre requires at least 2.5.69
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
+#error sorry, lustre requires at least 2.6.5
 #endif
 
 #include <libcfs/linux/portals_compat25.h>
@@ -135,13 +135,9 @@ void groups_free(struct group_info *ginfo);
 #define gfp_t int
 #endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-
 #define lock_dentry(___dentry)          spin_lock(&(___dentry)->d_lock)
 #define unlock_dentry(___dentry)        spin_unlock(&(___dentry)->d_lock)
 
-#define lock_24kernel()         do {} while (0)
-#define unlock_24kernel()       do {} while (0)
 #define ll_kernel_locked()      kernel_locked()
 
 /*
@@ -237,204 +233,6 @@ extern void __d_move(struct dentry *dentry, struct dentry *target);
         ((!PageWriteback(page) && (cmd & OBD_BRW_READ)) || \
          (PageWriteback(page) && (cmd & OBD_BRW_WRITE)))
 
-#else /* 2.4.. */
-
-#define ll_flock_lock_file_wait(file, lock, can_sleep) \
-        do {} while(0)
-
-#define lock_dentry(___dentry)
-#define unlock_dentry(___dentry)
-
-#define lock_24kernel()         lock_kernel()
-#define unlock_24kernel()       unlock_kernel()
-#define ll_kernel_locked()      (current->lock_depth >= 0)
-
-/* 2.4 kernels have HZ=100 on i386/x86_64, this should be reasonably safe */
-#define get_jiffies_64()        (__u64)jiffies
-
-#ifdef HAVE_MM_INLINE
-#include <linux/mm_inline.h>
-#endif
-
-#ifndef pgoff_t
-#define pgoff_t unsigned long
-#endif
-
-#define ll_vfs_create(a,b,c,d)              vfs_create(a,b,c)
-#define ll_permission(inode,mask,nd)        permission(inode,mask)
-#define ILOOKUP(sb, ino, test, data)        ilookup4(sb, ino, test, data);
-#define DCACHE_DISCONNECTED                 DCACHE_NFSD_DISCONNECTED
-#define ll_dev_t                            int
-#define old_encode_dev(dev)                 (dev)
-
-/* 2.5 uses hlists for some things, like the d_hash.  we'll treat them
- * as 2.5 and let macros drop back.. */
-#ifndef HLIST_HEAD /* until we get a kernel newer than l28 */
-#define hlist_entry                     list_entry
-#define hlist_head                      list_head
-#define hlist_node                      list_head
-#define HLIST_HEAD                      LIST_HEAD
-#define INIT_HLIST_HEAD                 INIT_LIST_HEAD
-#define hlist_del_init                  list_del_init
-#define hlist_add_head                  list_add
-#endif
-
-#ifndef INIT_HLIST_NODE
-#define INIT_HLIST_NODE(p)              ((p)->next = NULL, (p)->prev = NULL)
-#endif
-
-#ifndef hlist_for_each
-#define hlist_for_each                  list_for_each
-#endif
-
-#ifndef hlist_for_each_safe
-#define hlist_for_each_safe             list_for_each_safe
-#endif
-
-#define KDEVT_INIT(val)                 (val)
-#define ext3_xattr_set_handle           ext3_xattr_set
-#define try_module_get                  __MOD_INC_USE_COUNT
-#define module_put                      __MOD_DEC_USE_COUNT
-#define LTIME_S(time)                   (time)
-
-#if !defined(CONFIG_RH_2_4_20) && !defined(cpu_online)
-#define cpu_online(cpu)                 test_bit(cpu, &(cpu_online_map))
-#endif
-
-static inline int ll_path_lookup(const char *path, unsigned flags,
-                                 struct nameidata *nd)
-{
-        int error = 0;
-        if (path_init(path, flags, nd))
-                error = path_walk(path, nd);
-        return error;
-}
-#define ll_permission(inode,mask,nd)    permission(inode,mask)
-typedef long sector_t;
-
-#define ll_pgcache_lock(mapping)        spin_lock(&pagecache_lock)
-#define ll_pgcache_unlock(mapping)      spin_unlock(&pagecache_lock)
-#define ll_call_writepage(inode, page)  \
-                               (inode)->i_mapping->a_ops->writepage(page)
-#define ll_invalidate_inode_pages(inode) invalidate_inode_pages(inode)
-#define ll_truncate_complete_page(page) truncate_complete_page(page)
-
-static inline void clear_page_dirty(struct page *page)
-{
-        if (PageDirty(page))
-                ClearPageDirty(page);
-}
-
-static inline int clear_page_dirty_for_io(struct page *page)
-{
-        struct address_space *mapping = page->mapping;
-
-        if (page->mapping && PageDirty(page)) {
-                ClearPageDirty(page);
-                ll_pgcache_lock(mapping);
-                list_del(&page->list);
-                list_add(&page->list, &mapping->locked_pages);
-                ll_pgcache_unlock(mapping);
-                return 1;
-        }
-        return 0;
-}
-
-static inline void ll_redirty_page(struct page *page)
-{
-        SetPageDirty(page);
-        ClearPageLaunder(page);
-}
-
-static inline void __d_drop(struct dentry *dentry)
-{
-        list_del_init(&dentry->d_hash);
-}
-
-static inline int cleanup_group_info(void)
-{
-        /* Get rid of unneeded supplementary groups */
-        current->ngroups = 0;
-        memset(current->groups, 0, sizeof(current->groups));
-        return 0;
-}
-
-#ifndef HAVE_COND_RESCHED
-static inline void cond_resched(void)
-{
-        if (unlikely(need_resched())) {
-                set_current_state(TASK_RUNNING);
-                schedule();
-        }
-}
-#endif
-
-/* to find proc_dir_entry from inode. 2.6 has native one -bzzz */
-#ifndef HAVE_PDE
-#define PDE(ii)         ((ii)->u.generic_ip)
-#endif
-
-#define __set_page_ll_data(page, llap) set_page_private(page, (unsigned long)llap)
-#define __clear_page_ll_data(page) set_page_private(page, 0)
-#define PageWriteback(page) 0
-#define CheckWriteback(page, cmd) 1
-#define set_page_writeback(page) do {} while (0)
-#define end_page_writeback(page) do {} while (0)
-
-static inline int mapping_mapped(struct address_space *mapping)
-{
-        if (mapping->i_mmap_shared)
-                return 1;
-        if (mapping->i_mmap)
-                return 1;
-        return 0;
-}
-
-#ifdef ZAP_PAGE_RANGE_VMA
-#define ll_zap_page_range(vma, addr, len)  zap_page_range(vma, addr, len)
-#else
-#define ll_zap_page_range(vma, addr, len)  zap_page_range(vma->vm_mm, addr, len)
-#endif
-
-#ifndef HAVE_PAGE_MAPPED
-/* Poor man's page_mapped. substract from page count, counts from
-   buffers/pagecache and our own count (we are supposed to hold one reference).
-   What is left are user mappings and also others who work with this page now,
-   but there are supposedly none. */
-static inline int page_mapped(struct page *page)
-{
-        return page_count(page) - !!page->mapping - !!page->buffers - 1;
-}
-#endif /* !HAVE_PAGE_MAPPED */
-
-static inline void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
-{
-        update_atime(dentry->d_inode);
-}
-
-static inline void file_accessed(struct file *file)
-{
-#ifdef O_NOATIME
-        if (file->f_flags & O_NOATIME)
-                return;
-#endif
-        touch_atime(file->f_vfsmnt, file->f_dentry);
-}
-
-#ifndef typecheck
-/*
- * Check at compile time that something is of a particular type.
- * Always evaluates to 1 so you may use it easily in comparisons.
- */
-#define typecheck(type,x) \
-({	type __dummy; \
-	typeof(x) __dummy2; \
-	(void)(&__dummy == &__dummy2); \
-	1; \
-})
-#endif
-
-#endif /* end of 2.4 compat macros */
 
 #ifdef HAVE_PAGE_LIST
 static inline int mapping_has_pages(struct address_space *mapping)
diff --git a/lustre/include/linux/lustre_lite.h b/lustre/include/linux/lustre_lite.h
index fca6f5ef0c..9fe241b977 100644
--- a/lustre/include/linux/lustre_lite.h
+++ b/lustre/include/linux/lustre_lite.h
@@ -45,9 +45,7 @@
 
 #include <linux/version.h>
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #include <asm/statfs.h>
-#endif
 
 #include <linux/fs.h>
 #include <linux/dcache.h>
@@ -84,12 +82,7 @@ enum {
          LPROC_LL_TRUNC,
          LPROC_LL_LOCKLESS_TRUNC,
          LPROC_LL_FLOCK,
-
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
          LPROC_LL_GETATTR,
-#else
-         LPROC_LL_REVALIDATE,
-#endif
          LPROC_LL_STAFS,
          LPROC_LL_ALLOC_INODE,
          LPROC_LL_SETXATTR,
diff --git a/lustre/include/linux/lustre_net.h b/lustre/include/linux/lustre_net.h
index 4f4b96c651..ed8ba17cbb 100644
--- a/lustre/include/linux/lustre_net.h
+++ b/lustre/include/linux/lustre_net.h
@@ -43,12 +43,8 @@
 
 #ifdef __KERNEL__
 #include <linux/version.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/tqueue.h>
-#else
 #include <linux/workqueue.h>
 #endif
-#endif
 
 /* XXX Liang: should be moved to other header instead of here */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4)
diff --git a/lustre/include/linux/lustre_user.h b/lustre/include/linux/lustre_user.h
index bf8c229dd0..a7e330212b 100644
--- a/lustre/include/linux/lustre_user.h
+++ b/lustre/include/linux/lustre_user.h
@@ -55,9 +55,6 @@
 # endif
 #else
 # include <linux/version.h>
-# if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,21)
-#  define NEED_QUOTA_DEFS
-# endif
 # ifdef HAVE_QUOTA_SUPPORT
 #  include <linux/quota.h>
 # endif
diff --git a/lustre/include/linux/lvfs_linux.h b/lustre/include/linux/lvfs_linux.h
index 63b273d825..7a1712a4e6 100644
--- a/lustre/include/linux/lvfs_linux.h
+++ b/lustre/include/linux/lvfs_linux.h
@@ -40,9 +40,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/fs.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #include <linux/namei.h>
-#endif
 #include <linux/sched.h>
 
 #include <lvfs.h>
@@ -77,20 +75,10 @@ struct lvfs_dentry_params
 };
 #define LVFS_DENTRY_PARAMS_INIT         { .ldp_magic = LVFS_DENTRY_PARAM_MAGIC }
 
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-#  define BDEVNAME_DECLARE_STORAGE(foo) char foo[BDEVNAME_SIZE]
-#  define ll_bdevname(SB, STORAGE) __bdevname(kdev_t_to_nr(SB->s_dev), STORAGE)
-#  define lvfs_sbdev(SB)       ((SB)->s_bdev)
-#  define lvfs_sbdev_type      struct block_device *
+#define lvfs_sbdev(SB)       ((SB)->s_bdev)
+#define lvfs_sbdev_type      struct block_device *
    int fsync_bdev(struct block_device *);
-#  define lvfs_sbdev_sync      fsync_bdev
-# else
-#  define BDEVNAME_DECLARE_STORAGE(foo) char __unused_##foo
-#  define ll_bdevname(SB,STORAGE) ((void)__unused_##STORAGE,bdevname(lvfs_sbdev(SB)))
-#  define lvfs_sbdev(SB)       (kdev_t_to_nr((SB)->s_dev))
-#  define lvfs_sbdev_type      kdev_t
-#  define lvfs_sbdev_sync      fsync_dev
-# endif
+#define lvfs_sbdev_sync      fsync_bdev
 
 /* Instead of calling within lvfs (a layering violation) */
 #define lvfs_set_rdonly(obd, sb) \
diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h
index 501cd695a9..c373296c5e 100644
--- a/lustre/include/linux/obd_class.h
+++ b/lustre/include/linux/obd_class.h
@@ -59,9 +59,7 @@ void iattr_from_obdo(struct iattr *attr, struct obdo *oa, obd_flag valid);
 void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid);
 void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid);
 void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid);
-#endif
-
-#if !defined(__KERNEL__) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+#else
 #define to_kdev_t(dev) dev
 #define kdev_t_to_nr(dev) dev
 #endif
diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h
index fac5899b15..128e84eb4d 100644
--- a/lustre/include/linux/obd_support.h
+++ b/lustre/include/linux/obd_support.h
@@ -173,9 +173,8 @@ static inline cksum_type_t cksum_type_unpack(obd_flag o_flags)
 #define OBD_FAIL_WRITE(obd, id, sb)                                          \
 {                                                                            \
         if (OBD_FAIL_CHECK(id)) {                                            \
-                BDEVNAME_DECLARE_STORAGE(tmp);                               \
                 CERROR("obd_fail_loc=%x, fail write operation on %s\n",      \
-                       id, ll_bdevname(sb, tmp));                            \
+                       id, sb->s_id);                                        \
                 lvfs_set_rdonly(obd, sb);                                    \
                 /* We set FAIL_ONCE because we never "un-fail" a device */   \
                 obd_fail_loc |= OBD_FAILED | OBD_FAIL_ONCE;                  \
diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h
index 4c0dc659f2..9e45e64e32 100644
--- a/lustre/include/lustre_disk.h
+++ b/lustre/include/lustre_disk.h
@@ -260,14 +260,8 @@ struct lustre_sb_info {
 #define LSI_UMOUNT_FORCE                 0x00000010
 #define LSI_UMOUNT_FAILOVER              0x00000020
 
-#if  (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-# define    s2lsi(sb)        ((struct lustre_sb_info *)((sb)->s_fs_info))
-# define    s2lsi_nocast(sb) ((sb)->s_fs_info)
-#else  /* 2.4 here */
-# define    s2lsi(sb)        ((struct lustre_sb_info *)((sb)->u.generic_sbp))
-# define    s2lsi_nocast(sb) ((sb)->u.generic_sbp)
-#endif
-
+#define    s2lsi(sb)        ((struct lustre_sb_info *)((sb)->s_fs_info))
+#define    s2lsi_nocast(sb) ((sb)->s_fs_info)
 #define     get_profile_name(sb)   (s2lsi(sb)->lsi_lmd->lmd_profile)
 
 #endif /* __KERNEL__ */
diff --git a/lustre/include/lustre_quota.h b/lustre/include/lustre_quota.h
index 97e93b813f..8f014995fc 100644
--- a/lustre/include/lustre_quota.h
+++ b/lustre/include/lustre_quota.h
@@ -161,7 +161,6 @@ struct dquot_id {
 #define QFILE_CONVERT           7
 
 /* admin quotafile operations */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 int lustre_check_quota_file(struct lustre_quota_info *lqi, int type);
 int lustre_read_quota_info(struct lustre_quota_info *lqi, int type);
 int lustre_write_quota_info(struct lustre_quota_info *lqi, int type);
@@ -171,46 +170,6 @@ int lustre_init_quota_info(struct lustre_quota_info *lqi, int type);
 int lustre_get_qids(struct file *file, struct inode *inode, int type,
                     struct list_head *list);
 int lustre_quota_convert(struct lustre_quota_info *lqi, int type);
-#else
-
-#ifndef DQ_FAKE_B
-#define DQ_FAKE_B       6
-#endif
-
-static inline int lustre_check_quota_file(struct lustre_quota_info *lqi,
-                                          int type)
-{
-        return 0;
-}
-static inline int lustre_read_quota_info(struct lustre_quota_info *lqi,
-                                         int type)
-{
-        return 0;
-}
-static inline int lustre_write_quota_info(struct lustre_quota_info *lqi,
-                                          int type)
-{
-        return 0;
-}
-static inline int lustre_read_dquot(struct lustre_dquot *dquot)
-{
-        return 0;
-}
-static inline int lustre_commit_dquot(struct lustre_dquot *dquot)
-{
-        return 0;
-}
-static inline int lustre_init_quota_info(struct lustre_quota_info *lqi,
-                                         int type)
-{
-        return 0;
-}
-static inline int lustre_quota_convert(struct lustre_quota_info *lqi,
-                                       int type)
-{
-        return 0;
-}
-#endif  /* KERNEL_VERSION(2,5,0) */
 
 #define LL_DQUOT_OFF(sb)    DQUOT_OFF(sb)
 
diff --git a/lustre/llite/Makefile.in b/lustre/llite/Makefile.in
index fad7b02fd0..b5ed7bef20 100644
--- a/lustre/llite/Makefile.in
+++ b/lustre/llite/Makefile.in
@@ -3,10 +3,6 @@ lustre-objs := dcache.o dir.o file.o llite_close.o llite_lib.o llite_nfs.o rw.o
 
 llite_lloop-objs := lloop.o
 
-ifeq ($(PATCHLEVEL),4)
-lustre-objs += rw24.o super.o
-else
 lustre-objs += rw26.o super25.o
-endif
 
 @INCLUDE_RULES@
diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c
index 82146baf0e..26a152a669 100644
--- a/lustre/llite/dcache.c
+++ b/lustre/llite/dcache.c
@@ -234,14 +234,6 @@ int ll_drop_dentry(struct dentry *dentry)
                  * sys_getcwd() could return -ENOENT -bzzz */
 #ifdef DCACHE_LUSTRE_INVALID
                 dentry->d_flags |= DCACHE_LUSTRE_INVALID;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-                __d_drop(dentry);
-                if (dentry->d_inode) {
-                        /* Put positive dentries to orphan list */
-                        list_add(&dentry->d_hash,
-                             &ll_i2sbi(dentry->d_inode)->ll_orphan_dentry_list);
-                }
-#endif
 #else
                 if (!dentry->d_inode || !S_ISDIR(dentry->d_inode->i_mode))
                         __d_drop(dentry);
@@ -332,21 +324,17 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry)
 
         /* drop lookup or getattr locks immediately */
         if (it->it_op == IT_LOOKUP || it->it_op == IT_GETATTR) {
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
                 /* on 2.6 there are situation when several lookups and
                  * revalidations may be requested during single operation.
                  * therefore, we don't release intent here -bzzz */
                 ll_intent_drop_lock(it);
-#else
-                ll_intent_release(it);
-#endif
         }
 }
 
 void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft)
 {
         struct lookup_intent *it = *itp;
-#if defined(HAVE_VFS_INTENT_PATCHES)&&(LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+#ifdef HAVE_VFS_INTENT_PATCHES
         if (it) {
                 LASSERTF(it->it_magic == INTENT_MAGIC, "bad intent magic: %x\n",
                          it->it_magic);
@@ -682,7 +670,6 @@ out_sa:
         return;
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 #ifdef HAVE_VFS_INTENT_PATCHES
 static int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
 {
@@ -767,14 +754,9 @@ out_it:
         RETURN(rc);
 }
 #endif
-#endif
 
 struct dentry_operations ll_d_ops = {
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
         .d_revalidate = ll_revalidate_nd,
-#else
-        .d_revalidate_it = ll_revalidate_it,
-#endif
         .d_release = ll_release,
         .d_delete = ll_ddelete,
 #ifdef DCACHE_LUSTRE_INVALID
diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c
index 668f26b569..54cb7a36fe 100644
--- a/lustre/llite/dir.c
+++ b/lustre/llite/dir.c
@@ -44,11 +44,7 @@
 #include <linux/version.h>
 #include <linux/smp_lock.h>
 #include <asm/uaccess.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# include <linux/locks.h>   // for wait_on_buffer
-#else
-# include <linux/buffer_head.h>   // for wait_on_buffer
-#endif
+#include <linux/buffer_head.h>   // for wait_on_buffer
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
diff --git a/lustre/llite/file.c b/lustre/llite/file.c
index ec31cf6c7e..7b8e43a4c1 100644
--- a/lustre/llite/file.c
+++ b/lustre/llite/file.c
@@ -45,9 +45,6 @@
 #include <lustre_lite.h>
 #include <linux/pagemap.h>
 #include <linux/file.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/lustre_compat25.h>
-#endif
 #include "llite_internal.h"
 #include <lustre/ll_fiemap.h>
 
@@ -726,14 +723,10 @@ int ll_page_removal_cb(void *data, int discard)
                         CERROR("writepage inode %lu(%p) of page %p "
                                "failed: %d\n", mapping->host->i_ino,
                                mapping->host, page, rc);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
                         if (rc == -ENOSPC)
                                 set_bit(AS_ENOSPC, &mapping->flags);
                         else
                                 set_bit(AS_EIO, &mapping->flags);
-#else
-                        mapping->gfp_mask |= AS_EIO_MASK;
-#endif
                 }
         }
         if (page->mapping != NULL) {
@@ -1558,11 +1551,7 @@ repeat:
 
         /* turn off the kernel's read-ahead */
         if (lock_style != LL_LOCK_STYLE_NOLOCK) {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-                file->f_ramax = 0;
-#else
                 file->f_ra.ra_pages = 0;
-#endif
                 /* initialize read-ahead window once per syscall */
                 if (ra == 0) {
                         ra = 1;
@@ -1810,7 +1799,6 @@ static ssize_t ll_file_write(struct file *file, const char *buf, size_t count,
 /*
  * Send file content (through pagecache) somewhere with helper
  */
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 static ssize_t ll_file_sendfile(struct file *in_file, loff_t *ppos,size_t count,
                                 read_actor_t actor, void *target)
 {
@@ -1903,7 +1891,6 @@ static ssize_t ll_file_sendfile(struct file *in_file, loff_t *ppos,size_t count,
         ll_tree_unlock(&tree);
         RETURN(retval);
 }
-#endif
 
 static int ll_lov_recreate_obj(struct inode *inode, struct file *file,
                                unsigned long arg)
@@ -2714,12 +2701,7 @@ loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
         if (offset >= 0 && offset <= ll_file_maxbytes(inode)) {
                 if (offset != file->f_pos) {
                         file->f_pos = offset;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-                        file->f_reada = 0;
-                        file->f_version = ++event;
-#else
                         file->f_version = 0;
-#endif
                 }
                 retval = offset;
         }
@@ -2951,9 +2933,6 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it)
         }
         CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%s\n",
                inode->i_ino, inode->i_generation, inode, dentry->d_name.name);
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0))
-        ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_REVALIDATE, 1);
-#endif
 
         exp = ll_i2mdcexp(inode);
 
@@ -3032,7 +3011,6 @@ out:
         RETURN(rc);
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,
                   struct lookup_intent *it, struct kstat *stat)
 {
@@ -3074,7 +3052,6 @@ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat)
 
         return ll_getattr_it(mnt, de, &it, stat);
 }
-#endif
 
 static
 int lustre_check_acl(struct inode *inode, int mask)
@@ -3181,9 +3158,7 @@ struct file_operations ll_file_operations = {
         .release        = ll_file_release,
         .mmap           = ll_file_mmap,
         .llseek         = ll_file_seek,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
         .sendfile       = ll_file_sendfile,
-#endif
         .fsync          = ll_fsync,
 };
 
@@ -3205,9 +3180,7 @@ struct file_operations ll_file_operations_flock = {
         .release        = ll_file_release,
         .mmap           = ll_file_mmap,
         .llseek         = ll_file_seek,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
         .sendfile       = ll_file_sendfile,
-#endif
         .fsync          = ll_fsync,
 #ifdef HAVE_F_OP_FLOCK
         .flock          = ll_file_flock,
@@ -3234,9 +3207,7 @@ struct file_operations ll_file_operations_noflock = {
         .release        = ll_file_release,
         .mmap           = ll_file_mmap,
         .llseek         = ll_file_seek,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
         .sendfile       = ll_file_sendfile,
-#endif
         .fsync          = ll_fsync,
 #ifdef HAVE_F_OP_FLOCK
         .flock          = ll_file_noflock,
@@ -3250,11 +3221,7 @@ struct inode_operations ll_file_inode_operations = {
 #endif
         .setattr        = ll_setattr,
         .truncate       = ll_truncate,
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
         .getattr        = ll_getattr,
-#else
-        .revalidate_it  = ll_inode_revalidate_it,
-#endif
         .permission     = ll_inode_permission,
         .setxattr       = ll_setxattr,
         .getxattr       = ll_getxattr,
diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
index b3938ddb3c..43dac19865 100644
--- a/lustre/llite/llite_internal.h
+++ b/lustre/llite/llite_internal.h
@@ -76,11 +76,7 @@ struct lustre_intent_data {
 #ifdef HAVE_VFS_INTENT_PATCHES
 static inline struct lookup_intent *ll_nd2it(struct nameidata *nd)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
         return &nd->intent;
-#else
-        return nd->intent;
-#endif
 }
 #endif
 
@@ -164,10 +160,7 @@ struct ll_inode_info {
         __u64                   lli_open_fd_write_count;
         struct obd_client_handle *lli_mds_exec_och;
         __u64                   lli_open_fd_exec_count;
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
         struct inode            lli_vfs_inode;
-#endif
 
         /* metadata stat-ahead */
         /*
@@ -198,12 +191,7 @@ void ll_inode_size_unlock(struct inode *inode, int unlock_lsm);
 // static inline struct ll_inode_info *LL_I(struct inode *inode)
 static inline struct ll_inode_info *ll_i2info(struct inode *inode)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
         return container_of(inode, struct ll_inode_info, lli_vfs_inode);
-#else
-        CLASSERT(sizeof(inode->u) >= sizeof(struct ll_inode_info));
-        return (struct ll_inode_info *)&(inode->u.generic_ip);
-#endif
 }
 
 /* default to about 40meg of readahead on a given system.  That much tied
@@ -470,11 +458,7 @@ extern struct proc_dir_entry *proc_lustre_fs_root;
 
 static inline struct inode *ll_info2i(struct ll_inode_info *lli)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
         return &lli->lli_vfs_inode;
-#else
-        return list_entry(lli, struct inode, u.generic_ip);
-#endif
 }
 
 struct it_cb_data {
@@ -659,11 +643,9 @@ int ll_mdc_close(struct obd_export *mdc_exp, struct inode *inode,
 int ll_mdc_real_close(struct inode *inode, int flags);
 extern void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid, struct file
                                *file, size_t count, int rw);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,
                struct lookup_intent *it, struct kstat *stat);
 int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);
-#endif
 struct ll_file_data *ll_file_data_get(void);
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
 int ll_inode_permission(struct inode *inode, int mask, struct nameidata *nd);
@@ -792,10 +774,8 @@ void ll_close_thread_shutdown(struct ll_close_queue *lcq);
 int ll_close_thread_start(struct ll_close_queue **lcq_ret);
 
 /* llite/llite_mmap.c */
-#if  (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 typedef struct rb_root  rb_root_t;
 typedef struct rb_node  rb_node_t;
-#endif
 
 struct ll_lock_tree_node;
 struct ll_lock_tree {
@@ -819,18 +799,11 @@ int ll_tree_unlock(struct ll_lock_tree *tree);
 
 #define    ll_s2sbi(sb)        (s2lsi(sb)->lsi_llsbi)
 
-#if  (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 static inline __u64 ll_ts2u64(struct timespec *time)
 {
         __u64 t = time->tv_sec;
         return t;
 }
-#else  /* 2.4 here */
-static inline __u64 ll_ts2u64(time_t *time)
-{
-        return *time;
-}
-#endif
 
 /* don't need an addref as the sb_info should be holding one */
 static inline struct obd_export *ll_s2obdexp(struct super_block *sb)
diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
index b59fdb6b35..2cf609800b 100644
--- a/lustre/llite/llite_lib.c
+++ b/lustre/llite/llite_lib.c
@@ -540,27 +540,6 @@ void lustre_dump_dentry(struct dentry *dentry, int recur)
         }
 }
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-void lustre_throw_orphan_dentries(struct super_block *sb)
-{
-        struct dentry *dentry, *next;
-        struct ll_sb_info *sbi = ll_s2sbi(sb);
-
-        /* Do this to get rid of orphaned dentries. That is not really trw. */
-        list_for_each_entry_safe(dentry, next, &sbi->ll_orphan_dentry_list,
-                                 d_hash) {
-                CWARN("found orphan dentry %.*s (%p->%p) at unmount, dumping "
-                      "before and after shrink_dcache_parent\n",
-                      dentry->d_name.len, dentry->d_name.name, dentry, next);
-                lustre_dump_dentry(dentry, 1);
-                shrink_dcache_parent(dentry);
-                lustre_dump_dentry(dentry, 1);
-        }
-}
-#else
-#define lustre_throw_orphan_dentries(sb)
-#endif
-
 #ifdef HAVE_EXPORT___IGET
 static void prune_dir_dentries(struct inode *inode)
 {
@@ -677,8 +656,6 @@ void client_common_put_super(struct super_block *sb)
         obd_disconnect(sbi->ll_mdc_exp);
         sbi->ll_mdc_exp = NULL;
 
-        lustre_throw_orphan_dentries(sb);
-
         EXIT;
 }
 
@@ -1371,13 +1348,8 @@ static int ll_setattr_do_truncate(struct inode *inode, loff_t new_size)
                         local_lock = 1;
         }
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        DOWN_WRITE_I_ALLOC_SEM(inode);
-        LOCK_INODE_MUTEX(inode);
-#else
         LOCK_INODE_MUTEX(inode);
         DOWN_WRITE_I_ALLOC_SEM(inode);
-#endif
         if (likely(rc == 0)) {
                 /* Only ll_inode_size_lock is taken at this level.
                  * lov_stripe_lock() is grabbed by ll_truncate() only over
@@ -1828,11 +1800,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
         if (body->valid & OBD_MD_FLGENER)
                 inode->i_generation = body->generation;
         if (body->valid & OBD_MD_FLRDEV)
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-                inode->i_rdev = body->rdev;
-#else
                 inode->i_rdev = old_decode_dev(body->rdev);
-#endif
         if (body->valid & OBD_MD_FLSIZE) {
 #if 0           /* Can't block ll_test_inode->ll_update_inode, b=14326*/
                 ll_inode_size_lock(inode, 0);
@@ -1849,7 +1817,6 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
                 set_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &lli->lli_flags);
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 static struct backing_dev_info ll_backing_dev_info = {
         .ra_pages       = 0,    /* No readahead */
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
@@ -1858,7 +1825,6 @@ static struct backing_dev_info ll_backing_dev_info = {
         .memory_backed  = 0,    /* Does contribute to dirty memory */
 #endif
 };
-#endif
 
 void ll_read_inode2(struct inode *inode, void *opaque)
 {
@@ -1901,16 +1867,10 @@ void ll_read_inode2(struct inode *inode, void *opaque)
                 EXIT;
         } else {
                 inode->i_op = &ll_special_inode_operations;
-
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
                 init_special_inode(inode, inode->i_mode,
                                    kdev_t_to_nr(inode->i_rdev));
-
                 /* initializing backing dev info. */
                 inode->i_mapping->backing_dev_info = &ll_backing_dev_info;
-#else
-                init_special_inode(inode, inode->i_mode, inode->i_rdev);
-#endif
                 EXIT;
         }
 }
diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c
index d48ddd8c53..886cf9d329 100644
--- a/lustre/llite/llite_mmap.c
+++ b/lustre/llite/llite_mmap.c
@@ -53,9 +53,6 @@
 #include <linux/mm.h>
 #include <linux/pagemap.h>
 #include <linux/smp_lock.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/iobuf.h>
-#endif
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
@@ -605,8 +602,7 @@ int ll_file_mmap(struct file * file, struct vm_area_struct * vma)
         ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), LPROC_LL_MAP, 1);
         rc = generic_file_mmap(file, vma);
         if (rc == 0) {
-#if !defined(HAVE_FILEMAP_POPULATE) && \
-    (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+#ifndef HAVE_FILEMAP_POPULATE
                 if (!filemap_populate)
                         filemap_populate = vma->vm_ops->populate;
 #endif
diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c
index dca145b7a0..c941d73582 100644
--- a/lustre/llite/llite_nfs.c
+++ b/lustre/llite/llite_nfs.c
@@ -57,11 +57,7 @@ __u32 get_uuid2int(const char *name, int len)
         return (key0 << 1);
 }
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-static int ll_nfs_test_inode(struct inode *inode, unsigned long ino, void *opaque)
-#else
 static int ll_nfs_test_inode(struct inode *inode, void *opaque)
-#endif
 {
         struct ll_fid *iid = opaque;
 
@@ -120,9 +116,6 @@ static struct dentry *ll_iget_for_nfs(struct super_block *sb, unsigned long ino,
 {
         struct inode *inode;
         struct dentry *result;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        struct list_head *lp;
-#endif
         ENTRY;
 
         if (ino == 0)
@@ -143,39 +136,11 @@ static struct dentry *ll_iget_for_nfs(struct super_block *sb, unsigned long ino,
                 RETURN(ERR_PTR(-ESTALE));
         }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
         result = d_alloc_anon(inode);
         if (!result) {
                 iput(inode);
                 RETURN(ERR_PTR(-ENOMEM));
         }
-#else
-        /* now to find a dentry.
-         * If possible, get a well-connected one
-         */
-        spin_lock(&dcache_lock);
-        for (lp = inode->i_dentry.next; lp != &inode->i_dentry ; lp=lp->next) {
-                result = list_entry(lp,struct dentry, d_alias);
-                lock_dentry(result);
-                if (!(result->d_flags & DCACHE_DISCONNECTED)) {
-                        dget_locked(result);
-                        ll_set_dflags(result, DCACHE_REFERENCED);
-                        unlock_dentry(result);
-                        spin_unlock(&dcache_lock);
-                        iput(inode);
-                        RETURN(result);
-                }
-                unlock_dentry(result);
-        }
-        spin_unlock(&dcache_lock);
-        result = d_alloc_root(inode);
-        if (result == NULL) {
-                iput(inode);
-                RETURN(ERR_PTR(-ENOMEM));
-        }
-        result->d_flags |= DCACHE_DISCONNECTED;
-
-#endif
         ll_dops_init(result, 1);
 
         RETURN(result);
diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c
index 14dea45f27..84298b007a 100644
--- a/lustre/llite/lproc_llite.c
+++ b/lustre/llite/lproc_llite.c
@@ -616,11 +616,7 @@ struct llite_file_opcode {
         { LPROC_LL_TRUNC,          LPROCFS_TYPE_REGS, "truncate" },
         { LPROC_LL_LOCKLESS_TRUNC, LPROCFS_TYPE_REGS, "lockless_truncate" },
         { LPROC_LL_FLOCK,          LPROCFS_TYPE_REGS, "flock" },
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
         { LPROC_LL_GETATTR,        LPROCFS_TYPE_REGS, "getattr" },
-#else
-        { LPROC_LL_REVALIDATE,     LPROCFS_TYPE_REGS, "getattr" },
-#endif
         /* special inode operation */
         { LPROC_LL_STAFS,          LPROCFS_TYPE_REGS, "statfs" },
         { LPROC_LL_ALLOC_INODE,    LPROCFS_TYPE_REGS, "alloc_inode" },
diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c
index 27dfd6c626..3c577ff438 100644
--- a/lustre/llite/namei.c
+++ b/lustre/llite/namei.c
@@ -616,7 +616,6 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
         return retval;
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 #ifdef HAVE_VFS_INTENT_PATCHES
 static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
                                    struct nameidata *nd)
@@ -745,7 +744,6 @@ static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
         RETURN(de);
 }
 #endif
-#endif
 
 /* We depend on "mode" being set with the proper file type/umask by now */
 static struct inode *ll_create_node(struct inode *dir, const char *name,
@@ -932,7 +930,6 @@ static int ll_mknod_generic(struct inode *dir, struct qstr *name, int mode,
         RETURN(err);
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 #ifndef HAVE_VFS_INTENT_PATCHES
 static int ll_create_nd(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
 {
@@ -977,7 +974,6 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry, int mode, stru
         return ll_create_it(dir, dentry, mode, &nd->intent);
 }
 #endif
-#endif
 
 static int ll_symlink_generic(struct inode *dir, struct qstr *name,
                               const char *tgt, struct dentry *dchild)
@@ -1283,7 +1279,6 @@ static int ll_mknod(struct inode *dir, struct dentry *dchild, int mode,
                                 old_encode_dev(rdev), dchild);
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 static int ll_unlink(struct inode * dir, struct dentry *dentry)
 {
         return ll_unlink_generic(dir, &dentry->d_name);
@@ -1321,7 +1316,6 @@ static int ll_rename(struct inode *old_dir, struct dentry *old_dentry,
         }
         return err;
 }
-#endif
 
 struct inode_operations ll_dir_inode_operations = {
 #ifdef HAVE_VFS_INTENT_PATCHES
@@ -1336,11 +1330,6 @@ struct inode_operations ll_dir_inode_operations = {
         .setattr_raw        = ll_setattr_raw,
 #endif
         .mknod              = ll_mknod,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        .create_it          = ll_create_it,
-        .lookup_it          = ll_lookup_it,
-        .revalidate_it      = ll_inode_revalidate_it,
-#else
         .lookup             = ll_lookup_nd,
         .create             = ll_create_nd,
         /* We need all these non-raw things for NFSD, to not patch it. */
@@ -1352,7 +1341,6 @@ struct inode_operations ll_dir_inode_operations = {
         .rename             = ll_rename,
         .setattr            = ll_setattr,
         .getattr            = ll_getattr,
-#endif
         .permission         = ll_inode_permission,
         .setxattr           = ll_setxattr,
         .getxattr           = ll_getxattr,
@@ -1365,11 +1353,7 @@ struct inode_operations ll_special_inode_operations = {
         .setattr_raw    = ll_setattr_raw,
 #endif
         .setattr        = ll_setattr,
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
         .getattr        = ll_getattr,
-#else
-        .revalidate_it  = ll_inode_revalidate_it,
-#endif
         .permission     = ll_inode_permission,
         .setxattr       = ll_setxattr,
         .getxattr       = ll_getxattr,
diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c
index eaef58a0fe..7d10cc79f2 100644
--- a/lustre/llite/rw.c
+++ b/lustre/llite/rw.c
@@ -938,14 +938,10 @@ int ll_ap_completion(void *data, int cmd, struct obdo *oa, int rc)
                         llap->llap_defer_uptodate = 0;
                 }
                 SetPageError(page);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
                 if (rc == -ENOSPC)
                         set_bit(AS_ENOSPC, &page->mapping->flags);
                 else
                         set_bit(AS_EIO, &page->mapping->flags);
-#else
-                page->mapping->gfp_mask |= AS_EIO_MASK;
-#endif
         }
 
         /* be carefull about clear WB.
diff --git a/lustre/llite/symlink.c b/lustre/llite/symlink.c
index 72825434e6..ec6fcc404e 100644
--- a/lustre/llite/symlink.c
+++ b/lustre/llite/symlink.c
@@ -227,11 +227,7 @@ struct inode_operations ll_fast_symlink_inode_operations = {
 #ifdef HAVE_COOKIE_FOLLOW_LINK
         .put_link       = ll_put_link,
 #endif
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        .revalidate_it  = ll_inode_revalidate_it,
-#else 
         .getattr        = ll_getattr,
-#endif
         .permission     = ll_inode_permission,
         .setxattr       = ll_setxattr,
         .getxattr       = ll_getxattr,
diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c
index 653a9e2919..71ab80f364 100644
--- a/lustre/lov/lproc_lov.c
+++ b/lustre/lov/lproc_lov.c
@@ -36,9 +36,7 @@
 #define DEBUG_SUBSYSTEM S_CLASS
 
 #include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #include <asm/statfs.h>
-#endif
 #include <lprocfs_status.h>
 #include <obd_class.h>
 #include <linux/seq_file.h>
diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c
index 69d5f4db48..825acbc91e 100644
--- a/lustre/lvfs/fsfilt_ext3.c
+++ b/lustre/lvfs/fsfilt_ext3.c
@@ -55,19 +55,12 @@
 #include <linux/quotaio_v1.h>
 #include <linux/quotaio_v2.h>
 #include <linux/parser.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/ext3_xattr.h>
-#else
 #include <ext3/xattr.h>
-#endif
 
 #include <libcfs/kp30.h>
 #include <lustre_fsfilt.h>
 #include <obd.h>
 #include <lustre_quota.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/iobuf.h>
-#endif
 #include <linux/lustre_compat25.h>
 #include <linux/lprocfs_status.h>
 
@@ -92,15 +85,6 @@
 #define FSFILT_SINGLEDATA_TRANS_BLOCKS(sb) EXT3_SINGLEDATA_TRANS_BLOCKS
 #endif
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#define fsfilt_ext3_journal_start(inode, nblocks) \
-                                journal_start(EXT3_JOURNAL(inode),nblocks)
-#define fsfilt_ext3_journal_stop(handle)          journal_stop(handle)
-#else
-#define fsfilt_ext3_journal_start(inode, nblocks) ext3_journal_start(inode, nblocks)
-#define fsfilt_ext3_journal_stop(handle)          ext3_journal_stop(handle)
-#endif
-
 static cfs_mem_cache_t *fcb_cache;
 
 struct fsfilt_cb_data {
@@ -131,9 +115,7 @@ static int fsfilt_ext3_set_label(struct super_block *sb, char *label)
         int err;
 
         journal = EXT3_SB(sb)->s_journal;
-        lock_24kernel();
         handle = journal_start(journal, 1);
-        unlock_24kernel();
         if (IS_ERR(handle)) {
                 CERROR("can't start transaction\n");
                 return(PTR_ERR(handle));
@@ -149,9 +131,7 @@ static int fsfilt_ext3_set_label(struct super_block *sb, char *label)
         err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
 
 out:
-        lock_24kernel();
         journal_stop(handle);
-        unlock_24kernel();
 
         return(err);
 }
@@ -291,9 +271,7 @@ static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private,
 
  journal_start:
         LASSERTF(nblocks > 0, "can't start %d credit transaction\n", nblocks);
-        lock_24kernel();
-        handle = fsfilt_ext3_journal_start(inode, nblocks);
-        unlock_24kernel();
+        handle = ext3_journal_start(inode, nblocks);
 
         if (!IS_ERR(handle))
                 LASSERT(current->journal_info == handle);
@@ -430,9 +408,7 @@ static void *fsfilt_ext3_brw_start(int objcount, struct fsfilt_objinfo *fso,
         }
 
         LASSERTF(needed > 0, "can't start %d credit transaction\n", needed);
-        lock_24kernel();
-        handle = fsfilt_ext3_journal_start(fso->fso_dentry->d_inode, needed);
-        unlock_24kernel();
+        handle = ext3_journal_start(fso->fso_dentry->d_inode, needed);
         if (IS_ERR(handle)) {
                 CERROR("can't get handle for %d credits: rc = %ld\n", needed,
                        PTR_ERR(handle));
@@ -472,9 +448,7 @@ static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync)
         if (force_sync)
                 handle->h_sync = 1; /* recovery likes this */
 
-        lock_24kernel();
-        rc = fsfilt_ext3_journal_stop(handle);
-        unlock_24kernel();
+        rc = ext3_journal_stop(handle);
 
         return rc;
 }
@@ -484,36 +458,23 @@ static int fsfilt_ext3_commit_async(struct inode *inode, void *h,
 {
         unsigned long tid;
         transaction_t *transaction;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-        unsigned long rtid;
-#endif
         handle_t *handle = h;
         journal_t *journal;
         int rc;
 
         LASSERT(current->journal_info == handle);
 
-        lock_24kernel();
         transaction = handle->h_transaction;
         journal = transaction->t_journal;
         tid = transaction->t_tid;
         /* we don't want to be blocked */
         handle->h_sync = 0;
-        rc = fsfilt_ext3_journal_stop(handle);
+        rc = ext3_journal_stop(handle);
         if (rc) {
                 CERROR("error while stopping transaction: %d\n", rc);
-                unlock_24kernel();
                 return rc;
         }
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-        rtid = log_start_commit(journal, transaction);
-        if (rtid != tid)
-                CERROR("strange race: %lu != %lu\n",
-                       (unsigned long) tid, (unsigned long) rtid);
-#else
         log_start_commit(journal, tid);
-#endif
-        unlock_24kernel();
 
         *wait_handle = (void *) tid;
         CDEBUG(D_INODE, "commit async: %lu\n", (unsigned long) tid);
@@ -542,8 +503,6 @@ static int fsfilt_ext3_setattr(struct dentry *dentry, void *handle,
         struct inode *inode = dentry->d_inode;
         int rc = 0;
 
-        lock_24kernel();
-
         /* Avoid marking the inode dirty on the superblock list unnecessarily.
          * We are already writing the inode to disk as part of this
          * transaction and want to avoid a lot of extra inode writeout
@@ -594,7 +553,6 @@ static int fsfilt_ext3_setattr(struct dentry *dentry, void *handle,
         }
 
  out:
-        unlock_24kernel();
         RETURN(rc);
 }
 
@@ -625,12 +583,9 @@ static int fsfilt_ext3_set_md(struct inode *inode, void *handle,
 
         LASSERT(TRYLOCK_INODE_MUTEX(inode) == 0);
 
-        lock_24kernel();
         rc = ext3_xattr_set_handle(handle, inode, EXT3_XATTR_INDEX_TRUSTED,
                                    name, lmm, lmm_size, XATTR_NO_CTIME);
 
-        unlock_24kernel();
-
         if (rc && rc != -EROFS)
                 CERROR("error adding MD data to inode %lu: rc = %d\n",
                        inode->i_ino, rc);
@@ -644,12 +599,9 @@ static int fsfilt_ext3_get_md(struct inode *inode, void *lmm, int lmm_size,
         int rc;
 
         LASSERT(TRYLOCK_INODE_MUTEX(inode) == 0);
-        lock_24kernel();
 
         rc = ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED,
                             name, lmm, lmm_size);
-        unlock_24kernel();
-
         /* This gives us the MD size */
         if (lmm == NULL)
                 return (rc == -ENODATA) ? 0 : rc;
@@ -665,43 +617,11 @@ static int fsfilt_ext3_get_md(struct inode *inode, void *lmm, int lmm_size,
         return rc;
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 static int fsfilt_ext3_send_bio(int rw, struct inode *inode, struct bio *bio)
 {
         submit_bio(rw, bio);
         return 0;
 }
-#else
-static int fsfilt_ext3_send_bio(int rw, struct inode *inode, struct kiobuf *bio)
-{
-        int rc, blk_per_page;
-
-        rc = brw_kiovec(rw, 1, &bio, inode->i_dev,
-                        KIOBUF_GET_BLOCKS(bio), 1 << inode->i_blkbits);
-        /*
-         * brw_kiovec() returns number of bytes actually written. If error
-         * occurred after something was written, error code is returned though
-         * kiobuf->errno. (See bug 6854.)
-         */
-
-        blk_per_page = CFS_PAGE_SIZE >> inode->i_blkbits;
-
-        if (rc != (1 << inode->i_blkbits) * bio->nr_pages * blk_per_page) {
-                CERROR("short write?  expected %d, wrote %d (%d)\n",
-                       (1 << inode->i_blkbits) * bio->nr_pages * blk_per_page,
-                       rc, bio->errno);
-        }
-        if (bio->errno != 0) {
-                CERROR("IO error. Wrote %d of %d (%d)\n",
-                       rc,
-                       (1 << inode->i_blkbits) * bio->nr_pages * blk_per_page,
-                       bio->errno);
-                rc = bio->errno;
-        }
-
-        return rc;
-}
-#endif
 
 static ssize_t fsfilt_ext3_readpage(struct file *file, char *buf, size_t count,
                                     loff_t *off)
@@ -784,10 +704,8 @@ static int fsfilt_ext3_add_journal_cb(struct obd_device *obd, __u64 last_rcvd,
         fcb->cb_data = cb_data;
 
         CDEBUG(D_EXT2, "set callback for last_rcvd: "LPD64"\n", last_rcvd);
-        lock_24kernel();
         journal_callback_set(handle, fsfilt_ext3_cb_func,
                              (struct journal_callback *)fcb);
-        unlock_24kernel();
 
         return 0;
 }
@@ -830,10 +748,7 @@ static int fsfilt_ext3_sync(struct super_block *sb)
 #endif
 
 #ifdef EXT3_MULTIBLOCK_ALLOCATOR
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#define ext3_up_truncate_sem(inode)  up_write(&EXT3_I(inode)->truncate_sem);
-#define ext3_down_truncate_sem(inode)  down_write(&EXT3_I(inode)->truncate_sem);
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
 #define ext3_up_truncate_sem(inode)  up(&EXT3_I(inode)->truncate_sem);
 #define ext3_down_truncate_sem(inode)  down(&EXT3_I(inode)->truncate_sem);
 #else
@@ -920,25 +835,8 @@ static int ext3_ext_find_goal(struct inode *inode, struct ext3_ext_path *path,
         return bg_start + colour + block;
 }
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/locks.h>
-static void ll_unmap_underlying_metadata(struct super_block *sb,
-                                         unsigned long blocknr)
-{
-        struct buffer_head *old_bh;
-
-        old_bh = get_hash_table(sb->s_dev, blocknr, sb->s_blocksize);
-        if (old_bh) {
-                mark_buffer_clean(old_bh);
-                wait_on_buffer(old_bh);
-                clear_bit(BH_Req, &old_bh->b_state);
-                __brelse(old_bh);
-        }
-}
-#else
 #define ll_unmap_underlying_metadata(sb, blocknr) \
         unmap_underlying_metadata((sb)->s_bdev, blocknr)
-#endif
 
 #ifndef EXT3_MB_HINT_GROUP_ALLOC
 static unsigned long new_blocks(handle_t *handle, struct ext3_ext_base *base,
@@ -951,9 +849,7 @@ static unsigned long new_blocks(handle_t *handle, struct ext3_ext_base *base,
 
         goal = ext3_ext_find_goal(inode, path, block, &aflags);
         aflags |= 2; /* block have been already reserved */
-        lock_24kernel();
         pblock = ext3_mb_new_blocks(handle, inode, goal, count, aflags, err);
-        unlock_24kernel();
         return pblock;
 
 }
@@ -1050,9 +946,7 @@ static int ext3_ext_new_extent_cb(struct ext3_ext_base *base,
         count = ext3_ext_calc_credits_for_insert(base, path);
         ext3_up_truncate_sem(inode);
 
-        lock_24kernel();
-        handle = fsfilt_ext3_journal_start(inode, count+EXT3_ALLOC_NEEDED+1);
-        unlock_24kernel();
+        handle = ext3_journal_start(inode, count+EXT3_ALLOC_NEEDED+1);
         if (IS_ERR(handle)) {
                 ext3_down_truncate_sem(inode);
                 return PTR_ERR(handle);
@@ -1061,9 +955,7 @@ static int ext3_ext_new_extent_cb(struct ext3_ext_base *base,
         ext3_down_truncate_sem(inode);
         if (tgen != EXT_GENERATION(base)) {
                 /* the tree has changed. so path can be invalid at moment */
-                lock_24kernel();
-                fsfilt_ext3_journal_stop(handle);
-                unlock_24kernel();
+                ext3_journal_stop(handle);
                 return EXT_REPEAT;
         }
 
@@ -1100,9 +992,7 @@ static int ext3_ext_new_extent_cb(struct ext3_ext_base *base,
         BUG_ON(nex.ee_block != cex->ec_block);
 
 out:
-        lock_24kernel();
-        fsfilt_ext3_journal_stop(handle);
-        unlock_24kernel();
+        ext3_journal_stop(handle);
 map:
         if (err >= 0) {
                 /* map blocks */
@@ -1334,10 +1224,8 @@ static int fsfilt_ext3_write_record(struct file *file, void *buf, int bufsize,
         block_count = (*offs & (blocksize - 1)) + bufsize;
         block_count = (block_count + blocksize - 1) >> inode->i_blkbits;
 
-        lock_24kernel();
-        handle = fsfilt_ext3_journal_start(inode,
+        handle = ext3_journal_start(inode,
                                block_count * FSFILT_DATA_TRANS_BLOCKS(inode->i_sb) + 2);
-        unlock_24kernel();
         if (IS_ERR(handle)) {
                 CERROR("can't start transaction for %d blocks (%d bytes)\n",
                        block_count * FSFILT_DATA_TRANS_BLOCKS(inode->i_sb) + 2, bufsize);
@@ -1396,9 +1284,7 @@ out:
                 unlock_kernel();
         }
 
-        lock_24kernel();
-        fsfilt_ext3_journal_stop(handle);
-        unlock_24kernel();
+        ext3_journal_stop(handle);
 
         if (err == 0)
                 *offs = offset;
@@ -2243,11 +2129,7 @@ static int fsfilt_ext3_dquot(struct lustre_dquot *dquot, int cmd)
 
 static lvfs_sbdev_type fsfilt_ext3_journal_sbdev(struct super_block *sb)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
         return (EXT3_SB(sb)->journal_bdev);
-#else
-        return kdev_t_to_nr(EXT3_SB(sb)->s_journal->j_dev);
-#endif
 }
 
 static struct fsfilt_operations fsfilt_ext3_ops = {
diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c
index 2a202b8b33..9cbf3fb8f3 100644
--- a/lustre/mdc/mdc_request.c
+++ b/lustre/mdc/mdc_request.c
@@ -842,14 +842,10 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
         int rc;
         ENTRY;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        MOD_INC_USE_COUNT;
-#else
         if (!try_module_get(THIS_MODULE)) {
                 CERROR("Can't get module. Is it alive?");
                 return -EINVAL;
         }
-#endif
         switch (cmd) {
         case OBD_IOC_CLIENT_RECOVER:
                 rc = ptlrpc_recover_import(imp, data->ioc_inlbuf1);
@@ -883,12 +879,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 GOTO(out, rc = -ENOTTY);
         }
 out:
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        MOD_DEC_USE_COUNT;
-#else
         module_put(THIS_MODULE);
-#endif
-
         return rc;
 }
 
diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c
index 4599cb5bc1..7a41f07793 100644
--- a/lustre/mds/handler.c
+++ b/lustre/mds/handler.c
@@ -52,14 +52,10 @@
 #include <linux/random.h>
 #include <linux/fs.h>
 #include <linux/jbd.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 # include <linux/smp_lock.h>
 # include <linux/buffer_head.h>
 # include <linux/workqueue.h>
 # include <linux/mount.h>
-#else
-# include <linux/locks.h>
-#endif
 
 #include <obd_class.h>
 #include <lustre_dlm.h>
@@ -725,12 +721,9 @@ int mds_pack_posix_acl(struct inode *inode, struct lustre_msg *repmsg,
         if (!inode->i_op || !inode->i_op->getxattr)
                 GOTO(out, 0);
 
-        lock_24kernel();
         rc = inode->i_op->getxattr(&de, MDS_XATTR_NAME_ACL_ACCESS,
                                    lustre_msg_buf(repmsg, repoff, buflen),
                                    buflen);
-        unlock_24kernel();
-
         if (rc >= 0)
                 repbody->aclsize = rc;
         else if (rc != -ENODATA) {
@@ -917,11 +910,8 @@ static int mds_getattr_pack_msg(struct ptlrpc_request *req, struct inode *inode,
 
                 size[bufcount] = 0;
                 if (inode->i_op && inode->i_op->getxattr) {
-                        lock_24kernel();
                         rc = inode->i_op->getxattr(&de, MDS_XATTR_NAME_ACL_ACCESS,
                                                    NULL, 0);
-                        unlock_24kernel();
-
                         if (rc < 0) {
                                 if (rc != -ENODATA) {
                                         CERROR("got acl size: %d\n", rc);
diff --git a/lustre/mds/lproc_mds.c b/lustre/mds/lproc_mds.c
index 6a813599fc..24e03cdd5a 100644
--- a/lustre/mds/lproc_mds.c
+++ b/lustre/mds/lproc_mds.c
@@ -36,9 +36,7 @@
 #define DEBUG_SUBSYSTEM S_CLASS
 
 #include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #include <asm/statfs.h>
-#endif
 #include <obd.h>
 #include <obd_class.h>
 #include <lprocfs_status.h>
diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c
index 1dd0c34b47..c3c6ef1a69 100644
--- a/lustre/mds/mds_fs.c
+++ b/lustre/mds/mds_fs.c
@@ -50,9 +50,7 @@
 #include <linux/version.h>
 #include <linux/sched.h>
 #include <lustre_quota.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #include <linux/mount.h>
-#endif
 #include <lustre_mds.h>
 #include <obd_class.h>
 #include <obd_support.h>
diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h
index 91e2774cdd..f8fb96fff5 100644
--- a/lustre/mds/mds_internal.h
+++ b/lustre/mds/mds_internal.h
@@ -66,11 +66,7 @@ static inline void mds_export_evict(struct obd_export *exp)
 
 #ifdef __KERNEL__
 /* Open counts for files.  No longer atomic, must hold inode->i_sem */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 # define mds_inode_oatomic(inode)    ((inode)->i_cindex)
-#else
-# define mds_inode_oatomic(inode)    ((inode)->i_attr_flags)
-#endif
 
 #ifdef HAVE_I_ALLOC_SEM
 #define MDS_UP_READ_ORPHAN_SEM(i)          UP_READ_I_ALLOC_SEM(i)
diff --git a/lustre/mds/mds_lib.c b/lustre/mds/mds_lib.c
index 3ba3e53dd6..9c91af7659 100644
--- a/lustre/mds/mds_lib.c
+++ b/lustre/mds/mds_lib.c
@@ -46,11 +46,7 @@
 #include <linux/stat.h>
 #include <linux/errno.h>
 #include <linux/version.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# include <linux/locks.h>   // for wait_on_buffer
-#else
-# include <linux/buffer_head.h>   // for wait_on_buffer
-#endif
+#include <linux/buffer_head.h>   // for wait_on_buffer
 #include <linux/unistd.h>
 
 #include <asm/system.h>
diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c
index 339850899c..f03fa742f1 100644
--- a/lustre/mds/mds_lov.c
+++ b/lustre/mds/mds_lov.c
@@ -797,9 +797,8 @@ int mds_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
         case OBD_IOC_SET_READONLY: {
                 void *handle;
                 struct inode *inode = obd->u.obt.obt_sb->s_root->d_inode;
-                BDEVNAME_DECLARE_STORAGE(tmp);
                 LCONSOLE_WARN("*** setting obd %s device '%s' read-only ***\n",
-                       obd->obd_name, ll_bdevname(obd->u.obt.obt_sb, tmp));
+                       obd->obd_name, obd->u.obt.obt_sb->s_id);
 
                 handle = fsfilt_start(obd, inode, FSFILT_OP_MKNOD, NULL);
                 if (!IS_ERR(handle))
diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c
index 10e2ef3218..ff77e088f9 100644
--- a/lustre/mds/mds_open.c
+++ b/lustre/mds/mds_open.c
@@ -50,12 +50,8 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-# include <linux/buffer_head.h>
-# include <linux/workqueue.h>
-#else
-# include <linux/locks.h>
-#endif
+#include <linux/buffer_head.h>
+#include <linux/workqueue.h>
 
 #include <obd_class.h>
 #include <obd_lov.h>
diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c
index b4920a86ce..b8c82dacc2 100644
--- a/lustre/mds/mds_reint.c
+++ b/lustre/mds/mds_reint.c
@@ -2379,12 +2379,10 @@ no_unlink:
         OBD_FAIL_WRITE(obd, OBD_FAIL_MDS_REINT_RENAME_WRITE,
                        de_srcdir->d_inode->i_sb);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
         /* Check if we are moving old entry into its child. 2.6 does not
            check for this in vfs_rename() anymore */
         if (is_subdir(de_new, de_old))
                 GOTO(cleanup, rc = -EINVAL);
-#endif
 
         lmm = lustre_msg_buf(req->rq_repmsg, offset + 1, 0);
         handle = fsfilt_start_log(obd, de_tgtdir->d_inode, FSFILT_OP_RENAME,
diff --git a/lustre/mds/mds_xattr.c b/lustre/mds/mds_xattr.c
index e02ffc97b6..19f8956c91 100644
--- a/lustre/mds/mds_xattr.c
+++ b/lustre/mds/mds_xattr.c
@@ -145,10 +145,8 @@ static int mds_getxattr_internal(struct obd_device *obd,
                 DEBUG_REQ(D_INODE, req, "getxattr %s", xattr_name);
 
                 if (inode->i_op && inode->i_op->getxattr) {
-                        lock_24kernel();
                         rc = inode->i_op->getxattr(dentry, xattr_name,
                                                    buf, buflen);
-                        unlock_24kernel();
                 }
 
                 if (rc < 0 && rc != -ENODATA && rc != -EOPNOTSUPP &&
@@ -157,11 +155,8 @@ static int mds_getxattr_internal(struct obd_device *obd,
         } else if (reqbody->valid & OBD_MD_FLXATTRLS) {
                 DEBUG_REQ(D_INODE, req, "listxattr");
 
-                if (inode->i_op && inode->i_op->listxattr) {
-                        lock_24kernel();
+                if (inode->i_op && inode->i_op->listxattr)
                         rc = inode->i_op->listxattr(dentry, buf, buflen);
-                        unlock_24kernel();
-                }
                 if (rc < 0)
                         CDEBUG(D_OTHER, "listxattr failed: %d\n", rc);
         } else
@@ -302,18 +297,14 @@ int mds_setxattr_internal(struct ptlrpc_request *req, struct mds_body *body)
                                                        REQ_REC_OFF+2, xattrlen);
 
                         LOCK_INODE_MUTEX(inode);
-                        lock_24kernel();
                         rc = inode->i_op->setxattr(de, xattr_name, xattr,
                                                    xattrlen, body->flags);
-                        unlock_24kernel();
                         UNLOCK_INODE_MUTEX(inode);
                 }
         } else if (body->valid & OBD_MD_FLXATTRRM) {
                 if (inode->i_op && inode->i_op->removexattr) {
                         LOCK_INODE_MUTEX(inode);
-                        lock_24kernel();
                         rc = inode->i_op->removexattr(de, xattr_name);
-                        unlock_24kernel();
                         UNLOCK_INODE_MUTEX(inode);
                 }
         } else {
diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c
index 7da83383bf..fc788c5607 100644
--- a/lustre/mgc/mgc_request.c
+++ b/lustre/mgc/mgc_request.c
@@ -682,14 +682,10 @@ static int mgc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
         int rc;
         ENTRY;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        MOD_INC_USE_COUNT;
-#else
         if (!try_module_get(THIS_MODULE)) {
                 CERROR("Can't get module. Is it alive?");
                 return -EINVAL;
         }
-#endif
         switch (cmd) {
         /* REPLicator context */
         case OBD_IOC_PARSE: {
@@ -723,11 +719,7 @@ static int mgc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 GOTO(out, rc = -ENOTTY);
         }
 out:
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        MOD_DEC_USE_COUNT;
-#else
         module_put(THIS_MODULE);
-#endif
 
         return rc;
 }
diff --git a/lustre/mgs/lproc_mgs.c b/lustre/mgs/lproc_mgs.c
index cee1ce4764..f14320e57a 100644
--- a/lustre/mgs/lproc_mgs.c
+++ b/lustre/mgs/lproc_mgs.c
@@ -36,9 +36,7 @@
 #define DEBUG_SUBSYSTEM S_CLASS
 
 #include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #include <asm/statfs.h>
-#endif
 #include <obd.h>
 #include <obd_class.h>
 #include <lprocfs_status.h>
diff --git a/lustre/mgs/mgs_fs.c b/lustre/mgs/mgs_fs.c
index 2f07b7001d..95a14b4558 100644
--- a/lustre/mgs/mgs_fs.c
+++ b/lustre/mgs/mgs_fs.c
@@ -49,9 +49,7 @@
 #include <linux/kmod.h>
 #include <linux/version.h>
 #include <linux/sched.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #include <linux/mount.h>
-#endif
 #include <obd_class.h>
 #include <obd_support.h>
 #include <lustre_disk.h>
diff --git a/lustre/obdclass/linux/linux-sysctl.c b/lustre/obdclass/linux/linux-sysctl.c
index ac8b041d1e..b9eac5e2d1 100644
--- a/lustre/obdclass/linux/linux-sysctl.c
+++ b/lustre/obdclass/linux/linux-sysctl.c
@@ -41,9 +41,6 @@
 #include <linux/mm.h>
 #include <linux/sysctl.h>
 #include <linux/version.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/swapctl.h>
-#endif
 #include <linux/proc_fs.h>
 #include <linux/slab.h>
 #include <linux/stat.h>
diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c
index e2ff2b287e..655bc1021e 100644
--- a/lustre/obdclass/obd_mount.c
+++ b/lustre/obdclass/obd_mount.c
@@ -2008,7 +2008,6 @@ void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb))
 
 /***************** FS registration ******************/
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 /* 2.5 and later */
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
 struct super_block * lustre_get_sb(struct file_system_type *fs_type,
@@ -2050,28 +2049,6 @@ struct file_system_type lustre_fs_type = {
                         LL_RENAME_DOES_D_MOVE,
 };
 
-#else
-/* 2.4 */
-static struct super_block *lustre_read_super(struct super_block *sb,
-                                             void *data, int silent)
-{
-        int rc;
-        ENTRY;
-
-        rc = lustre_fill_super(sb, data, silent);
-        if (rc)
-                RETURN(NULL);
-        RETURN(sb);
-}
-
-static struct file_system_type lustre_fs_type = {
-        .owner          = THIS_MODULE,
-        .name           = "lustre",
-        .fs_flags       = FS_NFSEXP_FSID,
-        .read_super     = lustre_read_super,
-};
-#endif
-
 int lustre_register_fs(void)
 {
         return register_filesystem(&lustre_fs_type);
diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c
index c2fccef5a7..e8e6351ec5 100644
--- a/lustre/obdfilter/filter.c
+++ b/lustre/obdfilter/filter.c
@@ -59,10 +59,8 @@
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/sched.h>
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-# include <linux/mount.h>
-# include <linux/buffer_head.h>
-#endif
+#include <linux/mount.h>
+#include <linux/buffer_head.h>
 
 #include <obd_class.h>
 #include <obd_lov.h>
@@ -1366,12 +1364,9 @@ int filter_vfs_unlink(struct inode *dir, struct dentry *dentry,
          *       here) or some other ordering issue. */
         DQUOT_INIT(dir);
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
         rc = ll_security_inode_unlink(dir, dentry, mnt);
         if (rc)
                 GOTO(out, rc);
-#endif
-
         rc = dir->i_op->unlink(dir, dentry);
 out:
         /* need to drop i_mutex before we lose inode reference */
@@ -3675,9 +3670,8 @@ int filter_iocontrol(unsigned int cmd, struct obd_export *exp,
                 void *handle;
                 struct super_block *sb = obd->u.obt.obt_sb;
                 struct inode *inode = sb->s_root->d_inode;
-                BDEVNAME_DECLARE_STORAGE(tmp);
                 LCONSOLE_WARN("*** setting obd %s device '%s' read-only ***\n",
-                              obd->obd_name, ll_bdevname(sb, tmp));
+                              obd->obd_name, sb->s_id);
 
                 handle = fsfilt_start(obd, inode, FSFILT_OP_MKNOD, NULL);
                 if (!IS_ERR(handle))
diff --git a/lustre/obdfilter/lproc_obdfilter.c b/lustre/obdfilter/lproc_obdfilter.c
index de5ded8780..f09354f542 100644
--- a/lustre/obdfilter/lproc_obdfilter.c
+++ b/lustre/obdfilter/lproc_obdfilter.c
@@ -358,7 +358,6 @@ static void brw_stats_show(struct seq_file *seq, struct brw_stats *brw_stats)
                           &brw_stats->hist[BRW_R_DIO_FRAGS],
                           &brw_stats->hist[BRW_W_DIO_FRAGS], 0);
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
         display_brw_stats(seq, "disk I/Os in flight", "ios",
                           &brw_stats->hist[BRW_R_RPC_HIST],
                           &brw_stats->hist[BRW_W_RPC_HIST], 0);
@@ -374,7 +373,6 @@ static void brw_stats_show(struct seq_file *seq, struct brw_stats *brw_stats)
         display_brw_stats(seq, "disk I/O size", "ios",
                           &brw_stats->hist[BRW_R_DISK_IOSIZE],
                           &brw_stats->hist[BRW_W_DISK_IOSIZE], 1);
-#endif
 }
 
 #undef pct
diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c
index 182caa98ed..15c6860a14 100644
--- a/lustre/osc/lproc_osc.c
+++ b/lustre/osc/lproc_osc.c
@@ -36,9 +36,7 @@
 #define DEBUG_SUBSYSTEM S_CLASS
 
 #include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #include <asm/statfs.h>
-#endif
 #include <obd_class.h>
 #include <lprocfs_status.h>
 #include <linux/seq_file.h>
diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c
index 0af900753d..070c95e2c2 100644
--- a/lustre/osc/osc_request.c
+++ b/lustre/osc/osc_request.c
@@ -3351,14 +3351,10 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
         int err = 0;
         ENTRY;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        MOD_INC_USE_COUNT;
-#else
         if (!try_module_get(THIS_MODULE)) {
                 CERROR("Can't get module. Is it alive?");
                 return -EINVAL;
         }
-#endif
         switch (cmd) {
         case OBD_IOC_LOV_GET_CONFIG: {
                 char *buf;
@@ -3442,11 +3438,7 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 GOTO(out, err = -ENOTTY);
         }
 out:
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        MOD_DEC_USE_COUNT;
-#else
         module_put(THIS_MODULE);
-#endif
         return err;
 }
 
diff --git a/lustre/quota/quota_adjust_qunit.c b/lustre/quota/quota_adjust_qunit.c
index 2cf06390e0..952eee5cd8 100644
--- a/lustre/quota/quota_adjust_qunit.c
+++ b/lustre/quota/quota_adjust_qunit.c
@@ -45,14 +45,10 @@
 # include <linux/fs.h>
 # include <linux/jbd.h>
 # include <linux/quota.h>
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #  include <linux/smp_lock.h>
 #  include <linux/buffer_head.h>
 #  include <linux/workqueue.h>
 #  include <linux/mount.h>
-# else
-#  include <linux/locks.h>
-# endif
 #else /* __KERNEL__ */
 # include <liblustre.h>
 #endif
diff --git a/lustre/quota/quota_check.c b/lustre/quota/quota_check.c
index edc70f331e..df5bc1e21e 100644
--- a/lustre/quota/quota_check.c
+++ b/lustre/quota/quota_check.c
@@ -44,14 +44,10 @@
 # include <linux/version.h>
 # include <linux/module.h>
 # include <linux/init.h>
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #  include <linux/smp_lock.h>
 #  include <linux/buffer_head.h>
 #  include <linux/workqueue.h>
 #  include <linux/mount.h>
-# else
-#  include <linux/locks.h>
-# endif
 #else /* __KERNEL__ */
 # include <liblustre.h>
 #endif
diff --git a/lustre/quota/quota_ctl.c b/lustre/quota/quota_ctl.c
index 154a39fe64..ebdb535377 100644
--- a/lustre/quota/quota_ctl.c
+++ b/lustre/quota/quota_ctl.c
@@ -45,14 +45,10 @@
 # include <linux/fs.h>
 # include <linux/jbd.h>
 # include <linux/quota.h>
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #  include <linux/smp_lock.h>
 #  include <linux/buffer_head.h>
 #  include <linux/workqueue.h>
 #  include <linux/mount.h>
-# else
-#  include <linux/locks.h>
-# endif
 #else /* __KERNEL__ */
 # include <liblustre.h>
 #endif
diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c
index bb7f297c80..4ede64da0b 100644
--- a/lustre/quota/quota_interface.c
+++ b/lustre/quota/quota_interface.c
@@ -45,14 +45,10 @@
 # include <linux/init.h>
 # include <linux/fs.h>
 # include <linux/jbd.h>
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #  include <linux/smp_lock.h>
 #  include <linux/buffer_head.h>
 #  include <linux/workqueue.h>
 #  include <linux/mount.h>
-# else
-#  include <linux/locks.h>
-# endif
 #else /* __KERNEL__ */
 # include <liblustre.h>
 #endif
-- 
GitLab