From: wangdi Date: Thu, 31 Aug 2006 14:28:40 +0000 (+0000) Subject: Branch: b_new_cmd X-Git-Tag: v1_8_0_110~486^2~1052 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=97e1fe8885eda1ffe7e2d766dfb1dc21d1c00b14;p=fs%2Flustre-release.git Branch: b_new_cmd add fid init/fini for cmm/mdc. --- diff --git a/lustre/cmm/mdc_device.c b/lustre/cmm/mdc_device.c index 7434cf5..1941440 100644 --- a/lustre/cmm/mdc_device.c +++ b/lustre/cmm/mdc_device.c @@ -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", diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 2e75328..e09d078 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -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); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index ce51010..9f07e00 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -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);