#include <linux/obd.h>
#include <linux/md_object.h>
-#define LUSTRE_CMM0_NAME "cmm0"
-
struct cmm_device {
- struct md_device cmm_md_dev;
+ struct md_device cmm_md_dev;
/* underlaying device in MDS stack, usually MDD */
- struct md_device *cmm_child;
+ struct md_device *cmm_child;
/* other MD servers in cluster */
- struct md_device *cmm_cluster;
+ __u32 cmm_local_num;
+ __u32 cmm_tgt_count;
+ struct list_head cmm_targets;
};
-
-#define CMM_DO_CHILD(d) (d->cmm_child->md_ops)
+static inline struct md_device_operations *cmm_child_ops(struct cmm_device *d)
+{
+ return (d->cmm_child->md_ops);
+}
static inline struct cmm_device *md2cmm_dev(struct md_device *m)
{
- return container_of(m, struct cmm_device, cmm_md_dev);
+ return container_of0(m, struct cmm_device, cmm_md_dev);
}
-static struct cmm_device *lu2cmm_dev(struct lu_device *d)
+static inline struct cmm_device *lu2cmm_dev(struct lu_device *d)
{
//LASSERT(lu_device_is_cmm(d));
- return container_of(d, struct cmm_device, cmm_md_dev.md_lu_dev);
+ return container_of0(d, struct cmm_device, cmm_md_dev.md_lu_dev);
}
static inline struct lu_device *cmm2lu_dev(struct cmm_device *d)
}
struct cmm_object {
- struct md_object cmo_obj;
+ struct md_object cmo_obj;
+ /* mds number where object is placed */
+ __u32 cmo_num;
};
static inline struct cmm_device *cmm_obj2dev(struct cmm_object *c)
return (md2cmm_dev(md_device_get(&c->cmo_obj)));
}
-static struct cmm_object *lu2cmm_obj(struct lu_object *o)
+static inline struct cmm_object *lu2cmm_obj(struct lu_object *o)
{
//LASSERT(lu_device_is_cmm(o->lo_dev));
- return container_of(o, struct cmm_object, cmo_obj.mo_lu);
+ return container_of0(o, struct cmm_object, cmo_obj.mo_lu);
+}
+
+static inline int cmm_is_local_obj(struct cmm_object *c)
+{
+ return (c->cmo_num == cmm_obj2dev(c)->cmm_local_num);
}
/* get cmm object from md_object */
static inline struct cmm_object *md2cmm_obj(struct md_object *o)
{
- return container_of(o, struct cmm_object, cmo_obj);
+ return container_of0(o, struct cmm_object, cmo_obj);
}
/* get lower-layer object */
static inline struct md_object *cmm2child_obj(struct cmm_object *o)
}
/* cmm_object.c */
-int cmm_object_init(struct lu_object*);
-struct lu_object *cmm_object_alloc(struct lu_device *);
-void cmm_object_free(struct lu_object *o);
-void cmm_object_release(struct lu_object *o);
+struct lu_object *cmm_object_alloc(struct lu_context *ctx, struct lu_device *);
+void cmm_object_free(struct lu_context *ctx, struct lu_object *o);
//int cmm_getattr(struct lu_object *o, struct lu_attr *a);
//int cmm_setattr(struct lu_object *o, struct lu_attr *a);
-int cmm_object_print(struct seq_file *f, const struct lu_object *o);
/* cmm md operations */
-int cmm_root_get(struct md_device *m, struct ll_fid *f);
-int cmm_mkdir(struct md_object *o, const char *name,
+int cmm_config(struct lu_context *ctx, struct md_device *md, const char *name,
+ void *buf, int size, int mode);
+int cmm_root_get(struct lu_context *ctx, struct md_device *m, struct lu_fid *f);
+int cmm_statfs(struct lu_context *ctx,
+ struct md_device *m, struct kstatfs *sfs);
+int cmm_object_create(struct lu_context *, struct md_object *);
+int cmm_mkdir(struct lu_context *ctxt, struct lu_attr*,
+ struct md_object *o, const char *name,
struct md_object *child);
+int cmm_xattr_get(struct lu_context *ctxt,
+ struct md_object *obj, void *buf, int size,
+ const char *name);
#endif /* __KERNEL__ */
#endif /* _CMM_INTERNAL_H */