int rc;
/* temporary hack for proto mkdir */
rc = fid_seq(fid) == LUSTRE_ROOT_FID_SEQ ? 0 : 1;
- return 0;
+ RETURN(rc);
}
/* get child device by mdsnum*/
static struct lu_device *cmm_get_child(struct cmm_device *d, __u32 num)
{
struct lu_device *next = NULL;
-
+ ENTRY;
if (likely(num == d->cmm_local_num)) {
next = &d->cmm_child->md_lu_dev;
} else {
}
}
}
- return next;
+ RETURN(next);
}
struct lu_object *cmm_object_alloc(struct lu_context *ctx,
struct cmm_object *cmm_c = md2cmm_obj(c);
struct md_object *local = cmm2child_obj(cmm_p);
int rc;
+
+ ENTRY;
if (cmm_is_local_obj(cmm_c)) {
/* fully local mkdir */
.ldo_process_config = mdc_process_config
};
+static int mdc_device_connect(struct mdc_device *mc)
+{
+ struct mdc_cli_desc *desc = &mc->mc_desc;
+ struct obd_device *obd = mdc2lu_dev(mc)->ld_obd;
+ //struct client_obd *cli = &obd->u.cli;
+ struct obd_uuid mdc_uuid = { "MDT_MDC_UUID" };
+ struct lustre_handle conn = { 0 };
+ struct obd_import *imp = desc->cl_import;
+ int rc;
+
+ /* obd_connect */
+ rc = class_connect(&conn, obd, &mdc_uuid);
+ imp->imp_dlm_handle = conn;
+
+ rc = ptlrpc_init_import(imp);
+ if (rc != 0)
+ RETURN(rc);
+
+ rc = ptlrpc_connect_import(imp, NULL);
+ if (rc != 0) {
+ LASSERT (imp->imp_state == LUSTRE_IMP_DISCON);
+ RETURN(rc);
+ }
+
+ ptlrpc_pinger_add_import(imp);
+ //TODO other initializations
+ LASSERT(imp->imp_connection);
+
+ RETURN(0);
+}
+
static int mdc_device_init(struct lu_device *ld, struct lu_device *next)
{
struct mdc_device *mc = lu2mdc_dev(ld);
struct mdc_cli_desc *desc = &mc->mc_desc;
struct obd_device *obd = ld->ld_obd;
- int rc = 0;
+ struct client_obd *cli = &obd->u.cli;
struct obd_import *imp;
int rq_portal, rp_portal, connect_op;
+ int rc = 0;
+
ENTRY;
-
- //sema_init(&desc->cl_rpcl_sem, 1);
+ //alloc rpc_lock
ptlrpcd_addref();
rq_portal = MDS_REQUEST_PORTAL;
rp_portal = MDC_REPLY_PORTAL;
connect_op = MDS_CONNECT;
+
+ sema_init(&cli->cl_sem, 1);
+ cli->cl_conn_count = 0;
+
rc = ldlm_get_ref();
if (rc != 0) {
CERROR("ldlm_get_ref failed: %d\n", rc);
imp->imp_initial_recov = 1;
imp->imp_initial_recov_bk = 0;
INIT_LIST_HEAD(&imp->imp_pinger_chain);
+ cli->cl_target_uuid = desc->cl_target_uuid;
class_import_put(imp);
rc = client_import_add_conn(imp, &desc->cl_server_uuid, 1);
if (rc) {
}
desc->cl_import = imp;
+ cli->cl_import = imp;
+
+ rc = mdc_device_connect(mc);
- //TODO other initializations
-
RETURN(0);
err_import:
err_ldlm:
ldlm_put_ref(0);
err:
+ //free rpc_lock
ptlrpcd_decref();
RETURN(rc);
}