Whamcloud - gitweb
cmm update
authortappro <tappro>
Mon, 24 Apr 2006 08:54:14 +0000 (08:54 +0000)
committertappro <tappro>
Mon, 24 Apr 2006 08:54:14 +0000 (08:54 +0000)
lustre/cmm/cmm_internal.h
lustre/cmm/cmm_object.c

index 3012c22..8904a14 100644 (file)
 #include <linux/obd.h>
 #include <linux/md_object.h>
 
+struct cmm_mdc_device {
+        struct md_device mdc_md_dev;
+        /* other MD servers in cluster */
+        __u32            cmm_tgt_count;
+        struct list_head cmm_tgt_linkage;
+};
+
 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            local_num;
+        __u32            cmm_tgt_count;
+        struct list_head cmm_targets;
 };
 
-
 static inline struct md_device_operations *cmm_child_ops(struct cmm_device *d)
 {
         return (d->cmm_child->md_ops);
index 547aa33..4517ebe 100644 (file)
 static struct md_object_operations cmm_mo_ops;
 static struct lu_object_operations cmm_obj_ops;
 
+static int cmm_fld_lookup(struct lu_fid *fid) 
+{
+        /* return master MDS for now */
+        return 0;
+}
+
+/* get child device by mdsnum*/
+static struct lu_device *cmm_get_child(struct cmm_device *d, __u32 num)
+{
+        struct lu_device *next;
+
+        if (likely(num != d->local_num)) {
+               next = &d->cmm_child->md_lu_dev;
+        } else {
+                next = &d->cmm_child->md_lu_dev;
+        }
+        return next;
+}
+
 struct lu_object *cmm_object_alloc(struct lu_context *ctx,
                                    struct lu_device *d)
 {
@@ -61,19 +80,13 @@ int cmm_object_init(struct lu_context *ctxt, struct lu_object *o)
        struct cmm_device *d = lu2cmm_dev(o->lo_dev);
        struct lu_device  *under;
        struct lu_object  *below;
-        //struct lu_fid     *fid = &o->lo_header->loh_fid;
-        //int mds_index;
+        struct lu_fid     *fid = &o->lo_header->loh_fid;
+        int mdsnum;
         ENTRY;
 
         /* under device can be MDD or MDC */
-#if 0
-        mds = cmm_fld_lookup(fid);
-        if (mds_index != d->local_index)
-               under = &d->cmm_lmv->md_lu_dev;
-        else
-#endif
-                under = &d->cmm_child->md_lu_dev;
-
+        mdsnum = cmm_fld_lookup(fid);
+        under = cmm_get_child(d, mdsnum);
 
         below = under->ld_ops->ldo_object_alloc(ctxt, under);
        if (below != NULL) {