Whamcloud - gitweb
Branch: b_new_cmd
authorwangdi <wangdi>
Thu, 31 Aug 2006 14:28:40 +0000 (14:28 +0000)
committerwangdi <wangdi>
Thu, 31 Aug 2006 14:28:40 +0000 (14:28 +0000)
add fid init/fini for cmm/mdc.

lustre/cmm/mdc_device.c
lustre/mdc/mdc_request.c
lustre/mdt/mdt_handler.c

index 7434cf5..1941440 100644 (file)
@@ -101,6 +101,10 @@ static int mdc_add_obd(const struct lu_context *ctx,
                                mdc->obd_name, rc);
                 } else {
                         desc->cl_exp = class_conn2export(conn);
+
+                        rc = obd_fid_init(desc->cl_exp);
+                        if (rc)
+                                CERROR("fid init error %d \n", rc);
                 }
         }
 
@@ -116,7 +120,11 @@ static int mdc_del_obd(struct mdc_device *mc)
 
         CDEBUG(D_CONFIG, "disconnect from %s\n",
                class_exp2obd(desc->cl_exp)->obd_name);
-
+        rc = obd_fid_fini(desc->cl_exp);
+        if (rc)
+                CERROR("fid init error %d \n", rc);
+       
         rc = obd_disconnect(desc->cl_exp);
         if (rc) {
                 CERROR("target %s disconnect error %d\n",
index 2e75328..e09d078 100644 (file)
@@ -1118,6 +1118,7 @@ static int mdc_import_event(struct obd_device *obd, struct obd_import *imp,
 static int mdc_fid_init(struct obd_export *exp)
 {
         struct client_obd *cli = &exp->exp_obd->u.cli;
+        char *uuid;
         int rc;
         ENTRY;
 
@@ -1125,10 +1126,16 @@ static int mdc_fid_init(struct obd_export *exp)
         if (cli->cl_seq == NULL)
                 RETURN(-ENOMEM);
 
+        OBD_ALLOC(uuid, MAX_OBD_NAME + 5);
+        if (uuid == NULL)
+                GOTO(out_free_seq, rc = -ENOMEM);
+
+        snprintf(uuid, MAX_OBD_NAME + 5, "mgr-%s",
+                        exp->exp_obd->obd_name);
         /* init client side sequence-manager */
-        rc = seq_client_init(cli->cl_seq,
-                             exp->exp_obd->obd_name,
+        rc = seq_client_init(cli->cl_seq, uuid,
                              exp, LUSTRE_SEQ_METADATA);
+        OBD_FREE(uuid, MAX_OBD_NAME + 5);
         if (rc)
                 GOTO(out_free_seq, rc);
 
index ce51010..9f07e00 100644 (file)
@@ -1899,20 +1899,24 @@ static int mdt_seq_init_cli(const struct lu_context *ctx,
                         OBD_ALLOC_PTR(ls->ls_client_seq);
 
                         if (ls->ls_client_seq != NULL) {
+                                char *uuid;
+
+                                OBD_ALLOC(uuid, MAX_OBD_NAME + 5);
+                                if (!uuid)
+                                        RETURN(-ENOMEM);
+
+                                snprintf(uuid, MAX_OBD_NAME + 5, "ctl-%s",
+                                                        mdc->obd_name);
+
                                 rc = seq_client_init(ls->ls_client_seq,
-                                                     mdc->obd_name,
-                                                     ls->ls_client_exp,
+                                                     uuid, ls->ls_client_exp,
                                                      LUSTRE_SEQ_METADATA);
+                                OBD_FREE(uuid, MAX_OBD_NAME + 5);
                         } else
                                 rc = -ENOMEM;
 
                         if (rc)
                                 RETURN(rc);
-                        /*FIXME: add client seq to mdc obd for 
-                         *allocating fid in create slave objects,
-                         *may need better way to fix it,
-                         *why not init client seq in cmm_add_mdc?*/
-                        mdc->u.cli.cl_seq = ls->ls_client_seq;
 
                         LASSERT(ls->ls_server_seq != NULL);