#include <libcfs/kp30.h>
#include <linux/lustre_ucache.h>
-#define lu_fid_NAMELEN (16 + 1 + 8 + 1)
+#define LU_FID_NAMELEN (16 + 1 + 8 + 1)
#if defined __KERNEL__
#include <linux/lustre_compat25.h>
struct list_head lld_list;
ino_t lld_ino;
unsigned long lld_off;
- char lld_name[LL_FID_NAMELEN];
+ char lld_name[LU_FID_NAMELEN];
};
struct l_readdir_callback {
struct l_linux_dirent *lrc_dirent;
struct md_device_operations;
struct md_object;
+/*the context of the mdd ops*/
+struct context {
+ const char *name;
+ int name_len;
+ __u32 mode;
+ int flags;
+};
+
struct md_device_operations {
- /* get root FID */
- int (*mdo_root_get)(struct md_device *m, struct ll_fid *f);
- /* metadata API */
- int (*mdo_mkdir)(struct md_object *o, const char *name,
+ int (*mdo_root_get)(struct md_device *m, struct lu_fid *f);
+ int (*mdo_mkdir)(struct md_object *obj, const char *name,
struct md_object *child);
+
+ int (*mdo_rename)(struct md_object *spobj, struct md_object *tpobj,
+ struct md_object *sobj, const char *sname,
+ struct md_object *tobj, const char *tname,
+ struct context *uctxt);
+ int (*mdo_link)(struct md_object *tobj, struct md_object *sobj,
+ const char *name, struct context *uctxt);
+ int (*mdo_attr_get)(struct md_object *obj, void *buf, int buf_len,
+ const char *name, struct context *uctxt);
+ int (*mdo_attr_set)(struct md_object *obj, void *buf, int buf_len,
+ const char *name, struct context *uctxt);
+ int (*mdo_index_insert)(struct md_object *pobj, struct md_object *obj,
+ const char *name, struct context *uctxt);
+ int (*mdo_index_delete)(struct md_object *pobj, struct md_object *obj,
+ const char *name, struct context *uctxt);
+ int (*mdo_object_create)(struct md_object *pobj, struct md_object *child,
+ struct context *uctxt);
};
struct md_device {
#include <linux/obd_support.h>
#include <linux/lu_object.h>
+#include <linux/md_object.h>
#include "mdd_internal.h"
}
static int
-mdd_object_create(struct md_object *pobj, struct mdd_object *child,
+mdd_object_create(struct md_object *pobj, struct md_object *child,
struct context *uctxt)
{
struct mdd_device *mdd = mdo2mdd(pobj);
struct mdd_object *mdd_pobj = mdo2mddo(pobj);
+ struct mdd_object *mdd_child = mdo2mddo(child);
void *handle = NULL;
int rc;
ENTRY;
if (!handle)
RETURN(-ENOMEM);
- rc = __mdd_object_create(mdd, mdd_pobj, child, uctxt, handle);
+ rc = __mdd_object_create(mdd, mdd_pobj, mdd_child, uctxt, handle);
mdd_trans_stop(mdd, handle);
}
-static struct ll_fid *mdd_object_getfid(struct mdd_object *obj)
+static struct lu_fid *mdd_object_getfid(struct mdd_object *obj)
{
return &(obj->mod_obj.mo_lu.lo_header->loh_fid);
}
mdd_lock(mdd, obj, WRITE_LOCK);
rc = mdd_child_ops(mdd)->osd_index_insert(mdd_object_child(pobj),
- mdd_object_getfid(obj), name,
+ mdd_object_getfid(obj), name,
uctxt, handle);
mdd_unlock(mdd, pobj, WRITE_LOCK);
mdd_unlock(mdd, obj, WRITE_LOCK);
}
static int
-mdd_index_insert(struct mdd_device *mdd, struct md_object *pobj,
- struct md_object *obj, const char *name,
+mdd_index_insert(struct md_object *pobj, struct md_object *obj, const char *name,
struct context *uctxt)
{
+ struct mdd_device *mdd = mdo2mdd(pobj);
int rc;
void *handle = NULL;
ENTRY;
mdd_lock(mdd, pobj, WRITE_LOCK);
mdd_lock(mdd, obj, WRITE_LOCK);
- rc = mdd_child_ops(mdd)->osd_insert_delete(mdd_object_child(pobj),
+ rc = mdd_child_ops(mdd)->osd_index_delete(mdd_object_child(pobj),
mdd_object_getfid(obj), name,
uctxt, handle);
mdd_unlock(mdd, pobj, WRITE_LOCK);
#define LUSTRE_MDD_NAME "mdd"
#define LUSTRE_OSD_NAME "osd"
-#define WRITE_LOCK 1
-/*the context of the mdd ops*/
-struct context {
- const char *name;
- int name_len;
- __u32 mode;
- int flags;
+enum {
+ WRITE_LOCK = 1,
+ READ_LOCK = 2,
};
-struct osd_device_operations {
- int (*osd_object_lock)(struct lu_object *lu, __u32 mode);
- int (*osd_object_unlock)(struct lu_object *lu, __u32 mode);
- void* (*osd_trans_start)(struct lu_object *lu);
- void (*osd_trans_stop)(struct lu_object *lu);
- int (*osd_object_create)(struct lu_object *plu, struct lu_object *child,
- struct context *context, void *handle);
- int (*osd_object_destroy)(struct lu_object *lu, void *handle);
- void (*osd_object_get)(struct lu_object *lu);
- int (*osd_attr_get)(struct lu_object *lu, void *buf, int buf_len,
- const char *name, struct context *context);
- int (*osd_attr_set)(struct lu_object *lu, void *buf, int buf_len,
- const char *name, struct context *context,
- void *handle);
- int (*osd_object_dec_check)(struct lu_object *lu);
- int (*osd_index_insert)(struct lu_object *lu, struct lu_fid *fid,
- const char *name, struct context *uctxt,
- void *handle);
- int (*osd_insert_delete)(struct lu_object *lu, struct lu_fid *fid,
- const char *name, struct context *uctxt,
- void *handle);
-};
-
-struct osd_device {
- struct lu_device osd_lu_dev;
- struct osd_device_operations *osd_ops;
-};
-
-
-struct md_device {
- struct lu_device md_lu_dev;
- struct md_device_operations *md_ops;
-};
struct mdd_device {
/* NB this field MUST be first */
mdd_fl_acl:1;
};
-struct md_object {
- struct lu_object mo_lu;
-};
-
struct mdd_object {
struct md_object mod_obj;
};
+/*these osd stuff should be moved to somewhere later*/
struct osd_object {
struct lu_object oo_lu;
struct dentry *oo_dentry;
};
-struct md_device_operations {
- int (*mdo_root_get)(struct md_device *m, struct ll_fid *f);
- int (*mdo_mkdir)(struct md_object *obj, const char *name,
- struct md_object *child);
-
- int (*mdo_rename)(struct md_object *spobj, struct md_object *tpobj,
- struct md_object *sobj, const char *sname,
- struct md_object *tobj, const char *tname,
- struct context *uctxt);
- int (*mdo_link)(struct md_object *tobj, struct md_object *sobj,
- const char *name, struct context *uctxt);
- int (*mdo_attr_get)(struct md_object *obj, void *buf, int buf_len,
- const char *name, struct context *uctxt);
- int (*mdo_attr_set)(struct md_object *obj, void *buf, int buf_len,
- const char *name, struct context *uctxt);
- int (*mdo_index_insert)(struct mdd_device *mdd, struct md_object *pobj,
- struct md_object *obj, const char *name,
- struct context *uctxt);
- int (*mdo_index_delete)(struct md_object *pobj, struct md_object *obj,
- const char *name, struct context *uctxt);
- int (*mdo_object_create)(struct md_object *pobj, struct mdd_object *child,
- struct context *uctxt);
+struct osd_device_operations {
+ int (*osd_object_lock)(struct lu_object *lu, __u32 mode);
+ int (*osd_object_unlock)(struct lu_object *lu, __u32 mode);
+ void* (*osd_trans_start)(struct lu_object *lu);
+ void (*osd_trans_stop)(struct lu_object *lu);
+ int (*osd_object_create)(struct lu_object *plu, struct lu_object *child,
+ struct context *context, void *handle);
+ int (*osd_object_destroy)(struct lu_object *lu, void *handle);
+ void (*osd_object_get)(struct lu_object *lu);
+ int (*osd_attr_get)(struct lu_object *lu, void *buf, int buf_len,
+ const char *name, struct context *context);
+ int (*osd_attr_set)(struct lu_object *lu, void *buf, int buf_len,
+ const char *name, struct context *context,
+ void *handle);
+ int (*osd_object_dec_check)(struct lu_object *lu);
+ int (*osd_index_insert)(struct lu_object *lu, struct lu_fid *fid,
+ const char *name, struct context *uctxt,
+ void *handle);
+ int (*osd_index_delete)(struct lu_object *lu, struct lu_fid *fid,
+ const char *name, struct context *uctxt,
+ void *handle);
+};
+
+struct osd_device {
+ struct lu_device osd_lu_dev;
+ struct osd_device_operations *osd_ops;
};
+
int mdd_object_put(struct mdd_device *mdd, struct mdd_object *obj);
void mdd_object_get(struct mdd_device *mdd, struct mdd_object *obj);
#endif
struct file *filp;
struct dentry *new_child;
struct lvfs_run_ctxt saved;
- char fidname[LL_FID_NAMELEN];
+ char fidname[LU_FID_NAMELEN];
void *handle;
struct lvfs_ucred ucred = { 0 };
int rc = 0, err, namelen;
struct obd_device *obd = exp->exp_obd;
struct lvfs_run_ctxt saved;
struct lvfs_ucred ucred = { 0 };
- char fidname[lu_fid_NAMELEN];
+ char fidname[LU_FID_NAMELEN];
struct dentry *de;
void *handle;
int err, namelen, rc = 0;
{
struct mds_obd *mds = mds_req2mds(req);
struct dentry *dchild;
- char fidname[lu_fid_NAMELEN];
+ char fidname[LU_FID_NAMELEN];
int fidlen = 0, rc;
void *handle = NULL;
ENTRY;
struct mds_file_data *mfd, int unlink_orphan)
{
struct inode *inode = mfd->mfd_dentry->d_inode;
- char fidname[lu_fid_NAMELEN];
+ char fidname[LU_FID_NAMELEN];
int last_orphan, fidlen, rc = 0, cleanup_phase = 0;
struct dentry *pending_child = NULL;
struct mds_obd *mds = &obd->u.mds;
struct inode *pending_dir = mds->mds_pending_dir->d_inode;
struct inode *inode = dentry->d_inode;
struct dentry *pending_child;
- char fidname[lu_fid_NAMELEN];
+ char fidname[LU_FID_NAMELEN];
int fidlen = 0, rc, mode;
ENTRY;
struct inode *child_inode, *pending_dir = mds->mds_pending_dir->d_inode;
struct l_linux_dirent *dirent, *n;
struct list_head dentry_list;
- char d_name[LL_FID_NAMELEN];
+ char d_name[LU_FID_NAMELEN];
unsigned long inum;
int i = 0, rc = 0, item = 0, namlen;
ENTRY;