Whamcloud - gitweb
LU-155 cleanup some dead code
authorJohann Lombardi <johann@whamcloud.com>
Thu, 24 Mar 2011 17:01:04 +0000 (18:01 +0100)
committerOleg Drokin <green@whamcloud.com>
Wed, 30 Mar 2011 16:42:45 +0000 (09:42 -0700)
- 2.x does not support any kernels with vfs intents, so we can drop the related lustre code
 (as a side note, HAVE_VFS_INTENT_PATCHES seems to be gone already)
- remove ll_pin/unpin since it won't be used any more
- add a comment to ll_ddelete()

Change-Id: I3ed16d84c8618071ea66d9c2cc9d2810b23f1830
Signed-off-by: Johann Lombardi <johann@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/359
Tested-by: Hudson
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Mikhail Pershin <tappro@whamcloud.com>
13 files changed:
lustre/include/linux/lustre_acl.h
lustre/include/linux/lustre_intent.h
lustre/include/linux/lustre_mds.h
lustre/include/linux/obd.h
lustre/include/lustre_mdc.h
lustre/ldlm/ldlm_lock.c
lustre/llite/dcache.c
lustre/llite/file.c
lustre/llite/llite_internal.h
lustre/llite/namei.c
lustre/llite/symlink.c
lustre/lmv/lmv_intent.c
lustre/obdclass/linux/linux-module.c

index 17ff033..e47f811 100644 (file)
@@ -57,9 +57,7 @@
 #   include <linux/posix_acl_xattr.h>
 #  endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */
 # endif /* CONFIG_FS_POSIX_ACL */
-# ifndef HAVE_VFS_INTENT_PATCHES
-#  include <linux/lustre_intent.h>
-# endif
+#include <linux/lustre_intent.h>
 /* XATTR_{REPLACE,CREATE} */
 #include <linux/xattr.h>
 #endif /* __KERNEL__ */
index 9bf28d4..39b5a99 100644 (file)
@@ -39,8 +39,6 @@
 
 #include <linux/lustre_version.h>
 
-#ifndef HAVE_VFS_INTENT_PATCHES
-
 /* intent IT_XXX are defined in lustre/include/obd.h */
 struct lustre_intent_data {
         int       it_disposition;
@@ -60,4 +58,3 @@ struct lookup_intent {
 };
 
 #endif
-#endif
index c843fe2..100c742 100644 (file)
@@ -57,9 +57,7 @@
 #   include <linux/posix_acl_xattr.h>
 #  endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */
 # endif /* CONFIG_FS_POSIX_ACL */
-# ifndef HAVE_VFS_INTENT_PATCHES
-#  include <linux/lustre_intent.h>
-# endif
+# include <linux/lustre_intent.h>
 #endif /* __KERNEL__ */
 
 struct mds_obd;
index db37ca7..965de0d 100644 (file)
@@ -51,9 +51,7 @@
 # include <linux/smp_lock.h>
 # include <linux/proc_fs.h>
 # include <linux/mount.h>
-# ifndef HAVE_VFS_INTENT_PATCHES
-#  include <linux/lustre_intent.h>
-# endif
+# include <linux/lustre_intent.h>
 #endif
 
 typedef struct {
index f095a71..e8883b4 100644 (file)
@@ -58,9 +58,7 @@
 #   include <linux/posix_acl_xattr.h>
 #  endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */
 # endif /* CONFIG_FS_POSIX_ACL */
-# ifndef HAVE_VFS_INTENT_PATCHES
-# include <linux/lustre_intent.h>
-# endif /* HAVE_VFS_INTENT_PATCHES */
+#include <linux/lustre_intent.h>
 #endif /* __KERNEL__ */
 #include <lustre_handles.h>
 #include <libcfs/libcfs.h>
index c9f4536..574b1ad 100644 (file)
@@ -43,9 +43,7 @@
 
 #ifdef __KERNEL__
 # include <libcfs/libcfs.h>
-# ifndef HAVE_VFS_INTENT_PATCHES
 # include <linux/lustre_intent.h>
-# endif
 #else
 # include <liblustre.h>
 #endif
index b4758e0..8ab16d7 100644 (file)
@@ -64,12 +64,10 @@ static void ll_release(struct dentry *de)
                 EXIT;
                 return;
         }
-#ifndef HAVE_VFS_INTENT_PATCHES
         if (lld->lld_it) {
                 ll_intent_release(lld->lld_it);
                 OBD_FREE(lld->lld_it, sizeof(*lld->lld_it));
         }
-#endif
         LASSERT(lld->lld_cwd_count == 0);
         LASSERT(lld->lld_mnt_count == 0);
         OBD_FREE(de->d_fsdata, sizeof(*lld));
@@ -144,7 +142,13 @@ static int find_cbdata(struct inode *inode)
         RETURN(rc);
 }
 
-/* should NOT be called with the dcache lock, see fs/dcache.c */
+/**
+ * Called when last reference to a dentry is dropped and dcache wants to know
+ * whether or not it should cache it:
+ * - return 1 to delete the dentry immediately
+ * - return 0 to cache the dentry
+ * Should NOT be called with the dcache lock, see fs/dcache.c
+ */
 static int ll_ddelete(struct dentry *de)
 {
         ENTRY;
@@ -238,10 +242,6 @@ void ll_intent_release(struct lookup_intent *it)
 
         CDEBUG(D_INFO, "intent %p released\n", it);
         ll_intent_drop_lock(it);
-#ifdef HAVE_VFS_INTENT_PATCHES
-        it->it_magic = 0;
-        it->it_op_release = 0;
-#endif
         /* We are still holding extra reference on a request, need to free it */
         if (it_disposition(it, DISP_ENQ_OPEN_REF))
                  ptlrpc_req_finished(it->d.lustre.it_data); /* ll_file_open */
@@ -387,20 +387,10 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry)
 void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft)
 {
         struct lookup_intent *it = *itp;
-#ifdef HAVE_VFS_INTENT_PATCHES
-        if (it) {
-                LASSERTF(it->it_magic == INTENT_MAGIC,
-                         "%p has bad intent magic: %x\n",
-                         it, it->it_magic);
-        }
-#endif
 
         if (!it || it->it_op == IT_GETXATTR)
                 it = *itp = deft;
 
-#ifdef HAVE_VFS_INTENT_PATCHES
-        it->it_op_release = ll_intent_release;
-#endif
 }
 
 int ll_revalidate_it(struct dentry *de, int lookup_flags,
@@ -665,107 +655,6 @@ out_sa:
         return rc;
 }
 
-#if 0
-static void ll_pin(struct dentry *de, struct vfsmount *mnt, int flag)
-{
-        struct inode *inode= de->d_inode;
-        struct ll_sb_info *sbi = ll_i2sbi(inode);
-        struct ll_dentry_data *ldd = ll_d2d(de);
-        struct obd_client_handle *handle;
-        struct obd_capa *oc;
-        int rc = 0;
-        ENTRY;
-        LASSERT(ldd);
-
-        cfs_lock_kernel();
-        /* Strictly speaking this introduces an additional race: the
-         * increments should wait until the rpc has returned.
-         * However, given that at present the function is void, this
-         * issue is moot. */
-        if (flag == 1 && (++ldd->lld_mnt_count) > 1) {
-                cfs_unlock_kernel();
-                EXIT;
-                return;
-        }
-
-        if (flag == 0 && (++ldd->lld_cwd_count) > 1) {
-                cfs_unlock_kernel();
-                EXIT;
-                return;
-        }
-        cfs_unlock_kernel();
-
-        handle = (flag) ? &ldd->lld_mnt_och : &ldd->lld_cwd_och;
-        oc = ll_mdscapa_get(inode);
-        rc = obd_pin(sbi->ll_md_exp, ll_inode2fid(inode), oc, handle, flag);
-        capa_put(oc);
-        if (rc) {
-                cfs_lock_kernel();
-                memset(handle, 0, sizeof(*handle));
-                if (flag == 0)
-                        ldd->lld_cwd_count--;
-                else
-                        ldd->lld_mnt_count--;
-                cfs_unlock_kernel();
-        }
-
-        EXIT;
-        return;
-}
-
-static void ll_unpin(struct dentry *de, struct vfsmount *mnt, int flag)
-{
-        struct ll_sb_info *sbi = ll_i2sbi(de->d_inode);
-        struct ll_dentry_data *ldd = ll_d2d(de);
-        struct obd_client_handle handle;
-        int count, rc = 0;
-        ENTRY;
-        LASSERT(ldd);
-
-        cfs_lock_kernel();
-        /* Strictly speaking this introduces an additional race: the
-         * increments should wait until the rpc has returned.
-         * However, given that at present the function is void, this
-         * issue is moot. */
-        handle = (flag) ? ldd->lld_mnt_och : ldd->lld_cwd_och;
-        if (handle.och_magic != OBD_CLIENT_HANDLE_MAGIC) {
-                /* the "pin" failed */
-                cfs_unlock_kernel();
-                EXIT;
-                return;
-        }
-
-        if (flag)
-                count = --ldd->lld_mnt_count;
-        else
-                count = --ldd->lld_cwd_count;
-        cfs_unlock_kernel();
-
-        if (count != 0) {
-                EXIT;
-                return;
-        }
-
-        rc = obd_unpin(sbi->ll_md_exp, &handle, flag);
-        EXIT;
-        return;
-}
-#endif
-
-#ifdef HAVE_VFS_INTENT_PATCHES
-int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
-{
-        int rc;
-        ENTRY;
-
-        if (nd && nd->flags & LOOKUP_LAST && !(nd->flags & LOOKUP_LINK_NOTLAST))
-                rc = ll_revalidate_it(dentry, nd->flags, &nd->intent);
-        else
-                rc = ll_revalidate_it(dentry, 0, NULL);
-
-        RETURN(rc);
-}
-#else
 int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
 {
         int rc;
@@ -840,7 +729,6 @@ out_it:
 
         RETURN(rc);
 }
-#endif
 
 void ll_d_iput(struct dentry *de, struct inode *inode)
 {
@@ -856,8 +744,4 @@ struct dentry_operations ll_d_ops = {
         .d_delete  = ll_ddelete,
         .d_iput    = ll_d_iput,
         .d_compare = ll_dcompare,
-#if 0
-        .d_pin = ll_pin,
-        .d_unpin = ll_unpin,
-#endif
 };
index acb2272..fffa864 100644 (file)
@@ -502,12 +502,8 @@ int ll_file_open(struct inode *inode, struct file *file)
         CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), flags %o\n", inode->i_ino,
                inode->i_generation, inode, file->f_flags);
 
-#ifdef HAVE_VFS_INTENT_PATCHES
-        it = file->f_it;
-#else
         it = file->private_data; /* XXX: compat macro */
         file->private_data = NULL; /* prevent ll_local_open assertion */
-#endif
 
         fd = ll_file_data_get();
         if (fd == NULL)
@@ -2576,9 +2572,6 @@ struct file_operations ll_file_operations_noflock = {
 };
 
 struct inode_operations ll_file_inode_operations = {
-#ifdef HAVE_VFS_INTENT_PATCHES
-        .setattr_raw    = ll_setattr_raw,
-#endif
         .setattr        = ll_setattr,
         .truncate       = ll_truncate,
         .getattr        = ll_getattr,
index 783d8c4..a9584ab 100644 (file)
 #define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
 #define LUSTRE_FPRIVATE(file) ((file)->private_data)
 
-#ifdef HAVE_VFS_INTENT_PATCHES
-static inline struct lookup_intent *ll_nd2it(struct nameidata *nd)
-{
-        return &nd->intent;
-}
-#endif
-
 struct ll_dentry_data {
         int                      lld_cwd_count;
         int                      lld_mnt_count;
         struct obd_client_handle lld_cwd_och;
         struct obd_client_handle lld_mnt_och;
-#ifndef HAVE_VFS_INTENT_PATCHES
         struct lookup_intent    *lld_it;
-#endif
         unsigned int             lld_sa_generation;
 };
 
@@ -599,10 +590,8 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash,
                       struct lustre_md *lic);
 int ll_md_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *,
                        void *data, int flag);
-#ifndef HAVE_VFS_INTENT_PATCHES
 struct lookup_intent *ll_convert_intent(struct open_intent *oit,
                                         int lookup_flags);
-#endif
 int ll_lookup_it_finish(struct ptlrpc_request *request,
                         struct lookup_intent *it, void *data);
 
index b993c0b..4a2fc96 100644 (file)
@@ -596,21 +596,6 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
         return retval;
 }
 
-#ifdef HAVE_VFS_INTENT_PATCHES
-static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
-                                   struct nameidata *nd)
-{
-        struct dentry *de;
-        ENTRY;
-
-        if (nd && nd->flags & LOOKUP_LAST && !(nd->flags & LOOKUP_LINK_NOTLAST))
-                de = ll_lookup_it(parent, dentry, &nd->intent, nd->flags);
-        else
-                de = ll_lookup_it(parent, dentry, NULL, 0);
-
-        RETURN(de);
-}
-#else
 struct lookup_intent *ll_convert_intent(struct open_intent *oit,
                                         int lookup_flags)
 {
@@ -732,7 +717,6 @@ static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
 
         RETURN(de);
 }
-#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,
@@ -909,7 +893,6 @@ static int ll_mknod_generic(struct inode *dir, struct qstr *name, int mode,
         RETURN(err);
 }
 
-#ifndef HAVE_VFS_INTENT_PATCHES
 static int ll_create_nd(struct inode *dir, struct dentry *dentry,
                         int mode, struct nameidata *nd)
 {
@@ -943,17 +926,6 @@ out:
 
         return rc;
 }
-#else
-static int ll_create_nd(struct inode *dir, struct dentry *dentry,
-                        int mode, struct nameidata *nd)
-{
-        if (!nd || !nd->intent.d.lustre.it_disposition)
-                /* No saved request? Just mknod the file */
-                return ll_mknod_generic(dir, &dentry->d_name, mode, 0, dentry);
-
-        return ll_create_it(dir, dentry, mode, &nd->intent);
-}
-#endif
 
 static int ll_symlink_generic(struct inode *dir, struct qstr *name,
                               const char *tgt, struct dentry *dchild)
@@ -1220,43 +1192,6 @@ static int ll_rename_generic(struct inode *src, struct dentry *src_dparent,
         RETURN(err);
 }
 
-#ifdef HAVE_VFS_INTENT_PATCHES
-static int ll_mknod_raw(struct nameidata *nd, int mode, dev_t rdev)
-{
-        return ll_mknod_generic(nd->dentry->d_inode, &nd->last, mode,rdev,NULL);
-}
-static int ll_rename_raw(struct nameidata *srcnd, struct nameidata *tgtnd)
-{
-        return ll_rename_generic(srcnd->dentry->d_inode, srcnd->dentry,
-                                 NULL, &srcnd->last,
-                                 tgtnd->dentry->d_inode, tgtnd->dentry,
-                                 NULL, &tgtnd->last);
-}
-static int ll_link_raw(struct nameidata *srcnd, struct nameidata *tgtnd)
-{
-        return ll_link_generic(srcnd->dentry->d_inode, tgtnd->dentry->d_inode,
-                               &tgtnd->last, NULL);
-}
-static int ll_symlink_raw(struct nameidata *nd, const char *tgt)
-{
-        return ll_symlink_generic(nd->dentry->d_inode, &nd->last, tgt, NULL);
-}
-static int ll_rmdir_raw(struct nameidata *nd)
-{
-        return ll_rmdir_generic(nd->dentry->d_inode, nd->dentry, NULL,
-                                &nd->last);
-}
-static int ll_mkdir_raw(struct nameidata *nd, int mode)
-{
-        return ll_mkdir_generic(nd->dentry->d_inode, &nd->last, mode, NULL);
-}
-static int ll_unlink_raw(struct nameidata *nd)
-{
-        return ll_unlink_generic(nd->dentry->d_inode, nd->dentry, NULL,
-                                 &nd->last);
-}
-#endif
-
 static int ll_mknod(struct inode *dir, struct dentry *dchild, int mode,
                     ll_dev_t rdev)
 {
@@ -1305,17 +1240,6 @@ static int ll_rename(struct inode *old_dir, struct dentry *old_dentry,
 }
 
 struct inode_operations ll_dir_inode_operations = {
-#ifdef HAVE_VFS_INTENT_PATCHES
-        .link_raw           = ll_link_raw,
-        .unlink_raw         = ll_unlink_raw,
-        .symlink_raw        = ll_symlink_raw,
-        .mkdir_raw          = ll_mkdir_raw,
-        .rmdir_raw          = ll_rmdir_raw,
-        .mknod_raw          = ll_mknod_raw,
-        .rename_raw         = ll_rename_raw,
-        .setattr            = ll_setattr,
-        .setattr_raw        = ll_setattr_raw,
-#endif
         .mknod              = ll_mknod,
         .lookup             = ll_lookup_nd,
         .create             = ll_create_nd,
@@ -1336,9 +1260,6 @@ struct inode_operations ll_dir_inode_operations = {
 };
 
 struct inode_operations ll_special_inode_operations = {
-#ifdef HAVE_VFS_INTENT_PATCHES
-        .setattr_raw    = ll_setattr_raw,
-#endif
         .setattr        = ll_setattr,
         .getattr        = ll_getattr,
         .permission     = ll_inode_permission,
index b63b0d0..af46369 100644 (file)
@@ -140,25 +140,11 @@ static LL_FOLLOW_LINK_RETURN_TYPE ll_follow_link(struct dentry *dentry,
                                                  struct nameidata *nd)
 {
         struct inode *inode = dentry->d_inode;
-#ifdef HAVE_VFS_INTENT_PATCHES
-        struct lookup_intent *it = ll_nd2it(nd);
-#endif
         struct ptlrpc_request *request = NULL;
         int rc;
         char *symname;
         ENTRY;
 
-#ifdef HAVE_VFS_INTENT_PATCHES
-        if (it != NULL) {
-                int op = it->it_op;
-                int mode = it->it_create_mode;
-
-                ll_intent_release(it);
-                it->it_op = op;
-                it->it_create_mode = mode;
-        }
-#endif
-
         CDEBUG(D_VFSTRACE, "VFS Op\n");
         /* Limit the recursive symlink depth to 5 instead of default
          * 8 links when kernel has 4k stack to prevent stack overflow.
@@ -212,9 +198,6 @@ static void ll_put_link(struct dentry *dentry, struct nameidata *nd, void *cooki
 struct inode_operations ll_fast_symlink_inode_operations = {
         .readlink       = ll_readlink,
         .setattr        = ll_setattr,
-#ifdef HAVE_VFS_INTENT_PATCHES
-        .setattr_raw    = ll_setattr_raw,
-#endif
         .follow_link    = ll_follow_link,
 #ifdef HAVE_COOKIE_FOLLOW_LINK
         .put_link       = ll_put_link,
index 5098eae..cd190fb 100644 (file)
@@ -47,9 +47,7 @@
 #include <asm/div64.h>
 #include <linux/seq_file.h>
 #include <linux/namei.h>
-# ifndef HAVE_VFS_INTENT_PATCHES
-# include <linux/lustre_intent.h>
-# endif
+#include <linux/lustre_intent.h>
 #else
 #include <liblustre.h>
 #endif
index 335ce71..d893f16 100644 (file)
@@ -248,15 +248,9 @@ int obd_proc_read_version(char *page, char **start, off_t off, int count,
                           int *eof, void *data)
 {
         *eof = 1;
-#ifdef HAVE_VFS_INTENT_PATCHES
-        return snprintf(page, count, "lustre: %s\nkernel: %u\nbuild:  %s\n",
-                        LUSTRE_VERSION_STRING, LUSTRE_KERNEL_VERSION,
-                        BUILD_VERSION);
-#else
         return snprintf(page, count, "lustre: %s\nkernel: %s\nbuild:  %s\n",
                         LUSTRE_VERSION_STRING, "patchless_client",
                         BUILD_VERSION);
-#endif
 }
 
 int obd_proc_read_pinger(char *page, char **start, off_t off, int count,