Whamcloud - gitweb
b=13297
[fs/lustre-release.git] / lustre / include / md_object.h
index 4546089..556728d 100644 (file)
@@ -167,7 +167,7 @@ struct md_op_spec {
                         int  eadatalen;
                 } sp_ea;
         } u;
-        
+
         /** Create flag from client: such as MDS_OPEN_CREAT, and others. */
         __u32      sp_cr_flags;
 
@@ -233,7 +233,7 @@ struct md_object_operations {
 
         int (*moo_close)(const struct lu_env *env, struct md_object *obj,
                          struct md_attr *ma);
-        
+
         int (*moo_capa_get)(const struct lu_env *, struct md_object *,
                             struct lustre_capa *, int renewal);
         int (*moo_object_sync)(const struct lu_env *, struct md_object *);
@@ -336,7 +336,7 @@ struct md_upcall {
 
 struct md_device {
         struct lu_device             md_lu_dev;
-        struct md_device_operations *md_ops;
+        const struct md_device_operations *md_ops;
         struct md_upcall             md_upcall;
 };
 
@@ -378,8 +378,40 @@ static inline int md_do_upcall(const struct lu_env *env, struct md_device *m,
 
 struct md_object {
         struct lu_object             mo_lu;
-        struct md_object_operations *mo_ops;
-        struct md_dir_operations    *mo_dir_ops;
+        const struct md_object_operations *mo_ops;
+        const struct md_dir_operations    *mo_dir_ops;
+};
+
+/**
+ * md-server site.
+ */
+struct md_site {
+        struct lu_site ms_lu;
+        /**
+         * mds number of this site.
+         */
+        mdsno_t               ms_node_id;
+        /**
+         * Fid location database
+         */
+        struct lu_server_fld *ms_server_fld;
+        struct lu_client_fld *ms_client_fld;
+
+        /**
+         * Server Seq Manager
+         */
+        struct lu_server_seq *ms_server_seq;
+
+        /**
+         * Controller Seq Manager
+         */
+        struct lu_server_seq *ms_control_seq;
+        struct obd_export    *ms_control_exp;
+
+        /**
+         * Client Seq Manager
+         */
+        struct lu_client_seq *ms_client_seq;
 };
 
 static inline int lu_device_is_md(const struct lu_device *d)
@@ -389,7 +421,7 @@ static inline int lu_device_is_md(const struct lu_device *d)
 
 static inline struct md_device *lu2md_dev(const struct lu_device *d)
 {
-        LASSERT(lu_device_is_md(d));
+        LASSERT(IS_ERR(d) || lu_device_is_md(d));
         return container_of0(d, struct md_device, md_lu_dev);
 }
 
@@ -400,7 +432,7 @@ static inline struct lu_device *md2lu_dev(struct md_device *d)
 
 static inline struct md_object *lu2md(const struct lu_object *o)
 {
-        LASSERT(lu_device_is_md(o->lo_dev));
+        LASSERT(o == NULL || IS_ERR(o) || lu_device_is_md(o->lo_dev));
         return container_of0(o, struct md_object, mo_lu);
 }
 
@@ -411,10 +443,15 @@ static inline struct md_object *md_object_next(const struct md_object *obj)
 
 static inline struct md_device *md_obj2dev(const struct md_object *o)
 {
-        LASSERT(lu_device_is_md(o->mo_lu.lo_dev));
+        LASSERT(o == NULL || IS_ERR(o) || lu_device_is_md(o->mo_lu.lo_dev));
         return container_of0(o->mo_lu.lo_dev, struct md_device, md_lu_dev);
 }
 
+static inline struct md_site *lu_site2md(const struct lu_site *s)
+{
+        return container_of0(s, struct md_site, ms_lu);
+}
+
 static inline int md_device_init(struct md_device *md, struct lu_device_type *t)
 {
        return lu_device_init(&md->md_lu_dev, t);
@@ -425,7 +462,15 @@ static inline void md_device_fini(struct md_device *md)
        lu_device_fini(&md->md_lu_dev);
 }
 
-/* md operations */
+static inline struct md_object *md_object_find_slice(const struct lu_env *env,
+                                                     struct md_device *md,
+                                                     const struct lu_fid *f)
+{
+        return lu2md(lu_object_find_slice(env, md2lu_dev(md), f, NULL));
+}
+
+
+/** md operations */
 static inline int mo_permission(const struct lu_env *env,
                                 struct md_object *p,
                                 struct md_object *c,