From: Johann Lombardi Date: Thu, 24 Mar 2011 17:01:04 +0000 (+0100) Subject: LU-155 cleanup some dead code X-Git-Tag: 2.0.59-llnl3-base~3 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=8f0121ed09cf02dc12933bb3e880194b7ef0990e LU-155 cleanup some dead code - 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 Reviewed-on: http://review.whamcloud.com/359 Tested-by: Hudson Reviewed-by: Oleg Drokin Reviewed-by: Mikhail Pershin --- diff --git a/lustre/include/linux/lustre_acl.h b/lustre/include/linux/lustre_acl.h index 17ff033..e47f811 100644 --- a/lustre/include/linux/lustre_acl.h +++ b/lustre/include/linux/lustre_acl.h @@ -57,9 +57,7 @@ # include # endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */ # endif /* CONFIG_FS_POSIX_ACL */ -# ifndef HAVE_VFS_INTENT_PATCHES -# include -# endif +#include /* XATTR_{REPLACE,CREATE} */ #include #endif /* __KERNEL__ */ diff --git a/lustre/include/linux/lustre_intent.h b/lustre/include/linux/lustre_intent.h index 9bf28d4..39b5a99 100644 --- a/lustre/include/linux/lustre_intent.h +++ b/lustre/include/linux/lustre_intent.h @@ -39,8 +39,6 @@ #include -#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 diff --git a/lustre/include/linux/lustre_mds.h b/lustre/include/linux/lustre_mds.h index c843fe2..100c742 100644 --- a/lustre/include/linux/lustre_mds.h +++ b/lustre/include/linux/lustre_mds.h @@ -57,9 +57,7 @@ # include # endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */ # endif /* CONFIG_FS_POSIX_ACL */ -# ifndef HAVE_VFS_INTENT_PATCHES -# include -# endif +# include #endif /* __KERNEL__ */ struct mds_obd; diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index db37ca7..965de0d 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -51,9 +51,7 @@ # include # include # include -# ifndef HAVE_VFS_INTENT_PATCHES -# include -# endif +# include #endif typedef struct { diff --git a/lustre/include/lustre_mdc.h b/lustre/include/lustre_mdc.h index f095a71..e8883b4 100644 --- a/lustre/include/lustre_mdc.h +++ b/lustre/include/lustre_mdc.h @@ -58,9 +58,7 @@ # include # endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */ # endif /* CONFIG_FS_POSIX_ACL */ -# ifndef HAVE_VFS_INTENT_PATCHES -# include -# endif /* HAVE_VFS_INTENT_PATCHES */ +#include #endif /* __KERNEL__ */ #include #include diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index c9f4536..574b1ad 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -43,9 +43,7 @@ #ifdef __KERNEL__ # include -# ifndef HAVE_VFS_INTENT_PATCHES # include -# endif #else # include #endif diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index b4758e0..8ab16d7 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -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 }; diff --git a/lustre/llite/file.c b/lustre/llite/file.c index acb2272..fffa864 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -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, diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 783d8c4..a9584ab 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -59,21 +59,12 @@ #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); diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index b993c0b..4a2fc96 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -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, diff --git a/lustre/llite/symlink.c b/lustre/llite/symlink.c index b63b0d0..af46369 100644 --- a/lustre/llite/symlink.c +++ b/lustre/llite/symlink.c @@ -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, diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 5098eae..cd190fb 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -47,9 +47,7 @@ #include #include #include -# ifndef HAVE_VFS_INTENT_PATCHES -# include -# endif +#include #else #include #endif diff --git a/lustre/obdclass/linux/linux-module.c b/lustre/obdclass/linux/linux-module.c index 335ce71..d893f16 100644 --- a/lustre/obdclass/linux/linux-module.c +++ b/lustre/obdclass/linux/linux-module.c @@ -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,