From a2c7e343138a8d2863cd83a02e2454b6aa2e3568 Mon Sep 17 00:00:00 2001 From: rread Date: Fri, 31 Oct 2003 19:39:27 +0000 Subject: [PATCH] land zcfg on devel - includes changes from b_llogging - the MDS -> LOV connection is created using the MDS config log, so the log must exist. Lconf will create the log automatically when --reformat is used. To create the config logs on an existing filesystem, run lconf on the MDS with --write_conf. This only needs to be done on the MDS. - LOV does not connect to the MDS during setup. Instead, the MDS and MDC use obd_get_info("lovdesc") to get the stripe info. The LOVDESC and LOVTGTS files on the MDS are no longer used (and not created on new filesystems.) - Zeroconf clients are new support by lconf --zeroconf, and replay-single.sh uses this to mount the client. The exact arguments needed for zeroconf will be changing quickly, so don't use lconf --zeroconf in other scripts yet. Instead, once the dust clears, lconf will be changed to always do zeroconf mounts, and eventually when don't need lconf anymore is when we start changing the test scripts. --- lustre/include/linux/lustre_cfg.h | 12 ++- lustre/obdclass/llog_test.c | 78 +++++++++++------- lustre/obdclass/obd_config.c | 165 +++++++++++++++++++++++++++++++++----- lustre/osc/osc_create.c | 4 +- lustre/ptlrpc/llogd.c | 56 ++++++------- lustre/ptlrpc/ptlrpc_internal.h | 2 +- lustre/ptlrpc/ptlrpc_module.c | 19 ++--- lustre/utils/Lustre/cmdline.py | 5 ++ lustre/utils/lustre_cfg.c | 15 ++-- 9 files changed, 249 insertions(+), 107 deletions(-) diff --git a/lustre/include/linux/lustre_cfg.h b/lustre/include/linux/lustre_cfg.h index 6bc1070..9b6b58b 100644 --- a/lustre/include/linux/lustre_cfg.h +++ b/lustre/include/linux/lustre_cfg.h @@ -30,11 +30,10 @@ enum lcfg_command_type { LCFG_DETACH = 0x00cf002, LCFG_SETUP = 0x00cf003, LCFG_CLEANUP = 0x00cf004, - LCFG_LOV_SET_CONFIG = 0x00cf005, - LCFG_ADD_UUID = 0x00cf006, - LCFG_DEL_UUID = 0x00cf007, - LCFG_MOUNTOPT = 0x00cf008, - LCFG_DEL_MOUNTOPT = 0x00cf009, + LCFG_ADD_UUID = 0x00cf005, + LCFG_DEL_UUID = 0x00cf006, + LCFG_MOUNTOPT = 0x00cf007, + LCFG_DEL_MOUNTOPT = 0x00cf008, }; struct lustre_cfg { @@ -83,8 +82,7 @@ static inline int lustre_cfg_packlen(struct lustre_cfg *lcfg) len += size_round(lcfg->lcfg_inllen2); len += size_round(lcfg->lcfg_inllen3); len += size_round(lcfg->lcfg_inllen4); - return size_round16(len); - + return size_round(len); } static inline int lustre_cfg_pack(struct lustre_cfg *data, char **pbuf, diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c index 00c74e8..268330f 100644 --- a/lustre/obdclass/llog_test.c +++ b/lustre/obdclass/llog_test.c @@ -75,13 +75,15 @@ static int verify_handle(char * test, struct llog_handle *llh, int num_recs) static int llog_test_1(struct obd_device *obd, char * name) { struct llog_handle *llh; + struct llog_obd_ctxt *ctxt = obd->obd_llog_ctxt[LLOG_TEST_ORIG_CTXT]; int rc; int rc2; ENTRY; CERROR("1a: create a log with name: %s\n", name); + LASSERT(ctxt); - rc = llog_create(obd, &llh, NULL, name); + rc = llog_create(ctxt, &llh, NULL, name); if (rc) { CERROR("1a: llog_create with name %s failed: %d\n", name, rc); RETURN(rc); @@ -108,10 +110,11 @@ static int llog_test_2(struct obd_device *obd, char * name, struct llog_handle * struct llog_handle *loghandle; struct llog_logid logid; int rc; + struct llog_obd_ctxt *ctxt = obd->obd_llog_ctxt[LLOG_TEST_ORIG_CTXT]; ENTRY; CERROR("2a: re-open a log with name: %s\n", name); - rc = llog_create(obd, llh, NULL, name); + rc = llog_create(ctxt, llh, NULL, name); if (rc) { CERROR("2a: re-open log with name %s failed: %d\n", name, rc); RETURN(rc); @@ -122,7 +125,7 @@ static int llog_test_2(struct obd_device *obd, char * name, struct llog_handle * RETURN(rc); CERROR("2b: create a log without specified NAME & LOGID\n"); - rc = llog_create(obd, &loghandle, NULL, NULL); + rc = llog_create(ctxt, &loghandle, NULL, NULL); if (rc) { CERROR("2b: create log failed\n"); RETURN(rc); @@ -132,7 +135,7 @@ static int llog_test_2(struct obd_device *obd, char * name, struct llog_handle * llog_close(loghandle); CERROR("2b: re-open the log by LOGID\n"); - rc = llog_create(obd, &loghandle, &logid, NULL); + rc = llog_create(ctxt, &loghandle, &logid, NULL); if (rc) { CERROR("2b: re-open log by LOGID failed\n"); RETURN(rc); @@ -220,6 +223,7 @@ static int llog_test_4(struct obd_device *obd) int rc, i, buflen; struct llog_mini_rec lmr; struct llog_cookie cookie; + struct llog_obd_ctxt *ctxt = obd->obd_llog_ctxt[LLOG_TEST_ORIG_CTXT]; int num_recs = 0; char *buf; struct llog_rec_hdr rec; @@ -231,7 +235,7 @@ static int llog_test_4(struct obd_device *obd) sprintf(name, "%x", llog_test_rand+1); CERROR("4a: create a catalog log with name: %s\n", name); - rc = llog_create(obd, &cath, NULL, name); + rc = llog_create(ctxt, &cath, NULL, name); if (rc) { CERROR("1a: llog_create with name %s failed: %d\n", name, rc); GOTO(out, rc); @@ -358,6 +362,7 @@ static int llog_test_5(struct obd_device *obd) char name[10]; int rc; struct llog_mini_rec lmr; + struct llog_obd_ctxt *ctxt = obd->obd_llog_ctxt[LLOG_TEST_ORIG_CTXT]; ENTRY; @@ -365,7 +370,7 @@ static int llog_test_5(struct obd_device *obd) lmr.lmr_hdr.lrh_type = cpu_to_le32(0xf00f00); CERROR("5a: re-open catalog by id\n"); - rc = llog_create(obd, &llh, &cat_logid, NULL); + rc = llog_create(ctxt, &llh, &cat_logid, NULL); if (rc) { CERROR("5a: llog_create with logid failed: %d\n", rc); GOTO(out, rc); @@ -417,21 +422,17 @@ static int llog_test_5(struct obd_device *obd) RETURN(rc); } -static int llog_test6_process_rec(struct llog_handle *handle, - struct llog_rec_hdr * rec, void * private) -{ - return 0; -} - /* Test client api; open log by name and process */ static int llog_test_6(struct obd_device *obd, char * name) { struct obd_device *mdc_obd; - struct obd_uuid *mds_uuid = &obd->obd_log_exp->exp_obd->obd_uuid; + struct llog_obd_ctxt *ctxt = obd->obd_llog_ctxt[LLOG_TEST_ORIG_CTXT]; + struct obd_uuid *mds_uuid = &ctxt->loc_exp->exp_obd->obd_uuid; struct lustre_handle exph = {0, }; struct obd_export * exp; struct obd_uuid uuid = {"LLOG_TEST6_UUID"}; struct llog_handle *llh = NULL; + struct llog_obd_ctxt *nctxt; int rc; CERROR("6a: re-open log %s using client API\n", name); @@ -447,9 +448,10 @@ static int llog_test_6(struct obd_device *obd, char * name) CERROR("6: failed to connect to MDC: %s\n", mdc_obd->obd_name); RETURN(rc); } - exp = class_conn2export(&exph); - rc = llog_create(obd, &llh, NULL, name); + + nctxt = mdc_obd->obd_llog_ctxt[LLOG_CONFIG_REPL_CTXT]; + rc = llog_create(nctxt, &llh, NULL, name); if (rc) { CERROR("6: llog_create failed %d\n", rc); RETURN(rc); @@ -461,7 +463,7 @@ static int llog_test_6(struct obd_device *obd, char * name) GOTO(parse_out, rc); } - rc = llog_process(llh, llog_test6_process_rec, NULL); + rc = llog_process(llh, (llog_cb_t)plain_print_cb, NULL); parse_out: if (rc) CERROR("6: llog_process failed %d\n", rc); @@ -474,7 +476,6 @@ parse_out: rc = obd_disconnect(exp, 0); RETURN(rc); - } /* ------------------------------------------------------------------------- @@ -484,12 +485,13 @@ static int llog_run_tests(struct obd_device *obd) { struct llog_handle *llh; struct obd_run_ctxt saved; + struct llog_obd_ctxt *ctxt = obd->obd_llog_ctxt[LLOG_TEST_ORIG_CTXT]; int rc, err, cleanup_phase = 0; char name[10]; ENTRY; sprintf(name, "%x", llog_test_rand); - push_ctxt(&saved, &obd->obd_log_exp->exp_obd->obd_ctxt, NULL); + push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL); rc = llog_test_1(obd, name); if (rc) @@ -516,7 +518,6 @@ static int llog_run_tests(struct obd_device *obd) if (rc) GOTO(cleanup, rc); - GOTO(cleanup, rc); cleanup: switch (cleanup_phase) { case 1: @@ -526,26 +527,45 @@ static int llog_run_tests(struct obd_device *obd) if (!rc) rc = err; case 0: - pop_ctxt(&saved, &obd->obd_log_exp->exp_obd->obd_ctxt, NULL); + pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL); } return rc; } + +static int llog_test_llog_init(struct obd_device *obd, struct obd_device *tgt, + int count, struct llog_logid *logid) +{ + int rc; + ENTRY; + + rc = llog_setup(obd, LLOG_TEST_ORIG_CTXT, tgt, 0, NULL, &llog_lvfs_ops); + RETURN(rc); +} + +static int llog_test_llog_finish(struct obd_device *obd, int count) +{ + int rc; + ENTRY; + + rc = llog_cleanup(obd->obd_llog_ctxt[LLOG_TEST_ORIG_CTXT]); + RETURN(rc); +} + static int llog_test_cleanup(struct obd_device *obd, int flags) { - int rc = obd_disconnect(obd->obd_log_exp, 0); + int rc = obd_llog_finish(obd, 0); if (rc) - CERROR("failed to disconnect from log device: %d\n", rc); + CERROR("failed to llog_test_llog_finish: %d\n", rc); + return rc; } static int llog_test_setup(struct obd_device *obd, obd_count len, void *buf) { struct lustre_cfg *lcfg = buf; - struct lustre_handle exph = {0, }; struct obd_device *tgt; - struct obd_uuid fake_uuid = { "LLOG_TEST_UUID" }; int rc; ENTRY; @@ -561,12 +581,9 @@ static int llog_test_setup(struct obd_device *obd, obd_count len, void *buf) RETURN(-EINVAL); } - rc = obd_connect(&exph, tgt, &fake_uuid); - if (rc) { - CERROR("fail to connect to target device %d\n", lcfg->lcfg_dev); + rc = obd_llog_init(obd, tgt, 0, NULL); + if (rc) RETURN(rc); - } - obd->obd_log_exp = class_conn2export(&exph); llog_test_rand = ll_insecure_random_int(); @@ -595,6 +612,9 @@ static struct obd_ops llog_obd_ops = { o_detach: llog_test_detach, o_setup: llog_test_setup, o_cleanup: llog_test_cleanup, + o_llog_init: llog_test_llog_init, + o_llog_finish: llog_test_llog_finish, + }; static int __init llog_test_init(void) diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 31d67c5..a7e8e44 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -170,6 +170,7 @@ int class_attach(struct lustre_cfg *lcfg) int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg) { int err = 0; + struct obd_export *exp; ENTRY; /* have we attached a type to this device? */ @@ -188,11 +189,40 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg) atomic_set(&obd->obd_refcount, 0); err = obd_setup(obd, sizeof(*lcfg), lcfg); - if (!err) { - obd->obd_type->typ_refcnt++; - obd->obd_set_up = 1; - atomic_inc(&obd->obd_refcount); + if (err) { + RETURN(err); + } + + obd->obd_type->typ_refcnt++; + obd->obd_set_up = 1; + atomic_inc(&obd->obd_refcount); + + exp = class_new_export(obd); + if (exp == NULL) { + GOTO(err_cleanup, err = -ENOMEM); + } + memcpy(&exp->exp_client_uuid, &obd->obd_uuid, + sizeof(exp->exp_client_uuid)); + obd->obd_self_export = exp; + class_export_put(exp); + + if (OBT(obd) && OBP(obd, postsetup)) { + err = obd_postsetup(obd); + if (err) + GOTO(err_exp, err); } + + RETURN(err); + +err_exp: + class_unlink_export(obd->obd_self_export); + obd->obd_self_export = NULL; +err_cleanup: + obd->obd_stopping = 1; + obd_cleanup(obd, 0); + obd->obd_set_up = obd->obd_stopping = 0; + obd->obd_type->typ_refcnt--; + atomic_dec(&obd->obd_refcount); RETURN(err); } @@ -269,6 +299,9 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) if (err) RETURN(err); + LASSERT(obd->obd_self_export); + class_unlink_export(obd->obd_self_export); + if (atomic_read(&obd->obd_refcount) == 1 || flags & OBD_OPT_FORCE) { /* this will stop new connections, and need to @@ -286,7 +319,7 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) obd->obd_minor, obd, atomic_read(&obd->obd_refcount)); dump_exports(obd); - RETURN(-EBUSY); + GOTO(out, err = -EBUSY); } class_disconnect_exports(obd, flags); CDEBUG(D_IOCTL, @@ -307,6 +340,7 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) obd->obd_name); } +out: err = obd_cleanup(obd, flags); if (!err) { obd->obd_set_up = obd->obd_stopping = 0; @@ -317,9 +351,16 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) CERROR("%s still has refcount %d after " "cleanup.\n", obd->obd_name, atomic_read(&obd->obd_refcount)); + } else { + /* attempt to leave OBD in a usable state. */ + obd->obd_stopping = 0; + if (OBT(obd) && OBP(obd, postsetup)) { + obd_postsetup(obd); + } } RETURN(err); + } LIST_HEAD(lustre_profile_list); @@ -360,11 +401,13 @@ int class_add_profile(int proflen, char *prof, GOTO(out, err = -ENOMEM); memcpy(lprof->lp_osc, osc, osclen); - LASSERT(mdclen == (strlen(mdc) + 1)); - OBD_ALLOC(lprof->lp_mdc, mdclen); - if (lprof->lp_mdc == NULL) - GOTO(out, err = -ENOMEM); - memcpy(lprof->lp_mdc, mdc, mdclen); + if (mdclen > 0) { + LASSERT(mdclen == (strlen(mdc) + 1)); + OBD_ALLOC(lprof->lp_mdc, mdclen); + if (lprof->lp_mdc == NULL) + GOTO(out, err = -ENOMEM); + memcpy(lprof->lp_mdc, mdc, mdclen); + } list_add(&lprof->lp_list, &lustre_profile_list); @@ -381,7 +424,8 @@ void class_del_profile(char *prof) list_del(&lprof->lp_list); OBD_FREE(lprof->lp_profile, strlen(lprof->lp_profile) + 1); OBD_FREE(lprof->lp_osc, strlen(lprof->lp_osc) + 1); - OBD_FREE(lprof->lp_mdc, strlen(lprof->lp_mdc) + 1); + if (lprof->lp_mdc) + OBD_FREE(lprof->lp_mdc, strlen(lprof->lp_mdc) + 1); OBD_FREE(lprof, sizeof *lprof); } } @@ -443,7 +487,7 @@ int class_process_config(struct lustre_cfg *lcfg) /* Commands that require a device */ obd = class_name2obd(lcfg->lcfg_dev_name); if (obd == NULL) { - CERROR("no device\n"); + CERROR("no device for: %s\n", lcfg->lcfg_dev_name); GOTO(out, err = -EINVAL); } @@ -461,9 +505,9 @@ int class_process_config(struct lustre_cfg *lcfg) GOTO(out, err = 0); } default: { - err = obd_config(obd, lcfg); - if (err) - GOTO(out, err); + CERROR("Unknown command: %d\n", lcfg->lcfg_command); + GOTO(out, err = -EINVAL); + } } out: @@ -493,10 +537,12 @@ static int class_config_llog_handler(struct llog_handle * handle, GOTO(out, rc); lcfg = (struct lustre_cfg* ) buf; - if (cfg && lcfg->lcfg_dev_name) { + if (cfg && cfg->cfg_instance && lcfg->lcfg_dev_name) { inst_len = strlen(lcfg->lcfg_dev_name) + strlen(cfg->cfg_instance) + 2; OBD_ALLOC(inst_name, inst_len); + if (inst_name == NULL) + GOTO(out, rc = -ENOMEM); sprintf(inst_name, "%s-%s", lcfg->lcfg_dev_name, cfg->cfg_instance); old_name = lcfg->lcfg_dev_name; @@ -534,20 +580,21 @@ out: RETURN(rc); } -int class_config_parse_llog(struct obd_export *exp, char *name, +int class_config_parse_llog(struct llog_obd_ctxt *ctxt, char *name, struct config_llog_instance *cfg) { + struct obd_export *exp = ctxt->loc_exp; struct llog_handle *llh; - struct obd_device *obd = exp->exp_obd; int rc, rc2; ENTRY; - if (obd->obd_log_exp == NULL) { - CERROR("No log export on obd:%s\n", obd->obd_name); + if (exp == NULL) { + LBUG(); + CERROR("No log export on obd\n"); RETURN(-ENOTCONN); } - rc = llog_create(obd, &llh, NULL, name); + rc = llog_create(ctxt, &llh, NULL, name); if (rc) RETURN(rc); @@ -565,3 +612,79 @@ parse_out: } +static int class_config_dump_handler(struct llog_handle * handle, + struct llog_rec_hdr *rec, void *data) +{ + int cfg_len = rec->lrh_len; + char *cfg_buf = (char*) (rec + 1); + int rc = 0; + + if (rec->lrh_type == OBD_CFG_REC) { + char *buf; + struct lustre_cfg *lcfg; + + rc = lustre_cfg_getdata(&buf, cfg_len, cfg_buf, 1); + if (rc) + GOTO(out, rc); + lcfg = (struct lustre_cfg* ) buf; + + CDEBUG(D_INFO, "lcfg command: %x\n", lcfg->lcfg_command); + if (lcfg->lcfg_dev_name) + CDEBUG(D_INFO, " devname: %s\n", + lcfg->lcfg_dev_name); + if (lcfg->lcfg_flags) + CDEBUG(D_INFO, " flags: %x\n", lcfg->lcfg_flags); + if (lcfg->lcfg_nid) + CDEBUG(D_INFO, " nid: "LPX64"\n", + lcfg->lcfg_nid); + if (lcfg->lcfg_nal) + CDEBUG(D_INFO, " nal: %x\n", lcfg->lcfg_nal); + if (lcfg->lcfg_inlbuf1) + CDEBUG(D_INFO, " inlbuf1: %s\n",lcfg->lcfg_inlbuf1); + if (lcfg->lcfg_inlbuf2) + CDEBUG(D_INFO, " inlbuf1: %s\n",lcfg->lcfg_inlbuf2); + if (lcfg->lcfg_inlbuf3) + CDEBUG(D_INFO, " inlbuf1: %s\n",lcfg->lcfg_inlbuf3); + if (lcfg->lcfg_inlbuf4) + CDEBUG(D_INFO, " inlbuf1: %s\n",lcfg->lcfg_inlbuf4); + + lustre_cfg_freedata(buf, cfg_len); + } else if (rec->lrh_type == PTL_CFG_REC) { + ; + } +out: + RETURN(rc); +} + +int class_config_dump_llog(struct llog_obd_ctxt *ctxt, char *name, + struct config_llog_instance *cfg) +{ + struct obd_export *exp = ctxt->loc_exp; + struct llog_handle *llh; + int rc, rc2; + ENTRY; + + if (exp == NULL) { + LBUG(); + CERROR("No log export on obd\n"); + RETURN(-ENOTCONN); + } + + rc = llog_create(ctxt, &llh, NULL, name); + if (rc) + RETURN(rc); + + rc = llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL); + if (rc) + GOTO(parse_out, rc); + + rc = llog_process(llh, class_config_dump_handler, cfg); +parse_out: + rc2 = llog_close(llh); + if (rc == 0) + rc = rc2; + + RETURN(rc); + +} + diff --git a/lustre/osc/osc_create.c b/lustre/osc/osc_create.c index c52ad4b..015b2ca 100644 --- a/lustre/osc/osc_create.c +++ b/lustre/osc/osc_create.c @@ -263,8 +263,8 @@ void oscc_init(struct obd_export *exp) spin_lock_init(&oed->oed_oscc.oscc_lock); oed->oed_oscc.oscc_exp = exp; oed->oed_oscc.oscc_kick_barrier = 100; - oed->oed_oscc.oscc_grow_count = 2000; - oed->oed_oscc.oscc_initial_create_count = 2000; + oed->oed_oscc.oscc_grow_count = 20; + oed->oed_oscc.oscc_initial_create_count = 20; oed->oed_oscc.oscc_next_id = 2; oed->oed_oscc.oscc_last_id = 1; diff --git a/lustre/ptlrpc/llogd.c b/lustre/ptlrpc/llogd.c index f1864f8..092b99a 100644 --- a/lustre/ptlrpc/llogd.c +++ b/lustre/ptlrpc/llogd.c @@ -5,7 +5,7 @@ * Author: Andreas Dilger * * This file is part of Lustre, http://www.lustre.org. - * +n * * Lustre is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. @@ -35,7 +35,7 @@ #include #include -int llogd_create(struct ptlrpc_request *req) +int llog_origin_handle_create(struct ptlrpc_request *req) { struct obd_export *exp = req->rq_export; struct obd_device *obd = exp->exp_obd; @@ -43,13 +43,12 @@ int llogd_create(struct ptlrpc_request *req) struct llogd_body *body; struct obd_run_ctxt saved; struct llog_logid *logid = NULL; + struct llog_obd_ctxt *ctxt; char * name = NULL; int size = sizeof (*body); int rc, rc2; ENTRY; - LASSERT(obd->obd_log_exp != NULL); - body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_llogd_body); if (body == NULL) { @@ -70,7 +69,8 @@ int llogd_create(struct ptlrpc_request *req) push_ctxt(&saved, &obd->obd_ctxt, NULL); - rc = llog_create(obd, &loghandle, logid, name); + ctxt = obd->obd_llog_ctxt[LLOG_CONFIG_ORIG_CTXT]; + rc = llog_create(ctxt, &loghandle, logid, name); if (rc) GOTO(out_pop, rc); @@ -91,13 +91,14 @@ out: RETURN(rc); } -int llogd_next_block(struct ptlrpc_request *req) +int llog_origin_handle_next_block(struct ptlrpc_request *req) { struct obd_export *exp = req->rq_export; struct obd_device *obd = exp->exp_obd; struct llog_handle *loghandle; struct llogd_body *body; struct obd_run_ctxt saved; + struct llog_obd_ctxt *ctxt; __u8 *buf; void * ptr; int size[] = {sizeof (*body), @@ -105,8 +106,6 @@ int llogd_next_block(struct ptlrpc_request *req) int rc, rc2; ENTRY; - LASSERT(obd->obd_log_exp != NULL); - body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_llogd_body); if (body == NULL) { @@ -120,7 +119,8 @@ int llogd_next_block(struct ptlrpc_request *req) push_ctxt(&saved, &obd->obd_ctxt, NULL); - rc = llog_create(obd, &loghandle, &body->lgd_logid, NULL); + ctxt = obd->obd_llog_ctxt[LLOG_CONFIG_ORIG_CTXT]; + rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL); if (rc) GOTO(out_pop, rc); @@ -158,7 +158,7 @@ out: RETURN(rc); } -int llogd_read_header(struct ptlrpc_request *req) +int llog_origin_handle_read_header(struct ptlrpc_request *req) { struct obd_export *exp = req->rq_export; struct obd_device *obd = exp->exp_obd; @@ -166,13 +166,12 @@ int llogd_read_header(struct ptlrpc_request *req) struct llogd_body *body; struct llog_log_hdr *hdr; struct obd_run_ctxt saved; + struct llog_obd_ctxt *ctxt; __u8 *buf; int size[] = {sizeof (*hdr)}; int rc, rc2; ENTRY; - LASSERT(obd->obd_log_exp != NULL); - body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_llogd_body); if (body == NULL) { @@ -186,7 +185,8 @@ int llogd_read_header(struct ptlrpc_request *req) push_ctxt(&saved, &obd->obd_ctxt, NULL); - rc = llog_create(obd, &loghandle, &body->lgd_logid, NULL); + ctxt = obd->obd_llog_ctxt[LLOG_CONFIG_ORIG_CTXT]; + rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL); if (rc) GOTO(out_pop, rc); @@ -216,7 +216,7 @@ out: RETURN(rc); } -int llogd_close(struct ptlrpc_request *req) +int llog_origin_handle_close(struct ptlrpc_request *req) { int rc; @@ -228,9 +228,10 @@ int llogd_close(struct ptlrpc_request *req) /* This is a callback from the llog_* functions. * Assumes caller has already pushed us into the kernel context. */ -int llogd_client_create(struct obd_device *obd, struct llog_handle **res, +int llog_client_create(struct llog_obd_ctxt *ctxt, struct llog_handle **res, struct llog_logid *logid, char *name) { + struct obd_device *obd = ctxt->loc_obd; struct client_obd *cli = &obd->u.cli; struct obd_import *imp = cli->cl_import; struct llogd_body req_body; @@ -259,7 +260,7 @@ int llogd_client_create(struct obd_device *obd, struct llog_handle **res, bufcount++; } - req = ptlrpc_prep_req(imp, LLOGD_CREATE, bufcount, size, tmp); + req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_CREATE, bufcount, size, tmp); if (!req) GOTO(err_free, rc = -ENOMEM); @@ -277,11 +278,12 @@ int llogd_client_create(struct obd_device *obd, struct llog_handle **res, handle->lgh_id = body->lgd_logid; handle->lgh_obd = obd; + handle->lgh_ctxt = ctxt; out: if (req) ptlrpc_req_finished(req); - RETURN(0); + RETURN(rc); err_free: llog_free_handle(handle); @@ -295,7 +297,7 @@ struct obd_import *llog_lgh2imp(struct llog_handle *lgh) return cli->cl_import; } -int llogd_client_next_block(struct llog_handle *loghandle, +int llog_client_next_block(struct llog_handle *loghandle, int *cur_idx, int next_idx, __u64 *cur_offset, void *buf, int len) { @@ -308,7 +310,7 @@ int llogd_client_next_block(struct llog_handle *loghandle, int rc; ENTRY; - req = ptlrpc_prep_req(imp, LLOGD_NEXT_BLOCK, 1, &size, NULL); + req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_NEXT_BLOCK, 1, &size, NULL); if (!req) GOTO(out, rc = -ENOMEM); @@ -350,7 +352,7 @@ out: } -int llogd_client_read_header(struct llog_handle *handle) +int llog_client_read_header(struct llog_handle *handle) { struct obd_import *imp = llog_lgh2imp(handle); struct ptlrpc_request *req = NULL; @@ -361,7 +363,7 @@ int llogd_client_read_header(struct llog_handle *handle) int rc; ENTRY; - req = ptlrpc_prep_req(imp, LLOGD_READ_HEADER, 1, &size, NULL); + req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_READ_HEADER, 1, &size, NULL); if (!req) GOTO(out, rc = -ENOMEM); @@ -387,7 +389,7 @@ out: RETURN(rc); } -int llogd_client_close(struct llog_handle *handle) +int llog_client_close(struct llog_handle *handle) { int rc = 0; @@ -395,9 +397,9 @@ int llogd_client_close(struct llog_handle *handle) } -struct llog_operations llogd_client_ops = { - lop_next_block: llogd_client_next_block, - lop_read_header: llogd_client_read_header, - lop_create: llogd_client_create, - lop_close: llogd_client_close, +struct llog_operations llog_client_ops = { + lop_next_block: llog_client_next_block, + lop_read_header: llog_client_read_header, + lop_create: llog_client_create, + lop_close: llog_client_close, }; diff --git a/lustre/ptlrpc/ptlrpc_internal.h b/lustre/ptlrpc/ptlrpc_internal.h index cdf6f69..98ebe2f 100644 --- a/lustre/ptlrpc/ptlrpc_internal.h +++ b/lustre/ptlrpc/ptlrpc_internal.h @@ -42,7 +42,7 @@ void ptlrpc_daemonize(void); void ptlrpc_request_handle_notconn(struct ptlrpc_request *); void lustre_assert_wire_constants(void); -void ptlrpc_lprocfs_register_service(struct obd_device *obddev, +void ptlrpc_lprocfs_register_service(struct proc_dir_entry *proc_entry, struct ptlrpc_service *svc); void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc); void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req); diff --git a/lustre/ptlrpc/ptlrpc_module.c b/lustre/ptlrpc/ptlrpc_module.c index 3b7ecc7..7a66458 100644 --- a/lustre/ptlrpc/ptlrpc_module.c +++ b/lustre/ptlrpc/ptlrpc_module.c @@ -183,6 +183,7 @@ EXPORT_SYMBOL(ptlrpc_interrupted_set); /* service.c */ EXPORT_SYMBOL(ptlrpc_init_svc); EXPORT_SYMBOL(ptlrpc_stop_all_threads); +EXPORT_SYMBOL(ptlrpc_start_n_threads); EXPORT_SYMBOL(ptlrpc_start_thread); EXPORT_SYMBOL(ptlrpc_unregister_service); @@ -238,10 +239,6 @@ EXPORT_SYMBOL(ptlrpc_fail_import); EXPORT_SYMBOL(ptlrpc_fail_export); EXPORT_SYMBOL(ptlrpc_recover_import); -/*ptlrpc_lib.c*/ -EXPORT_SYMBOL(client_obd_setup); -EXPORT_SYMBOL(client_obd_cleanup); - /* pinger.c */ EXPORT_SYMBOL(ptlrpc_pinger_add_import); EXPORT_SYMBOL(ptlrpc_pinger_del_import); @@ -252,15 +249,11 @@ EXPORT_SYMBOL(ptlrpc_lprocfs_register_obd); EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd); /* llogd.c */ -EXPORT_SYMBOL(llogd_create); -EXPORT_SYMBOL(llogd_next_block); -EXPORT_SYMBOL(llogd_read_header); -EXPORT_SYMBOL(llogd_close); -EXPORT_SYMBOL(llogd_client_create); -EXPORT_SYMBOL(llogd_client_next_block); -EXPORT_SYMBOL(llogd_client_read_header); -EXPORT_SYMBOL(llogd_client_close); -EXPORT_SYMBOL(llogd_client_ops); +EXPORT_SYMBOL(llog_origin_handle_create); +EXPORT_SYMBOL(llog_origin_handle_next_block); +EXPORT_SYMBOL(llog_origin_handle_read_header); +EXPORT_SYMBOL(llog_origin_handle_close); +EXPORT_SYMBOL(llog_client_ops); #ifdef __KERNEL__ MODULE_AUTHOR("Cluster File Systems, Inc. "); diff --git a/lustre/utils/Lustre/cmdline.py b/lustre/utils/Lustre/cmdline.py index 4f15cc3..9da69f7 100644 --- a/lustre/utils/Lustre/cmdline.py +++ b/lustre/utils/Lustre/cmdline.py @@ -125,6 +125,11 @@ class Options: return self.values[name] else: raise error.OptionError("bad option name: " + name) + def __getitem__(self, name): + if self.values.has_key(name): + return self.values[name] + else: + raise error.OptionError("bad option name: " + name) def __setattr__(self, name, value): self.values[name] = value diff --git a/lustre/utils/lustre_cfg.c b/lustre/utils/lustre_cfg.c index edc0f88..6709552 100644 --- a/lustre/utils/lustre_cfg.c +++ b/lustre/utils/lustre_cfg.c @@ -305,7 +305,7 @@ int jt_lcfg_del_uuid(int argc, char **argv) return 0; } -int jt_lcfg_lov_setconfig(int argc, char **argv) +int jt_lcfg_lov_setup(int argc, char **argv) { struct lustre_cfg lcfg; struct lov_desc desc; @@ -313,7 +313,7 @@ int jt_lcfg_lov_setconfig(int argc, char **argv) int rc, i; char *end; - LCFG_INIT(lcfg, LCFG_LOV_SET_CONFIG, lcfg_devname); + LCFG_INIT(lcfg, LCFG_SETUP, lcfg_devname); if (argc <= 6) return CMD_HELP; @@ -417,7 +417,7 @@ int jt_lcfg_mount_option(int argc, char **argv) LCFG_INIT(lcfg, LCFG_MOUNTOPT, lcfg_devname); - if (argc != 4) + if (argc < 3 || argc > 4) return CMD_HELP; /* profile name */ @@ -426,10 +426,11 @@ int jt_lcfg_mount_option(int argc, char **argv) /* osc name */ lcfg.lcfg_inllen2 = strlen(argv[2]) + 1; lcfg.lcfg_inlbuf2 = argv[2]; - /* mdc name */ - lcfg.lcfg_inllen3 = strlen(argv[3]) + 1; - lcfg.lcfg_inlbuf3 = argv[3]; - + if (argc == 4) { + /* mdc name */ + lcfg.lcfg_inllen3 = strlen(argv[3]) + 1; + lcfg.lcfg_inlbuf3 = argv[3]; + } rc = lcfg_ioctl(argv[0], OBD_DEV_ID, &lcfg); if (rc < 0) { fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]), -- 1.8.3.1