From 9d2115ddd56f04cd170829e800cbfe68da71e15c Mon Sep 17 00:00:00 2001 From: adilger Date: Wed, 17 Jul 2002 20:26:53 +0000 Subject: [PATCH] Big diff, mostly cosmetic. The two fixes are: - osc_con2dlmcl() now fills in rconn properly. - lov_connect() gets the mdc_conn data passed in via the conn param The cosmetic: - add a new field to the export struct exp_rconnh. Don't use the import field, it is for the LDLM to use later. - make the export struct elements exp_foo instead of export_foo. --- lustre/include/linux/obd.h | 1 - lustre/include/linux/obd_class.h | 117 ++++++++++++++++++------------------- lustre/ldlm/ldlm_lock.c | 2 +- lustre/ldlm/ldlm_lockd.c | 2 +- lustre/lib/l_net.c | 2 +- lustre/llite/super.c | 10 ++-- lustre/lov/lov_obd.c | 121 ++++++++++++++++++++------------------- lustre/mdc/mdc_request.c | 20 +++---- lustre/mds/handler.c | 6 +- lustre/mds/mds_reint.c | 2 +- lustre/obdclass/class_obd.c | 2 +- lustre/obdclass/genops.c | 67 ++++++++++++---------- lustre/obdclass/proc_lustre.c | 14 ++--- lustre/osc/osc_request.c | 12 ++-- lustre/ptlrpc/service.c | 2 +- 15 files changed, 197 insertions(+), 183 deletions(-) diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index ca9d7e9..4d76a62 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -158,7 +158,6 @@ struct lov_tgt_desc { }; struct lov_obd { - struct lustre_handle mdc_connh; struct obd_device *mdcobd; struct lov_desc desc; int bufsize; diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index 17ceba3..5469666 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -64,27 +64,28 @@ extern void proc_lustre_remove_obd_entry(const char* name, #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) @@ -127,29 +128,29 @@ 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); \ } \ @@ -176,9 +177,9 @@ static inline int obd_get_info(struct lustre_handle *conn, obd_count keylen, 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); } @@ -188,9 +189,9 @@ static inline int obd_set_info(struct lustre_handle *conn, obd_count keylen, 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); } @@ -220,9 +221,9 @@ static inline int obd_create(struct lustre_handle *conn, struct obdo *obdo, stru 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); } @@ -231,9 +232,9 @@ static inline int obd_destroy(struct lustre_handle *conn, struct obdo *obdo, str 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); } @@ -242,9 +243,9 @@ static inline int obd_getattr(struct lustre_handle *conn, struct obdo *obdo) 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); } @@ -253,9 +254,9 @@ static inline int obd_close(struct lustre_handle *conn, struct obdo *obdo, struc 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, @@ -264,9 +265,9 @@ 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); } @@ -275,9 +276,9 @@ static inline int obd_setattr(struct lustre_handle *conn, struct obdo *obdo) 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); } @@ -296,9 +297,9 @@ static inline int obd_disconnect(struct lustre_handle *conn) 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); } @@ -307,9 +308,9 @@ static inline int obd_statfs(struct lustre_handle *conn, struct statfs *buf) 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); } @@ -320,9 +321,9 @@ static inline int obd_punch(struct lustre_handle *conn, struct obdo *tgt, 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); } @@ -338,14 +339,14 @@ static inline int obd_brw(int cmd, struct lustre_handle *conn, 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); } @@ -358,9 +359,9 @@ static inline int obd_preprw(int cmd, struct lustre_handle *conn, 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); } @@ -373,9 +374,9 @@ static inline int obd_commitrw(int cmd, struct lustre_handle *conn, 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); } @@ -386,9 +387,9 @@ static inline int obd_iocontrol(int cmd, struct lustre_handle *conn, 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); } @@ -401,9 +402,9 @@ static inline int obd_enqueue(struct lustre_handle *conn, 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); @@ -415,9 +416,9 @@ static inline int obd_cancel(struct lustre_handle *conn, __u32 mode, 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); } diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index ab72796..9b02d18 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -264,7 +264,7 @@ static int ldlm_intent_policy(struct ldlm_lock *lock, void *req_cookie, 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; diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index e5c35f0..36eb21b 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -23,7 +23,7 @@ extern int (*mds_getattr_name_p)(int offset, struct ptlrpc_request *req); 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; diff --git a/lustre/lib/l_net.c b/lustre/lib/l_net.c index 3f3e557..eb08b76 100644 --- a/lustre/lib/l_net.c +++ b/lustre/lib/l_net.c @@ -82,7 +82,7 @@ int target_handle_connect(struct ptlrpc_request *req) LBUG(); req->rq_export = export; - export->export_connection = req->rq_connection; + export->exp_connection = req->rq_connection; RETURN(0); } diff --git a/lustre/llite/super.c b/lustre/llite/super.c index d347486..0c78f00 100644 --- a/lustre/llite/super.c +++ b/lustre/llite/super.c @@ -119,8 +119,8 @@ static struct super_block * ll_read_super(struct super_block *sb, 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) { @@ -136,14 +136,14 @@ static struct super_block * ll_read_super(struct super_block *sb, } 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); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index c8d89bd..d22151b 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -26,8 +26,9 @@ extern struct obd_device obd_dev[MAX_OBD_DEVICES]; /* 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; @@ -36,8 +37,7 @@ static int lov_getinfo(struct obd_device *obd, struct lov_desc *desc, 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); @@ -71,88 +71,89 @@ static int lov_getinfo(struct obd_device *obd, struct lov_desc *desc, 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) @@ -241,16 +242,16 @@ static int lov_create(struct lustre_handle *conn, struct obdo *oa, struct lov_st 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) { @@ -300,10 +301,10 @@ struct lov_stripe_md *ea) 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++) { diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index f72b0eb..4ac843f 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -34,21 +34,21 @@ 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; } @@ -62,13 +62,13 @@ static int mdc_con2dlmcl(struct lustre_handle *conn, struct ptlrpc_client **cl, 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; } @@ -88,7 +88,7 @@ int mdc_getstatus(struct lustre_handle *conn, struct ll_fid *rootfid, 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); @@ -765,7 +765,7 @@ static int mdc_connect(struct lustre_handle *conn, struct obd_device *obd) 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: diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 6e48ccf..56c6226 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -31,7 +31,7 @@ static int mds_cleanup(struct obd_device * obddev); 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 */ @@ -377,7 +377,7 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req) __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) { @@ -1051,7 +1051,7 @@ static int mds_setup(struct obd_device *obddev, obd_count len, void *buf) 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); diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index 0957f3a..51d525a 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -234,7 +234,7 @@ static int mds_reint_create(struct mds_update_record *rec, int offset, 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); diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 493f5be..ed521eb 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -587,7 +587,7 @@ EXPORT_SYMBOL(class_uuid2dev); 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); diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 8d1db77..648cdfa 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -1,4 +1,6 @@ -/* +/* -*- 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. * @@ -111,8 +113,8 @@ int class_name2dev(char *name) 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]; @@ -220,24 +222,31 @@ int obd_init_caches(void) /* 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 */ @@ -247,7 +256,7 @@ struct obd_device *class_conn2obd(struct lustre_handle *conn) struct obd_export *export; export = class_conn2export(conn); if (export) - return export->export_obd; + return export->exp_obd; fixme(); return NULL; } @@ -265,35 +274,35 @@ int class_connect (struct lustre_handle *conn, struct obd_device *obd) } 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))) { @@ -302,13 +311,13 @@ int class_disconnect(struct lustre_handle *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 diff --git a/lustre/obdclass/proc_lustre.c b/lustre/obdclass/proc_lustre.c index 5c351c2..34601a5 100644 --- a/lustre/obdclass/proc_lustre.c +++ b/lustre/obdclass/proc_lustre.c @@ -61,31 +61,31 @@ static int read_lustre_status(char *page, char **start, off_t offset, 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 */ diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 1a68cb1..d35ce9f 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -30,19 +30,23 @@ static void osc_con2cl(struct lustre_handle *conn, struct ptlrpc_client **cl, 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) @@ -86,7 +90,7 @@ 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: diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 2b677e5..a1994997 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -181,7 +181,7 @@ static int handle_incoming_request(struct obd_device *obddev, 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); -- 1.8.3.1