- 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>
# 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__ */
#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;
};
#endif
-#endif
# 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;
# 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 {
# 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>
#ifdef __KERNEL__
# include <libcfs/libcfs.h>
-# ifndef HAVE_VFS_INTENT_PATCHES
# include <linux/lustre_intent.h>
-# endif
#else
# include <liblustre.h>
#endif
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));
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;
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 */
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,
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;
RETURN(rc);
}
-#endif
void ll_d_iput(struct dentry *de, struct inode *inode)
{
.d_delete = ll_ddelete,
.d_iput = ll_d_iput,
.d_compare = ll_dcompare,
-#if 0
- .d_pin = ll_pin,
- .d_unpin = ll_unpin,
-#endif
};
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)
};
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,
#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;
};
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);
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)
{
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,
RETURN(err);
}
-#ifndef HAVE_VFS_INTENT_PATCHES
static int ll_create_nd(struct inode *dir, struct dentry *dentry,
int mode, struct nameidata *nd)
{
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)
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)
{
}
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,
};
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,
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.
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,
#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
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,