};
struct lov_obd {
- struct lustre_handle mdc_connh;
struct obd_device *mdcobd;
struct lov_desc desc;
int bufsize;
#ifdef __KERNEL__
extern struct obd_export *class_conn2export(struct lustre_handle *conn);
extern struct obd_device *class_conn2obd(struct lustre_handle *conn);
-extern int class_import2export(struct lustre_handle *conn,
- struct lustre_handle *imp);
+extern int class_rconn2export(struct lustre_handle *conn,
+ struct lustre_handle *rconn);
struct obd_export {
- __u64 export_cookie;
- struct lustre_handle export_import; /* client handle */
- struct list_head export_chain;
- struct obd_device *export_obd;
- struct ptlrpc_connection *export_connection;
- void *export_data; /* device specific data */
- int export_desclen;
- char *export_desc;
+ __u64 exp_cookie;
+ struct lustre_handle exp_rconnh; /* remote connection handle */
+ struct lustre_handle exp_impconnh;
+ struct list_head exp_chain;
+ struct obd_device *exp_obd;
+ struct ptlrpc_connection *exp_connection;
+ void *exp_data; /* device specific data */
+ int exp_desclen;
+ char *exp_desc;
};
struct obd_import {
- __u64 import_cookie;
- struct lustre_handle import_export; /* server handle */
- struct list_head import_chain;
- struct obd_device *import_obd;
- unsigned int import_id;
- void *import_data; /* device specific data */
+ __u64 imp_cookie;
+ struct lustre_handle imp_expconnh;
+ struct list_head imp_chain;
+ struct obd_device *imp_obd;
+ unsigned int imp_id;
+ void *imp_data; /* device specific data */
};
static inline int obd_check_conn(struct lustre_handle *conn)
#define OBT(dev) (dev)->obd_type
#define OBP(dev,op) (dev)->obd_type->typ_ops->o_ ## op
-#define OBD_CHECK_SETUP(conn, export) \
+#define OBD_CHECK_SETUP(conn, export) \
do { \
if (!(conn)) { \
CERROR("NULL connection\n"); \
RETURN(-EINVAL); \
} \
\
- export = class_conn2export(conn);\
- if (!(export)) { \
- CERROR("No export\n"); \
+ export = class_conn2export(conn); \
+ if (!(export)) { \
+ CERROR("No export\n"); \
RETURN(-EINVAL); \
} \
\
- if ( !((export)->export_obd->obd_flags & OBD_SET_UP) ) { \
+ if (!((export)->exp_obd->obd_flags & OBD_SET_UP)) { \
CERROR("Device %d not setup\n", \
- (export)->export_obd->obd_minor); \
+ (export)->exp_obd->obd_minor); \
RETURN(-EINVAL); \
} \
} while (0)
-#define OBD_CHECK_DEVSETUP(obd) \
+#define OBD_CHECK_DEVSETUP(obd) \
do { \
- if (!(obd)) { \
+ if (!(obd)) { \
CERROR("NULL device\n"); \
RETURN(-EINVAL); \
} \
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,get_info);
+ OBD_CHECK_OP(export->exp_obd,get_info);
- rc = OBP(export->export_obd, get_info)(conn, keylen, key, vallen, val);
+ rc = OBP(export->exp_obd, get_info)(conn, keylen, key, vallen, val);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,set_info);
+ OBD_CHECK_OP(export->exp_obd,set_info);
- rc = OBP(export->export_obd, set_info)(conn, keylen, key, vallen, val);
+ rc = OBP(export->exp_obd, set_info)(conn, keylen, key, vallen, val);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,create);
+ OBD_CHECK_OP(export->exp_obd,create);
- rc = OBP(export->export_obd, create)(conn, obdo, ea);
+ rc = OBP(export->exp_obd, create)(conn, obdo, ea);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,destroy);
+ OBD_CHECK_OP(export->exp_obd,destroy);
- rc = OBP(export->export_obd, destroy)(conn, obdo, ea);
+ rc = OBP(export->exp_obd, destroy)(conn, obdo, ea);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,getattr);
+ OBD_CHECK_OP(export->exp_obd,getattr);
- rc = OBP(export->export_obd, getattr)(conn, obdo);
+ rc = OBP(export->exp_obd, getattr)(conn, obdo);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,close);
+ OBD_CHECK_OP(export->exp_obd,close);
- rc = OBP(export->export_obd, close)(conn, obdo, md);
+ rc = OBP(export->exp_obd, close)(conn, obdo, md);
RETURN(rc);
}
static inline int obd_open(struct lustre_handle *conn, struct obdo *obdo,
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,open);
+ OBD_CHECK_OP(export->exp_obd,open);
- rc = OBP(export->export_obd, open) (conn, obdo, md);
+ rc = OBP(export->exp_obd, open) (conn, obdo, md);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,setattr);
+ OBD_CHECK_OP(export->exp_obd,setattr);
- rc = OBP(export->export_obd, setattr)(conn, obdo);
+ rc = OBP(export->exp_obd, setattr)(conn, obdo);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,disconnect);
+ OBD_CHECK_OP(export->exp_obd,disconnect);
- rc = OBP(export->export_obd, disconnect)(conn);
+ rc = OBP(export->exp_obd, disconnect)(conn);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,statfs);
+ OBD_CHECK_OP(export->exp_obd,statfs);
- rc = OBP(export->export_obd, statfs)(conn, buf);
+ rc = OBP(export->exp_obd, statfs)(conn, buf);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,punch);
+ OBD_CHECK_OP(export->exp_obd,punch);
- rc = OBP(export->export_obd, punch)(conn, tgt, md, count, offset);
+ rc = OBP(export->exp_obd, punch)(conn, tgt, md, count, offset);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,brw);
+ OBD_CHECK_OP(export->exp_obd,brw);
if (!(cmd & OBD_BRW_RWMASK)) {
CERROR("obd_brw: cmd must be OBD_BRW_READ or OBD_BRW_WRITE\n");
LBUG();
}
- rc = OBP(export->export_obd, brw)(cmd, conn, md, oa_bufs, buf,
+ rc = OBP(export->exp_obd, brw)(cmd, conn, md, oa_bufs, buf,
count, offset, flags, callback);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,preprw);
+ OBD_CHECK_OP(export->exp_obd,preprw);
- rc = OBP(export->export_obd, preprw)(cmd, conn, objcount, obj, niocount,
+ rc = OBP(export->exp_obd, preprw)(cmd, conn, objcount, obj, niocount,
remote, local, desc_private);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,commitrw);
+ OBD_CHECK_OP(export->exp_obd,commitrw);
- rc = OBP(export->export_obd, commitrw)(cmd, conn, objcount, obj, niocount,
+ rc = OBP(export->exp_obd, commitrw)(cmd, conn, objcount, obj, niocount,
local, desc_private);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,iocontrol);
+ OBD_CHECK_OP(export->exp_obd,iocontrol);
- rc = OBP(export->export_obd, iocontrol)(cmd, conn, len, karg, uarg);
+ rc = OBP(export->exp_obd, iocontrol)(cmd, conn, len, karg, uarg);
RETURN(rc);
}
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,enqueue);
+ OBD_CHECK_OP(export->exp_obd,enqueue);
- rc = OBP(export->export_obd, enqueue)(conn, parent_lock, res_id, type,
+ rc = OBP(export->exp_obd, enqueue)(conn, parent_lock, res_id, type,
cookie, cookielen, mode, flags, cb,
data, datalen, lockh);
RETURN(rc);
int rc;
struct obd_export *export;
OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->export_obd,cancel);
+ OBD_CHECK_OP(export->exp_obd,cancel);
- rc = OBP(export->export_obd, cancel)(conn, mode, lockh);
+ rc = OBP(export->exp_obd, cancel)(conn, mode, lockh);
RETURN(rc);
}
if (req->rq_reqmsg->bufcount > 1) {
/* an intent needs to be considered */
struct ldlm_intent *it = lustre_msg_buf(req->rq_reqmsg, 1);
- struct mds_obd *mds= &req->rq_export->export_obd->u.mds;
+ struct mds_obd *mds= &req->rq_export->exp_obd->u.mds;
struct mds_body *mds_rep;
struct ldlm_reply *rep;
__u64 new_resid[3] = {0, 0, 0}, old_res;
static int ldlm_handle_enqueue(struct ptlrpc_request *req)
{
- struct obd_device *obddev = req->rq_export->export_obd;
+ struct obd_device *obddev = req->rq_export->exp_obd;
struct ldlm_reply *dlm_rep;
struct ldlm_request *dlm_req;
int rc, size = sizeof(*dlm_rep), cookielen = 0;
LBUG();
req->rq_export = export;
- export->export_connection = req->rq_connection;
+ export->exp_connection = req->rq_connection;
RETURN(0);
}
GOTO(out_free, sb = NULL);
}
- /* First the MDS since an LOV requires an the MDC connection
- to find its descriptor */
+ /* First the MDS since an LOV requires an the MDC connection
+ to find its descriptor */
#if 0
err = connmgr_connect(ptlrpc_connmgr, sbi->ll_mds_conn);
if (err) {
}
sbi2mdc(sbi)->mdc_conn->c_level = LUSTRE_CONN_FULL;
- /* now the OST, which could be an LOV */
-
+ /* now the OST, which could be an LOV */
obd = class_uuid2obd(ost);
if (!obd) {
CERROR("OST %s: not setup or attached\n", ost);
GOTO(out_mdc, sb = NULL);
}
-#warning error: need to set obd->u.lov.mdc_connh from sbi->ll_mdc_conn
+ /* hack: pass in the MDC connection information to LOV via osc_conn */
+ memcpy(&sbi->ll_osc_conn, &sbi->ll_mdc_conn, sizeof(sbi->ll_mdc_conn));
err = obd_connect(&sbi->ll_osc_conn, obd);
if (err) {
CERROR("cannot connect to %s: rc = %d\n", ost, err);
/* obd methods */
-static int lov_getinfo(struct obd_device *obd, struct lov_desc *desc,
- uuid_t **uuids, struct ptlrpc_request **request)
+static int lov_getinfo(struct obd_device *obd, struct lustre_handle *mdc_connh,
+ struct lov_desc *desc, uuid_t **uuids,
+ struct ptlrpc_request **request)
{
struct ptlrpc_request *req;
struct mds_status_req *streq;
int rc, size[2] = {sizeof(*streq)};
ENTRY;
-#warning error: need to set lov->mdc_connh somewhere!!!!
- req = ptlrpc_prep_req2(mdc->mdc_client, mdc->mdc_conn, &lov->mdc_connh,
+ req = ptlrpc_prep_req2(mdc->mdc_client, mdc->mdc_conn, mdc_connh,
MDS_LOVINFO, 1, size, NULL);
if (!req)
GOTO(out, rc = -ENOMEM);
static int lov_connect(struct lustre_handle *conn, struct obd_device *obd)
{
- int rc;
- int i;
struct ptlrpc_request *req;
+ struct lustre_handle mdc_conn;
struct lov_obd *lov = &obd->u.lov;
- uuid_t *uuidarray;
+ uuid_t *uuidarray;
+ int rc;
+ int i;
MOD_INC_USE_COUNT;
+ memcpy(&mdc_conn, conn, sizeof(mdc_conn));
+ conn->addr = -1;
+ conn->cookie = 0;
rc = class_connect(conn, obd);
- if (rc) {
+ if (rc) {
MOD_DEC_USE_COUNT;
- RETURN(rc);
+ RETURN(rc);
}
-
- rc = lov_getinfo(obd, &lov->desc, &uuidarray, &req);
- if (rc) {
+
+ rc = lov_getinfo(obd, &mdc_conn, &lov->desc, &uuidarray, &req);
+ if (rc) {
CERROR("cannot get lov info %d\n", rc);
- GOTO(out, rc);
+ GOTO(out, rc);
}
-
- if (lov->desc.ld_tgt_count > 1000) {
+
+ if (lov->desc.ld_tgt_count > 1000) {
CERROR("configuration error: target count > 1000 (%d)\n",
lov->desc.ld_tgt_count);
- GOTO(out, rc = -EINVAL);
+ GOTO(out, rc = -EINVAL);
}
-
- if (strcmp(obd->obd_uuid, lov->desc.ld_uuid)) {
- CERROR("lov uuid %s not on mds device (%s)\n",
+
+ if (strcmp(obd->obd_uuid, lov->desc.ld_uuid)) {
+ CERROR("lov uuid %s not on mds device (%s)\n",
obd->obd_uuid, lov->desc.ld_uuid);
- GOTO(out, rc = -EINVAL);
- }
-
- if (req->rq_repmsg->bufcount < 2 || req->rq_repmsg->buflens[1] <
- sizeof(uuid_t) * lov->desc.ld_tgt_count) {
- CERROR("invalid uuid array returned\n");
- GOTO(out, rc = -EINVAL);
+ GOTO(out, rc = -EINVAL);
}
- lov->bufsize = sizeof(struct lov_tgt_desc) * lov->desc.ld_tgt_count;
- OBD_ALLOC(lov->tgts, lov->bufsize);
- if (!lov->tgts) {
- CERROR("Out of memory\n");
- GOTO(out, rc = -ENOMEM);
+ if (req->rq_repmsg->bufcount < 2 || req->rq_repmsg->buflens[1] <
+ sizeof(uuid_t) * lov->desc.ld_tgt_count) {
+ CERROR("invalid uuid array returned\n");
+ GOTO(out, rc = -EINVAL);
}
- uuidarray = lustre_msg_buf(req->rq_repmsg, 1);
- for (i = 0 ; i < lov->desc.ld_tgt_count; i++) {
- memcpy(lov->tgts[i].uuid, uuidarray[i], sizeof(uuid_t));
+ lov->bufsize = sizeof(struct lov_tgt_desc) * lov->desc.ld_tgt_count;
+ OBD_ALLOC(lov->tgts, lov->bufsize);
+ if (!lov->tgts) {
+ CERROR("Out of memory\n");
+ GOTO(out, rc = -ENOMEM);
}
- for (i = 0 ; i < lov->desc.ld_tgt_count; i++) {
+ uuidarray = lustre_msg_buf(req->rq_repmsg, 1);
+ for (i = 0 ; i < lov->desc.ld_tgt_count; i++)
+ memcpy(lov->tgts[i].uuid, uuidarray[i], sizeof(uuid_t));
+
+ for (i = 0 ; i < lov->desc.ld_tgt_count; i++) {
struct obd_device *tgt = class_uuid2obd(uuidarray[i]);
- if (!tgt) {
- CERROR("Target %s not configured\n", uuidarray[i]);
- GOTO(out_mem, rc = -EINVAL);
+ if (!tgt) {
+ CERROR("Target %s not configured\n", uuidarray[i]);
+ GOTO(out_mem, rc = -EINVAL);
}
- rc = obd_connect(&lov->tgts[i].conn, tgt);
- if (rc) {
- CERROR("Target %s connect error %d\n",
- uuidarray[i], rc);
+ rc = obd_connect(&lov->tgts[i].conn, tgt);
+ if (rc) {
+ CERROR("Target %s connect error %d\n",
+ uuidarray[i], rc);
GOTO(out_mem, rc);
}
}
out_mem:
- if (rc) {
- for (i = 0 ; i < lov->desc.ld_tgt_count; i++) {
+ if (rc) {
+ for (i = 0 ; i < lov->desc.ld_tgt_count; i++) {
int rc2;
rc2 = obd_disconnect(&lov->tgts[i].conn);
if (rc2)
- CERROR("BAD: Target %s disconnect error %d\n",
- uuidarray[i], rc2);
+ CERROR("BAD: Target %s disconnect error %d\n",
+ uuidarray[i], rc2);
}
OBD_FREE(lov->tgts, lov->bufsize);
}
out:
- if (rc) {
+ if (rc)
class_disconnect(conn);
- }
- if (req)
- ptlrpc_free_req(req);
+
+ ptlrpc_free_req(req);
return rc;
-
}
static int lov_disconnect(struct lustre_handle *conn)
if (!export)
RETURN(-EINVAL);
- lov = &export->export_obd->u.lov;
+ lov = &export->exp_obd->u.lov;
- oa->o_easize = lov_stripe_md_size(export->export_obd);
- if (! *ea) {
- OBD_ALLOC(*ea, oa->o_easize);
- if (! *ea)
- RETURN(-ENOMEM);
+ oa->o_easize = lov_stripe_md_size(export->exp_obd);
+ if (!*ea) {
+ OBD_ALLOC(*ea, oa->o_easize);
+ if (! *ea)
+ RETURN(-ENOMEM);
}
- md = *ea;
+ md = *ea;
md->lmd_size = oa->o_easize;
md->lmd_object_id = oa->o_id;
if (!md->lmd_stripe_count) {
RETURN(-EINVAL);
}
- if (!export || !export->export_obd)
+ if (!export || !export->exp_obd)
RETURN(-ENODEV);
- lov = &export->export_obd->u.lov;
+ lov = &export->exp_obd->u.lov;
md = ea;
for (i = 0; i < md->lmd_stripe_count; i++) {
extern int mds_queue_req(struct ptlrpc_request *);
int mdc_con2cl(struct lustre_handle *conn, struct ptlrpc_client **cl,
- struct ptlrpc_connection **connection,
- struct lustre_handle **rconn)
+ struct ptlrpc_connection **connection,
+ struct lustre_handle **rconn)
{
struct obd_export *export;
struct mdc_obd *mdc;
export = class_conn2export(conn);
if (!export)
- return -EINVAL;
+ return -ENOTCONN;
- mdc = &export->export_obd->u.mdc;
+ mdc = &export->exp_obd->u.mdc;
*cl = mdc->mdc_client;
*connection = mdc->mdc_conn;
- *rconn = &export->export_import;
+ *rconn = &export->exp_rconnh;
return 0;
}
export = class_conn2export(conn);
if (!export)
- return -EINVAL;
+ return -ENOTCONN;
- mdc = &export->export_obd->u.mdc;
+ mdc = &export->exp_obd->u.mdc;
*cl = mdc->mdc_ldlm_client;
*connection = mdc->mdc_conn;
- *rconn = &export->export_import;
+ *rconn = &export->exp_rconnh;
return 0;
}
mdc_con2cl(conn, &cl, &connection, &rconn);
req = ptlrpc_prep_req2(cl, connection, rconn,
- MDS_GETSTATUS, 1, &size, NULL);
+ MDS_GETSTATUS, 1, &size, NULL);
if (!req)
GOTO(out, rc = -ENOMEM);
if (rc)
GOTO(out, rc);
- class_import2export(conn, (struct lustre_handle *)request->rq_repmsg);
+ class_rconn2export(conn, (struct lustre_handle *)request->rq_repmsg);
EXIT;
out:
inline struct mds_obd *mds_req2mds(struct ptlrpc_request *req)
{
- return &req->rq_export->export_obd->u.mds;
+ return &req->rq_export->exp_obd->u.mds;
}
/* Assumes caller has already pushed into the kernel filesystem context */
__u64 res_id[3] = {0, 0, 0};
ENTRY;
- if (strcmp(req->rq_export->export_obd->obd_type->typ_name, "mds") != 0)
+ if (strcmp(req->rq_export->exp_obd->obd_type->typ_name, "mds") != 0)
LBUG();
if (req->rq_reqmsg->bufcount <= offset + 1) {
export = class_conn2export(&mds->mds_connh);
if (!export)
LBUG();
- export->export_connection = mds->mds_ldlm_conn;
+ export->exp_connection = mds->mds_ldlm_conn;
RETURN(0);
if (offset)
offset = 1;
- if (strcmp(req->rq_export->export_obd->obd_type->typ_name, "mds") != 0)
+ if (strcmp(req->rq_export->exp_obd->obd_type->typ_name, "mds") != 0)
LBUG();
de = mds_fid2dentry(mds, rec->ur_fid1, NULL);
EXPORT_SYMBOL(class_uuid2obd);
EXPORT_SYMBOL(class_connect);
EXPORT_SYMBOL(class_conn2export);
-EXPORT_SYMBOL(class_import2export);
+EXPORT_SYMBOL(class_rconn2export);
EXPORT_SYMBOL(class_conn2obd);
EXPORT_SYMBOL(class_disconnect);
//EXPORT_SYMBOL(class_multi_setup);
-/*
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+*
* linux/fs/ext2_obd/sim_obd.c
* Copyright (C) 2001 Cluster File Systems, Inc.
*
int res = -1;
int i;
- if (!name)
- return -1;
+ if (!name)
+ return -1;
for (i=0; i < MAX_OBD_DEVICES; i++) {
struct obd_device *obd = &obd_dev[i];
/* map connection to client */
struct obd_export *class_conn2export(struct lustre_handle *conn)
{
- struct obd_export * export;
+ struct obd_export *export;
- if (!conn)
- RETURN(NULL);
+ if (!conn) {
+ CDEBUG(D_CACHE, "looking for null handle\n");
+ RETURN(NULL);
+ }
- if (conn->addr == -1) /* this means assign a new connection */
+ if (conn->addr == -1) { /* this means assign a new connection */
+ CDEBUG(D_CACHE, "want a new connection\n");
RETURN(NULL);
+ }
if (!conn->addr) {
+ CDEBUG(D_CACHE, "looking for null addr\n");
fixme();
RETURN(NULL);
}
+ CDEBUG(D_IOCTL, "looking for export addr %Lx cookie %Lx\n",
+ conn->addr, conn->cookie);
export = (struct obd_export *) (unsigned long)conn->addr;
if (!kmem_cache_validate(export_cachep, (void *)export))
RETURN(NULL);
- if (export->export_cookie != conn->cookie)
+ if (export->exp_cookie != conn->cookie)
return NULL;
return export;
} /* class_conn2export */
struct obd_export *export;
export = class_conn2export(conn);
if (export)
- return export->export_obd;
+ return export->exp_obd;
fixme();
return NULL;
}
}
memset(export, 0, sizeof(*export));
- get_random_bytes(&export->export_cookie, sizeof(__u64));
- export->export_obd = obd;
- export->export_import.addr = conn->addr;
- export->export_import.cookie = conn->cookie;
+ get_random_bytes(&export->exp_cookie, sizeof(__u64));
+ export->exp_obd = obd;
+ export->exp_rconnh.addr = conn->addr;
+ export->exp_rconnh.cookie = conn->cookie;
- list_add(&(export->export_chain), export->export_obd->obd_exports.prev);
+ list_add(&(export->exp_chain), export->exp_obd->obd_exports.prev);
conn->addr = (__u64) (unsigned long)export;
- conn->cookie = export->export_cookie;
- CDEBUG(D_IOCTL, "connect: addr %Lx cookie %Lx\n",
- (long long)conn->addr, (long long)conn->cookie);
+ conn->cookie = export->exp_cookie;
+ CDEBUG(D_IOCTL, "connect: addr %Lx cookie %Lx\n",
+ (long long)conn->addr, (long long)conn->cookie);
return 0;
}
-int class_import2export(struct lustre_handle *conn, struct lustre_handle *imp)
+int class_rconn2export(struct lustre_handle *conn, struct lustre_handle *rconn)
{
- struct obd_export *export = class_conn2export(conn);
+ struct obd_export *export = class_conn2export(conn);
- if (!export)
- return -EINVAL;
+ if (!export)
+ return -EINVAL;
- export->export_import.addr = imp->addr;
- export->export_import.cookie = imp->cookie;
+ export->exp_rconnh.addr = rconn->addr;
+ export->exp_rconnh.cookie = rconn->cookie;
- return 0;
+ return 0;
}
int class_disconnect(struct lustre_handle *conn)
{
- struct obd_export * export;
+ struct obd_export *export;
ENTRY;
if (!(export = class_conn2export(conn))) {
"nonexistent client %Lx\n", conn->addr);
RETURN(-EINVAL);
} else
- CDEBUG(D_IOCTL, "disconnect: addr %Lx cookie %Lx\n",
- (long long)conn->addr, (long long)conn->cookie);
- list_del(&export->export_chain);
+ CDEBUG(D_IOCTL, "disconnect: addr %Lx cookie %Lx\n",
+ (long long)conn->addr, (long long)conn->cookie);
+ list_del(&export->exp_chain);
kmem_cache_free(export_cachep, export);
RETURN(0);
-}
+}
#if 0
p = sprintf(&page[0], "device=%d\n", obddev->obd_minor);
p += sprintf(&page[0], "name=%s\n", MKSTR(obddev->obd_name));
- p += sprintf(&page[0], "uuid=%s\n", obddev->obd_uuid);
+ p += sprintf(&page[0], "uuid=%s\n", obddev->obd_uuid);
p += sprintf(&page[p], "attached=1\n");
p += sprintf(&page[0], "type=%s\n", MKSTR(obddev->obd_type->typ_name));
-
+
if (obddev->obd_flags & OBD_SET_UP) {
p += sprintf(&page[p], "setup=1\n");
}
-
+
/* print exports */
{
struct list_head * lh;
struct obd_export * export=0;
-
+
lh = &obddev->obd_exports;
while ((lh = lh->next) != &obddev->obd_exports) {
p += sprintf(&page[p],
((export==0) ? ", connections(" : ",") );
- export = list_entry(lh, struct obd_export, export_chain);
+ export = list_entry(lh, struct obd_export, exp_chain);
p += sprintf(&page[p], "%p", export);
- }
+ }
if (export!=0) { /* there was at least one export */
p += sprintf(&page[p], ")");
}
}
-
+
p += sprintf(&page[p], "\n");
/* Compute eof and return value */
struct lustre_handle **rconn)
{
struct obd_export *export = class_conn2export(conn);
- struct osc_obd *osc = &export->export_obd->u.osc;
+ struct osc_obd *osc = &export->exp_obd->u.osc;
+
*cl = osc->osc_client;
*connection = osc->osc_conn;
- *rconn = &export->export_import;
+ *rconn = &export->exp_rconnh;
}
static void osc_con2dlmcl(struct lustre_handle *conn, struct ptlrpc_client **cl,
struct ptlrpc_connection **connection,
struct lustre_handle **rconn)
{
- struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
+ struct obd_export *export = class_conn2export(conn);
+ struct osc_obd *osc = &export->exp_obd->u.osc;
+
*cl = osc->osc_ldlm_client;
*connection = osc->osc_conn;
+ *rconn = &export->exp_rconnh;
}
static int osc_connect(struct lustre_handle *conn, struct obd_device *obd)
/* XXX eventually maybe more refinement */
osc->osc_conn->c_level = LUSTRE_CONN_FULL;
- class_import2export(conn, (struct lustre_handle *)request->rq_repmsg);
+ class_rconn2export(conn, (struct lustre_handle *)request->rq_repmsg);
EXIT;
out:
request.rq_export = class_conn2export((struct lustre_handle *) request.rq_reqmsg);
if (request.rq_export) {
- request.rq_connection = request.rq_export->export_connection;
+ request.rq_connection = request.rq_export->exp_connection;
ptlrpc_connection_addref(request.rq_connection);
} else {
request.rq_connection = ptlrpc_get_connection(&peer);