From ecb48afd7aeedcb8a86d8f161a5135b0531ce255 Mon Sep 17 00:00:00 2001
From: yangsheng <yangsheng>
Date: Tue, 16 Oct 2007 10:03:11 +0000
Subject: [PATCH] Branch HEAD b=13568 i=adilger i=ericm

Remove 2.4 kernel check from mds subsystem.
---
 lustre/ChangeLog          |  3 +++
 lustre/mds/handler.c      | 16 ++++------------
 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_open.c     |  8 ++------
 lustre/mds/mds_reint.c    |  2 --
 lustre/mds/mds_xattr.c    |  8 --------
 9 files changed, 10 insertions(+), 41 deletions(-)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 7bcffb152f..9764ee8531 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -436,6 +436,9 @@ Description: Remove 2.4 kernel checks lustre 1.8
 Details    : Remove 2.5.0 check from dcache.c dir.c file.c llite_internal.h
              llite_lib.c llite_mmap.c lproc_llite.c namei.c rw.c symlink.c
              llite subsystem.
+	     Remove 2.5.0 check from handler.c lproc_mds.c mds_fs.c
+	     mds_internal.h mds_lib.c mds_open.c mds_reint.c mds_xattr.c
+	     in mds subsystem.
 
 --------------------------------------------------------------------------------
 
diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c
index 9ab8f63629..1472f48c39 100644
--- a/lustre/mds/handler.c
+++ b/lustre/mds/handler.c
@@ -40,14 +40,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 <linux/smp_lock.h>
+#include <linux/buffer_head.h>
+#include <linux/workqueue.h>
+#include <linux/mount.h>
 
 #include <linux/lustre_acl.h>
 #include <obd_class.h>
@@ -635,11 +631,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;
@@ -814,10 +808,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) {
diff --git a/lustre/mds/lproc_mds.c b/lustre/mds/lproc_mds.c
index 05ae7190c1..f8c7f83453 100644
--- a/lustre/mds/lproc_mds.c
+++ b/lustre/mds/lproc_mds.c
@@ -25,9 +25,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 1ef9533c99..f4083dd78a 100644
--- a/lustre/mds/mds_fs.c
+++ b/lustre/mds/mds_fs.c
@@ -36,9 +36,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 35e312d051..cdcc0f0ad0 100644
--- a/lustre/mds/mds_internal.h
+++ b/lustre/mds/mds_internal.h
@@ -43,11 +43,7 @@ static inline struct mds_obd *mds_req2mds(struct ptlrpc_request *req)
 
 #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 83203dedac..b423941e59 100644
--- a/lustre/mds/mds_lib.c
+++ b/lustre/mds/mds_lib.c
@@ -34,11 +34,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_open.c b/lustre/mds/mds_open.c
index 51368837e5..041fdc5263 100644
--- a/lustre/mds/mds_open.c
+++ b/lustre/mds/mds_open.c
@@ -35,12 +35,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 6e2688bda8..c5480619eb 100644
--- a/lustre/mds/mds_reint.c
+++ b/lustre/mds/mds_reint.c
@@ -2244,12 +2244,10 @@ no_unlink:
         OBD_FAIL_WRITE(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 52e9a5f245..ce3199d55d 100644
--- a/lustre/mds/mds_xattr.c
+++ b/lustre/mds/mds_xattr.c
@@ -132,10 +132,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 &&
@@ -145,9 +143,7 @@ static int mds_getxattr_internal(struct obd_device *obd,
                 DEBUG_REQ(D_INODE, req, "listxattr");
 
                 if (inode->i_op && inode->i_op->listxattr) {
-                        lock_24kernel();
                         rc = inode->i_op->listxattr(dentry, buf, buflen);
-                        unlock_24kernel();
                 }
                 if (rc < 0)
                         CDEBUG(D_OTHER, "listxattr failed: %d\n", rc);
@@ -289,18 +285,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 {
-- 
GitLab