From 073c8cd89217b5e26ba855a1b37dd6808c6a4a2a Mon Sep 17 00:00:00 2001 From: rread Date: Fri, 31 Oct 2003 19:39:23 +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. --- lnet/include/linux/kp30.h | 1 + lnet/include/linux/portals_lib.h | 5 + lnet/libcfs/module.c | 126 +++++++++---- lnet/utils/portals.c | 60 +++---- lustre/ldlm/ldlm_internal.h | 11 ++ lustre/ldlm/ldlm_lib.c | 181 ++++++++++++++++++- lustre/llite/llite_internal.h | 2 +- lustre/lov/lov_internal.h | 21 +-- lustre/lov/lov_log.c | 116 ++++++++---- lustre/mds/mds_internal.h | 30 +--- lustre/mds/mds_log.c | 107 ++++++++--- lustre/mgmt/mgmt_svc.c | 19 +- lustre/obdclass/llog_obd.c | 278 +++++++++++++---------------- lustre/obdfilter/filter_log.c | 3 +- lustre/portals/include/linux/kp30.h | 1 + lustre/portals/include/linux/portals_lib.h | 5 + lustre/portals/libcfs/module.c | 126 +++++++++---- lustre/portals/utils/portals.c | 60 +++---- lustre/ptlrpc/llog_net.c | 72 ++------ lustre/ptlrpc/ptlrpc_lib.c | 4 +- lustre/tests/replay-single.sh | 20 ++- lustre/utils/wirecheck.c | 11 +- lustre/utils/wiretest.c | 11 +- 23 files changed, 772 insertions(+), 498 deletions(-) diff --git a/lnet/include/linux/kp30.h b/lnet/include/linux/kp30.h index 9656c83..f152725 100644 --- a/lnet/include/linux/kp30.h +++ b/lnet/include/linux/kp30.h @@ -1033,6 +1033,7 @@ enum { TOENAL, TCPNAL, SCIMACNAL, + ROUTER, NAL_ENUM_END_MARKER }; diff --git a/lnet/include/linux/portals_lib.h b/lnet/include/linux/portals_lib.h index 14d60c6..609290d 100644 --- a/lnet/include/linux/portals_lib.h +++ b/lnet/include/linux/portals_lib.h @@ -47,6 +47,11 @@ static inline int size_round16(int val) return (val + 0xf) & (~0xf); } +static inline int size_round32(int val) +{ + return (val + 0x1f) & (~0x1f); +} + static inline int size_round0(int val) { if (!val) diff --git a/lnet/libcfs/module.c b/lnet/libcfs/module.c index bfa959d..d233903 100644 --- a/lnet/libcfs/module.c +++ b/lnet/libcfs/module.c @@ -210,6 +210,84 @@ kportal_get_route(int index, __u32 *gateway_nalidp, ptl_nid_t *gateway_nidp, return (rc); } +static int +kportal_router_cmd(struct portals_cfg *pcfg, void * private) +{ + int err; + ENTRY; + + switch(pcfg->pcfg_command) { + case IOC_PORTAL_ADD_ROUTE: + CDEBUG(D_IOCTL, "Adding route: [%d] "LPU64" : "LPU64" - "LPU64"\n", + pcfg->pcfg_nal, pcfg->pcfg_nid, + pcfg->pcfg_nid2, pcfg->pcfg_nid3); + err = kportal_add_route(pcfg->pcfg_nal, pcfg->pcfg_nid, + pcfg->pcfg_nid2, pcfg->pcfg_nid3); + break; + + case IOC_PORTAL_DEL_ROUTE: + CDEBUG (D_IOCTL, "Removing routes via [%d] "LPU64" : "LPU64" - "LPU64"\n", + pcfg->pcfg_nal, pcfg->pcfg_nid, + pcfg->pcfg_nid2, pcfg->pcfg_nid3); + err = kportal_del_route (pcfg->pcfg_nal, pcfg->pcfg_nid, + pcfg->pcfg_nid2, pcfg->pcfg_nid3); + break; + + case IOC_PORTAL_NOTIFY_ROUTER: { + CDEBUG (D_IOCTL, "Notifying peer [%d] "LPU64" %s @ %ld\n", + pcfg->pcfg_nal, pcfg->pcfg_nid, + pcfg->pcfg_flags ? "Enabling" : "Disabling", + (time_t)pcfg->pcfg_nid3); + + err = kportal_notify_router (pcfg->pcfg_nal, pcfg->pcfg_nid, + pcfg->pcfg_flags, + (time_t)pcfg->pcfg_nid3); + break; + } + + case IOC_PORTAL_GET_ROUTE: + CDEBUG (D_IOCTL, "Getting route [%d]\n", pcfg->pcfg_count); + err = kportal_get_route(pcfg->pcfg_count, &pcfg->pcfg_nal, + &pcfg->pcfg_nid, + &pcfg->pcfg_nid2, &pcfg->pcfg_nid3, + &pcfg->pcfg_flags); + break; + } + RETURN(err); +} + +static int +kportal_register_router (void) +{ + int rc; + kpr_control_interface_t *ci; + + ci = (kpr_control_interface_t *)PORTAL_SYMBOL_GET(kpr_control_interface); + if (ci == NULL) + return (0); + + rc = kportal_nal_register(ROUTER, kportal_router_cmd, NULL); + + PORTAL_SYMBOL_PUT(kpr_control_interface); + return (rc); +} + +static int +kportal_unregister_router (void) +{ + int rc; + kpr_control_interface_t *ci; + + ci = (kpr_control_interface_t *)PORTAL_SYMBOL_GET(kpr_control_interface); + if (ci == NULL) + return (0); + + rc = kportal_nal_unregister(ROUTER); + + PORTAL_SYMBOL_PUT(kpr_control_interface); + return (rc); +} + int kportal_nal_cmd(struct portals_cfg *pcfg) { @@ -393,45 +471,6 @@ static int kportal_ioctl(struct inode *inode, struct file *file, RETURN(0); } - case IOC_PORTAL_ADD_ROUTE: - CDEBUG(D_IOCTL, "Adding route: [%d] "LPU64" : "LPU64" - "LPU64"\n", - data->ioc_nal, data->ioc_nid, - data->ioc_nid2, data->ioc_nid3); - err = kportal_add_route(data->ioc_nal, data->ioc_nid, - data->ioc_nid2, data->ioc_nid3); - break; - - case IOC_PORTAL_DEL_ROUTE: - CDEBUG (D_IOCTL, "Removing routes via [%d] "LPU64" : "LPU64" - "LPU64"\n", - data->ioc_nal, data->ioc_nid, - data->ioc_nid2, data->ioc_nid3); - err = kportal_del_route (data->ioc_nal, data->ioc_nid, - data->ioc_nid2, data->ioc_nid3); - break; - - case IOC_PORTAL_NOTIFY_ROUTER: { - CDEBUG (D_IOCTL, "Notifying peer [%d] "LPU64" %s @ %ld\n", - data->ioc_nal, data->ioc_nid, - data->ioc_flags ? "Enabling" : "Disabling", - (time_t)data->ioc_nid3); - - err = kportal_notify_router (data->ioc_nal, data->ioc_nid, - data->ioc_flags, - (time_t)data->ioc_nid3); - break; - } - - case IOC_PORTAL_GET_ROUTE: - CDEBUG (D_IOCTL, "Getting route [%d]\n", data->ioc_count); - err = kportal_get_route(data->ioc_count, &data->ioc_nal, - &data->ioc_nid, - &data->ioc_nid2, &data->ioc_nid3, - &data->ioc_flags); - if (err == 0) - if (copy_to_user((char *)arg, data, sizeof (*data))) - err = -EFAULT; - break; - case IOC_PORTAL_GET_NID: { const ptl_handle_ni_t *nip; ptl_process_id_t pid; @@ -575,9 +614,17 @@ static int init_kportals_module(void) goto cleanup_fini; } + rc = kportal_register_router(); + if (rc) { + CERROR("kportals_register_router: error %d\n", rc); + goto cleanup_proc; + } + CDEBUG (D_OTHER, "portals setup OK\n"); return (0); + cleanup_proc: + remove_proc(); cleanup_fini: PtlFini(); cleanup_deregister: @@ -595,6 +642,7 @@ static void exit_kportals_module(void) { int rc; + kportal_unregister_router(); remove_proc(); PtlFini(); diff --git a/lnet/utils/portals.c b/lnet/utils/portals.c index 23f2a5f..270a840 100644 --- a/lnet/utils/portals.c +++ b/lnet/utils/portals.c @@ -1224,7 +1224,7 @@ jt_ptl_nagle (int argc, char **argv) int jt_ptl_add_route (int argc, char **argv) { - struct portal_ioctl_data data; + struct portals_cfg pcfg; ptl_nid_t nid1; ptl_nid_t nid2; ptl_nid_t gateway_nid; @@ -1259,13 +1259,13 @@ jt_ptl_add_route (int argc, char **argv) return (-1); } - PORTAL_IOC_INIT(data); - data.ioc_nid = gateway_nid; - data.ioc_nal = g_nal; - data.ioc_nid2 = MIN (nid1, nid2); - data.ioc_nid3 = MAX (nid1, nid2); + PCFG_INIT(pcfg, IOC_PORTAL_ADD_ROUTE); + pcfg.pcfg_nid = gateway_nid; + pcfg.pcfg_nal = g_nal; + pcfg.pcfg_nid2 = MIN (nid1, nid2); + pcfg.pcfg_nid3 = MAX (nid1, nid2); - rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_ADD_ROUTE, &data); + rc = pcfg_ioctl(&pcfg); if (rc != 0) { fprintf (stderr, "IOC_PORTAL_ADD_ROUTE failed: %s\n", strerror (errno)); @@ -1278,7 +1278,7 @@ jt_ptl_add_route (int argc, char **argv) int jt_ptl_del_route (int argc, char **argv) { - struct portal_ioctl_data data; + struct portals_cfg pcfg; ptl_nid_t nid; ptl_nid_t nid1 = PTL_NID_ANY; ptl_nid_t nid2 = PTL_NID_ANY; @@ -1322,13 +1322,13 @@ jt_ptl_del_route (int argc, char **argv) } } - PORTAL_IOC_INIT(data); - data.ioc_nal = g_nal; - data.ioc_nid = nid; - data.ioc_nid2 = nid1; - data.ioc_nid3 = nid2; + PCFG_INIT(pcfg, IOC_PORTAL_DEL_ROUTE); + pcfg.pcfg_nal = g_nal; + pcfg.pcfg_nid = nid; + pcfg.pcfg_nid2 = nid1; + pcfg.pcfg_nid3 = nid2; - rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_DEL_ROUTE, &data); + rc = pcfg_ioctl(&pcfg); if (rc != 0) { fprintf (stderr, "IOC_PORTAL_DEL_ROUTE ("LPX64") failed: %s\n", nid, strerror (errno)); @@ -1341,7 +1341,7 @@ jt_ptl_del_route (int argc, char **argv) int jt_ptl_notify_router (int argc, char **argv) { - struct portal_ioctl_data data; + struct portals_cfg pcfg; int enable; ptl_nid_t nid; int rc; @@ -1381,14 +1381,14 @@ jt_ptl_notify_router (int argc, char **argv) return (-1); } - PORTAL_IOC_INIT(data); - data.ioc_nal = g_nal; - data.ioc_nid = nid; - data.ioc_flags = enable; + PCFG_INIT(pcfg, IOC_PORTAL_NOTIFY_ROUTER); + pcfg.pcfg_nal = g_nal; + pcfg.pcfg_nid = nid; + pcfg.pcfg_flags = enable; /* Yeuch; 'cept I need a __u64 on 64 bit machines... */ - data.ioc_nid3 = (__u64)when; + pcfg.pcfg_nid3 = (__u64)when; - rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_NOTIFY_ROUTER, &data); + rc = pcfg_ioctl(&pcfg); if (rc != 0) { fprintf (stderr, "IOC_PORTAL_NOTIFY_ROUTER ("LPX64") failed: %s\n", @@ -1403,7 +1403,7 @@ int jt_ptl_print_routes (int argc, char **argv) { char buffer[3][128]; - struct portal_ioctl_data data; + struct portals_cfg pcfg; int rc; int index; int gateway_nal; @@ -1414,18 +1414,18 @@ jt_ptl_print_routes (int argc, char **argv) for (index = 0;;index++) { - PORTAL_IOC_INIT(data); - data.ioc_count = index; + PCFG_INIT(pcfg, IOC_PORTAL_GET_ROUTE); + pcfg.pcfg_count = index; - rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_GET_ROUTE, &data); + rc = pcfg_ioctl(&pcfg); if (rc != 0) break; - gateway_nal = data.ioc_nal; - gateway_nid = data.ioc_nid; - nid1 = data.ioc_nid2; - nid2 = data.ioc_nid3; - alive = data.ioc_flags; + gateway_nal = pcfg.pcfg_nal; + gateway_nid = pcfg.pcfg_nid; + nid1 = pcfg.pcfg_nid2; + nid2 = pcfg.pcfg_nid3; + alive = pcfg.pcfg_flags; printf ("%8s %18s : %s - %s, %s\n", nal2name (gateway_nal), diff --git a/lustre/ldlm/ldlm_internal.h b/lustre/ldlm/ldlm_internal.h index ffd74e3..3b5ce78 100644 --- a/lustre/ldlm/ldlm_internal.h +++ b/lustre/ldlm/ldlm_internal.h @@ -32,3 +32,14 @@ int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq, /* ldlm_flock.c */ int ldlm_process_flock_lock(struct ldlm_lock *lock, int *flags, int first_enq, ldlm_error_t *err); + +extern struct proc_dir_entry *ldlm_svc_proc_dir; + +struct ldlm_state { + struct ptlrpc_service *ldlm_cb_service; + struct ptlrpc_service *ldlm_cancel_service; + struct ptlrpc_client *ldlm_client; + struct ptlrpc_connection *ldlm_server_conn; + struct ldlm_bl_pool *ldlm_bl_pool; +}; + diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index c327f08..d956bad 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -29,11 +29,191 @@ #else # include #endif +#include #include +#include #include #include #include +int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) +{ + struct ptlrpc_connection *conn; + struct lustre_cfg* lcfg = buf; + struct client_obd *cli = &obddev->u.cli; + struct obd_import *imp; + struct obd_uuid server_uuid; + int rq_portal, rp_portal, connect_op; + char *name = obddev->obd_type->typ_name; + char *mgmt_name = NULL; + int rc = 0; + struct obd_device *mgmt_obd; + mgmtcli_register_for_events_t register_f; + ENTRY; + + /* In a more perfect world, we would hang a ptlrpc_client off of + * obd_type and just use the values from there. */ + if (!strcmp(name, LUSTRE_OSC_NAME)) { + rq_portal = OST_REQUEST_PORTAL; + rp_portal = OSC_REPLY_PORTAL; + connect_op = OST_CONNECT; + } else if (!strcmp(name, LUSTRE_MDC_NAME)) { + rq_portal = MDS_REQUEST_PORTAL; + rp_portal = MDC_REPLY_PORTAL; + connect_op = MDS_CONNECT; + } else if (!strcmp(name, LUSTRE_MGMTCLI_NAME)) { + rq_portal = MGMT_REQUEST_PORTAL; + rp_portal = MGMT_REPLY_PORTAL; + connect_op = MGMT_CONNECT; + } else { + CERROR("unknown client OBD type \"%s\", can't setup\n", + name); + RETURN(-EINVAL); + } + + if (lcfg->lcfg_inllen1 < 1) { + CERROR("requires a TARGET UUID\n"); + RETURN(-EINVAL); + } + + if (lcfg->lcfg_inllen1 > 37) { + CERROR("client UUID must be less than 38 characters\n"); + RETURN(-EINVAL); + } + + if (lcfg->lcfg_inllen2 < 1) { + CERROR("setup requires a SERVER UUID\n"); + RETURN(-EINVAL); + } + + if (lcfg->lcfg_inllen2 > 37) { + CERROR("target UUID must be less than 38 characters\n"); + RETURN(-EINVAL); + } + + sema_init(&cli->cl_sem, 1); + cli->cl_conn_count = 0; + memcpy(server_uuid.uuid, lcfg->lcfg_inlbuf2, MIN(lcfg->lcfg_inllen2, + sizeof(server_uuid))); + + init_MUTEX(&cli->cl_dirty_sem); + cli->cl_dirty = 0; + cli->cl_dirty_granted = 0; + cli->cl_dirty_max = 64*1024*1024; /* some default */ + cli->cl_ost_can_grant = 1; + INIT_LIST_HEAD(&cli->cl_cache_waiters); + INIT_LIST_HEAD(&cli->cl_loi_ready_list); + spin_lock_init(&cli->cl_loi_list_lock); + cli->cl_brw_in_flight = 0; + spin_lock_init(&cli->cl_rpc_concurrency_oh.oh_lock); + spin_lock_init(&cli->cl_pages_per_rpc_oh.oh_lock); + cli->cl_max_pages_per_rpc = PTL_MD_MAX_IOV; + cli->cl_max_rpcs_in_flight = 8; + + ldlm_get_ref(); + if (rc) { + CERROR("ldlm_get_ref failed: %d\n", rc); + GOTO(err, rc); + } + + conn = ptlrpc_uuid_to_connection(&server_uuid); + if (conn == NULL) + GOTO(err_ldlm, rc = -ENOENT); + + ptlrpc_init_client(rq_portal, rp_portal, name, + &obddev->obd_ldlm_client); + + imp = class_new_import(); + if (imp == NULL) { + ptlrpc_put_connection(conn); + GOTO(err_ldlm, rc = -ENOENT); + } + imp->imp_connection = conn; + imp->imp_client = &obddev->obd_ldlm_client; + imp->imp_obd = obddev; + imp->imp_connect_op = connect_op; + imp->imp_generation = 0; + INIT_LIST_HEAD(&imp->imp_pinger_chain); + memcpy(imp->imp_target_uuid.uuid, lcfg->lcfg_inlbuf1, + lcfg->lcfg_inllen1); + class_import_put(imp); + + cli->cl_import = imp; + cli->cl_max_mds_easize = sizeof(struct lov_mds_md); + cli->cl_max_mds_cookiesize = sizeof(struct llog_cookie); + cli->cl_sandev = to_kdev_t(0); + + if (lcfg->lcfg_inllen3 != 0) { + if (!strcmp(lcfg->lcfg_inlbuf3, "inactive")) { + CDEBUG(D_HA, "marking %s %s->%s as inactive\n", + name, obddev->obd_name, + imp->imp_target_uuid.uuid); + imp->imp_invalid = 1; + + if (lcfg->lcfg_inllen4 != 0) + mgmt_name = lcfg->lcfg_inlbuf4; + } else { + mgmt_name = lcfg->lcfg_inlbuf3; + } + } + + if (mgmt_name != NULL) { + /* Register with management client if we need to. */ + CDEBUG(D_HA, "%s registering with %s for events about %s\n", + obddev->obd_name, mgmt_name, server_uuid.uuid); + + mgmt_obd = class_name2obd(mgmt_name); + if (!mgmt_obd) { + CERROR("can't find mgmtcli %s to register\n", + mgmt_name); + GOTO(err_import, rc = -ENOSYS); + } + + register_f = inter_module_get("mgmtcli_register_for_events"); + if (!register_f) { + CERROR("can't i_m_g mgmtcli_register_for_events\n"); + GOTO(err_import, rc = -ENOSYS); + } + + rc = register_f(mgmt_obd, obddev, &imp->imp_target_uuid); + inter_module_put("mgmtcli_register_for_events"); + + if (!rc) + cli->cl_mgmtcli_obd = mgmt_obd; + } + + RETURN(rc); + +err_import: + class_destroy_import(imp); +err_ldlm: + ldlm_put_ref(); +err: + RETURN(rc); + +} + +int client_obd_cleanup(struct obd_device *obddev, int flags) +{ + struct client_obd *cli = &obddev->u.cli; + + if (!cli->cl_import) + RETURN(-EINVAL); + if (cli->cl_mgmtcli_obd) { + mgmtcli_deregister_for_events_t dereg_f; + + dereg_f = inter_module_get("mgmtcli_deregister_for_events"); + dereg_f(cli->cl_mgmtcli_obd, obddev); + inter_module_put("mgmtcli_deregister_for_events"); + } + class_destroy_import(cli->cl_import); + cli->cl_import = NULL; + + ldlm_put_ref(); + + RETURN(0); +} + int client_connect_import(struct lustre_handle *dlm_handle, struct obd_device *obd, struct obd_uuid *cluuid) @@ -743,7 +923,6 @@ int target_queue_final_reply(struct ptlrpc_request *req, int rc) obd->obd_name); obd->obd_recovering = 0; - obd_postsetup(obd); /* when recovering finished, cleanup orphans for mds */ if (OBT(obd) && OBP(obd, postrecov)) { rc2 = OBP(obd, postrecov)(obd); diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 75e0cc4..8264576 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -152,7 +152,7 @@ extern struct super_operations ll_super_operations; char *ll_read_opt(const char *opt, char *data); int ll_set_opt(const char *opt, char *data, int fl); void ll_options(char *options, char **ost, char **mds, char **zconf, - char **mds_uuid, int *flags); + char **mds_uuid, char **mds_peer, int *flags); void ll_lli_init(struct ll_inode_info *lli); int ll_fill_super(struct super_block *sb, void *data, int silent); void ll_put_super(struct super_block *sb); diff --git a/lustre/lov/lov_internal.h b/lustre/lov/lov_internal.h index 57ba1b3..672a546 100644 --- a/lustre/lov/lov_internal.h +++ b/lustre/lov/lov_internal.h @@ -25,24 +25,9 @@ int lov_alloc_memmd(struct lov_stripe_md **lsmp, int stripe_count, int pattern); void lov_free_memmd(struct lov_stripe_md **lsmp); /* lov_log.c */ -int lov_llog_setup(struct obd_device *obd, struct obd_device *disk_obd, - int index, int count ,struct llog_logid *logids); -int lov_llog_cleanup(struct obd_device *obd); -int lov_llog_origin_add(struct obd_export *exp, - int index, - struct llog_rec_hdr *rec, struct lov_stripe_md *lsm, - struct llog_cookie *logcookies, int numcookies); -int lov_llog_repl_cancel(struct obd_device *obd, struct lov_stripe_md *lsm, - int count, struct llog_cookie *cookies, int flags); - - -#if 0 -int lov_get_catalogs(struct lov_obd *lov, struct llog_handle *cathandle); -int lov_log_add(struct obd_export *exp, - struct llog_handle *cathandle, - struct llog_rec_hdr *rec, struct lov_stripe_md *lsm, - struct llog_cookie *logcookies, int numcookies); -#endif +int lov_llog_init(struct obd_device *obd, struct obd_device *tgt, + int count, struct llog_logid *logid); +int lov_llog_finish(struct obd_device *obd, int count); /* lov_pack.c */ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmm, diff --git a/lustre/lov/lov_log.c b/lustre/lov/lov_log.c index f8fe8cb..b11ccf1 100644 --- a/lustre/lov/lov_log.c +++ b/lustre/lov/lov_log.c @@ -52,18 +52,17 @@ #include "lov_internal.h" -int lov_llog_setup(struct obd_device *obd, struct obd_device *disk_obd, - int index, int count ,struct llog_logid *logids) +#if 0 +static int lov_logop_cleanup(struct llog_obd_ctxt *ctxt) { - struct lov_obd *lov = &obd->u.lov; + struct lov_obd *lov = &ctxt->loc_obd->u.lov; int i, rc = 0; - ENTRY; - LASSERT(lov->desc.ld_tgt_count == count); + ENTRY; for (i = 0; i < lov->desc.ld_tgt_count; i++) { struct obd_device *child = lov->tgts[i].ltd_exp->exp_obd; - child->obd_log_exp = disk_obd->obd_log_exp; - rc = obd_llog_setup(child, disk_obd, index, 1, logids + i); + struct llog_obd_ctxt *cctxt = child->obd_llog_ctxt[ctxt->loc_idx]; + rc = llog_cleanup(cctxt); if (rc) { CERROR("error lov_llog_open %d\n", i); break; @@ -71,34 +70,18 @@ int lov_llog_setup(struct obd_device *obd, struct obd_device *disk_obd, } RETURN(rc); } - -int lov_llog_cleanup(struct obd_device *obd) -{ - struct lov_obd *lov = &obd->u.lov; - int i, rc = 0; - - ENTRY; - for (i = 0; i < lov->desc.ld_tgt_count; i++) { - struct obd_device *child = lov->tgts[i].ltd_exp->exp_obd; - rc = obd_llog_cleanup(child); - CERROR("error lov_llog_open %d\n", i); - if (rc) - break; - } - RETURN(rc); -} +#endif /* Add log records for each OSC that this object is striped over, and return * cookies for each one. We _would_ have nice abstraction here, except that * we need to keep cookies in stripe order, even if some are NULL, so that * the right cookies are passed back to the right OSTs at the client side. * Unset cookies should be all-zero (which will never occur naturally). */ -int lov_llog_origin_add(struct obd_export *exp, - int index, +static int lov_llog_origin_add(struct llog_obd_ctxt *ctxt, struct llog_rec_hdr *rec, struct lov_stripe_md *lsm, struct llog_cookie *logcookies, int numcookies) { - struct obd_device *obd = class_exp2obd(exp); + struct obd_device *obd = ctxt->loc_obd; struct lov_obd *lov = &obd->u.lov; struct lov_oinfo *loi; int i, rc = 0; @@ -107,18 +90,21 @@ int lov_llog_origin_add(struct obd_export *exp, LASSERT(logcookies && numcookies >= lsm->lsm_stripe_count); for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) { - rc += obd_llog_origin_add(lov->tgts[loi->loi_ost_idx].ltd_exp, index, - rec, NULL, logcookies + rc, numcookies - rc); + struct obd_device *child = lov->tgts[loi->loi_ost_idx].ltd_exp->exp_obd; + struct llog_obd_ctxt *cctxt = child->obd_llog_ctxt[ctxt->loc_idx]; + rc += llog_add(cctxt, rec, NULL, logcookies + rc, numcookies - rc); + } RETURN(rc); } /* the replicators commit callback */ -int lov_llog_repl_cancel(struct obd_device *obd, struct lov_stripe_md *lsm, +static int lov_llog_repl_cancel(struct llog_obd_ctxt *ctxt, struct lov_stripe_md *lsm, int count, struct llog_cookie *cookies, int flags) { struct lov_obd *lov; + struct obd_device *obd = ctxt->loc_obd; struct lov_oinfo *loi; int rc = 0, i; ENTRY; @@ -129,12 +115,12 @@ int lov_llog_repl_cancel(struct obd_device *obd, struct lov_stripe_md *lsm, loi = lsm->lsm_oinfo; lov = &obd->u.lov; for (i = 0; i < count; i++, cookies++, loi++) { + struct obd_device *child = lov->tgts[loi->loi_ost_idx].ltd_exp->exp_obd; + struct llog_obd_ctxt *cctxt = child->obd_llog_ctxt[ctxt->loc_idx]; int err; - err = obd_llog_repl_cancel(lov->tgts[loi->loi_ost_idx].ltd_exp->exp_obd, - NULL, 1, cookies, flags); - + err = llog_cancel(cctxt, NULL, 1, cookies, flags); if (err && lov->tgts[loi->loi_ost_idx].active) { CERROR("error: objid "LPX64" subobj "LPX64 " on OST idx %d: rc = %d\n", lsm->lsm_object_id, @@ -145,3 +131,69 @@ int lov_llog_repl_cancel(struct obd_device *obd, struct lov_stripe_md *lsm, } RETURN(rc); } + +static struct llog_operations lov_unlink_orig_logops = { +// lop_cleanup: lov_logop_cleanup, + lop_add: lov_llog_origin_add, +}; + +static struct llog_operations lov_size_repl_logops = { +// lop_cleanup: lov_logop_cleanup, + lop_cancel: lov_llog_repl_cancel +}; + + +int lov_llog_init(struct obd_device *obd, struct obd_device *tgt, + int count, struct llog_logid *logid) +{ + struct lov_obd *lov = &obd->u.lov; + int i, rc = 0; + ENTRY; + + rc = llog_setup(obd, LLOG_UNLINK_ORIG_CTXT, tgt, 0, NULL, + &lov_unlink_orig_logops); + if (rc) + RETURN(rc); + + rc = llog_setup(obd, LLOG_SIZE_REPL_CTXT, tgt, 0, NULL, + &lov_size_repl_logops); + if (rc) + RETURN(rc); + + LASSERT(lov->desc.ld_tgt_count == count); + for (i = 0; i < lov->desc.ld_tgt_count; i++) { + struct obd_device *child = lov->tgts[i].ltd_exp->exp_obd; + rc = obd_llog_init(child, tgt, 1, logid + i); + if (rc) { + CERROR("error osc_llog_init %d\n", i); + break; + } + } + RETURN(rc); +} + +int lov_llog_finish(struct obd_device *obd, int count) +{ + struct lov_obd *lov = &obd->u.lov; + int i, rc = 0; + ENTRY; + + rc = llog_cleanup(obd->obd_llog_ctxt[LLOG_UNLINK_ORIG_CTXT]); + if (rc) + RETURN(rc); + + rc = llog_cleanup(obd->obd_llog_ctxt[LLOG_SIZE_REPL_CTXT]); + if (rc) + RETURN(rc); + + LASSERT(lov->desc.ld_tgt_count == count); + for (i = 0; i < lov->desc.ld_tgt_count; i++) { + struct obd_device *child = lov->tgts[i].ltd_exp->exp_obd; + rc = obd_llog_finish(child, 1); + if (rc) { + CERROR("error osc_llog_finish %d\n", i); + break; + } + } + RETURN(rc); +} diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h index da20ff3..5696e7f 100644 --- a/lustre/mds/mds_internal.h +++ b/lustre/mds/mds_internal.h @@ -9,18 +9,6 @@ static inline struct mds_obd *mds_req2mds(struct ptlrpc_request *req) return &req->rq_export->exp_obd->u.mds; } - -/* mds/mds_fs.c */ -struct llog_handle *mds_log_create(struct obd_device *obd, char *name); -int mds_log_close(struct llog_handle *cathandle, struct llog_handle *loghandle); -struct llog_handle *mds_log_open(struct obd_device *obd, - struct llog_cookie *logcookie); -#if 0 -struct llog_handle *mds_get_catalog(struct obd_device *obd); -#endif -void mds_put_catalog(struct obd_device *obd, struct llog_handle *cathandle); - - /* mds/mds_reint.c */ void mds_commit_cb(struct obd_device *, __u64 last_rcvd, void *data, int error); int mds_finish_transno(struct mds_obd *mds, struct inode *inode, void *handle, @@ -40,27 +28,20 @@ int mds_cleanup_orphans(struct obd_device *obd); /* mds/mds_log.c */ -int mds_llog_setup(struct obd_device *obd, struct obd_device *disk_obd, - int index, int count, struct llog_logid *logid); -int mds_llog_cleanup(struct obd_device *obd); -int mds_llog_origin_add(struct obd_export *exp, - int index, - struct llog_rec_hdr *rec, struct lov_stripe_md *lsm, - struct llog_cookie *logcookies, int numcookies); -int mds_llog_repl_cancel(struct obd_device *obd, struct lov_stripe_md *lsm, - int count, struct llog_cookie *cookies, int flags); int mds_log_op_unlink(struct obd_device *obd, struct inode *inode, struct lustre_msg *repmsg, int offset); +int mds_llog_init(struct obd_device *obd, struct obd_device *tgt, + int count, struct llog_logid *logid); +int mds_llog_finish(struct obd_device *obd, int count); /* mds/mds_lov.c */ -int mds_lov_connect(struct obd_device *obd); +int mds_lov_connect(struct obd_device *obd, char * lov_name); +int mds_lov_disconnect(struct obd_device *obd, int flags); int mds_get_lovtgts(struct obd_device *, int tgt_count, struct obd_uuid *); int mds_lov_write_objids(struct obd_device *obd); void mds_lov_update_objids(struct obd_device *obd, obd_id *ids); int mds_lov_set_growth(struct mds_obd *mds, int count); int mds_lov_set_nextid(struct obd_device *obd); -int mds_set_lovdesc(struct obd_device *obd, struct lov_desc *desc, - struct obd_uuid *uuidarray); int mds_post_mds_lovconf(struct obd_device *obd); int mds_notify(struct obd_device *obd, struct obd_device *watched, int active); int mds_convert_lov_ea(struct obd_device *obd, struct inode *inode, @@ -87,6 +68,7 @@ int mds_obd_destroy(struct obd_export *exp, struct obdo *oa, /* mds/handler.c */ extern struct lvfs_callback_ops mds_lvfs_ops; +int mds_lov_clean(struct obd_device *obd); extern int mds_iocontrol(unsigned int cmd, struct obd_export *exp, int len, void *karg, void *uarg); #ifdef __KERNEL__ diff --git a/lustre/mds/mds_log.c b/lustre/mds/mds_log.c index 386b1af..6e30673 100644 --- a/lustre/mds/mds_log.c +++ b/lustre/mds/mds_log.c @@ -37,55 +37,47 @@ #include "mds_internal.h" -int mds_llog_setup(struct obd_device *obd, struct obd_device *disk_obd, - int index, int count, struct llog_logid *logid) -{ - int rc; - ENTRY; - - OBD_CHECK_OP(obd->u.mds.mds_osc_obd, llog_setup, 0); - rc = OBP(obd->u.mds.mds_osc_obd, llog_setup)(obd->u.mds.mds_osc_obd, - disk_obd, index, count, - logid); - RETURN(rc); -} - -int mds_llog_cleanup(struct obd_device *obd) +#if 0 +static int mds_logop_cleanup(struct llog_obd_ctxt *ctxt) { + struct obd_device *obd = ctxt->loc_obd; + struct obd_device *lov_obd = obd->u.mds.mds_osc_obd; + struct llog_obd_ctxt *lctxt; int rc; ENTRY; - OBD_CHECK_OP(obd->u.mds.mds_osc_obd, llog_cleanup, 0); - rc = OBP(obd->u.mds.mds_osc_obd, llog_cleanup)(obd->u.mds.mds_osc_obd); + lctxt = lov_obd->obd_llog_ctxt[ctxt->loc_idx]; + rc = llog_cleanup(lctxt); RETURN(rc); } +#endif -int mds_llog_origin_add(struct obd_export *exp, int index, +static int mds_llog_origin_add(struct llog_obd_ctxt *ctxt, struct llog_rec_hdr *rec, struct lov_stripe_md *lsm, struct llog_cookie *logcookies, int numcookies) { + struct obd_device *obd = ctxt->loc_obd; + struct obd_device *lov_obd = obd->u.mds.mds_osc_obd; + struct llog_obd_ctxt *lctxt; int rc; - struct obd_export *lov_exp = exp->exp_obd->u.mds.mds_osc_exp; ENTRY; - EXP_CHECK_OP(lov_exp, llog_origin_add); - - rc = OBP(lov_exp->exp_obd, llog_origin_add)(lov_exp, index, rec, lsm, - logcookies, numcookies); + lctxt = lov_obd->obd_llog_ctxt[ctxt->loc_idx]; + rc = llog_add(lctxt, rec, lsm, logcookies, numcookies); RETURN(rc); } -int mds_llog_repl_cancel(struct obd_device *obd, struct lov_stripe_md *lsm, +static int mds_llog_repl_cancel(struct llog_obd_ctxt *ctxt, struct lov_stripe_md *lsm, int count, struct llog_cookie *cookies, int flags) { - int rc; + struct obd_device *obd = ctxt->loc_obd; struct obd_device *lov_obd = obd->u.mds.mds_osc_obd; + struct llog_obd_ctxt *lctxt; + int rc; ENTRY; - OBD_CHECK_OP(obd, llog_repl_cancel, -EOPNOTSUPP); - - rc = OBP(lov_obd, llog_repl_cancel)(lov_obd, lsm, count, cookies, - flags); + lctxt = lov_obd->obd_llog_ctxt[ctxt->loc_idx]; + rc = llog_cancel(lctxt, lsm, count, cookies,flags); RETURN(rc); } @@ -95,6 +87,9 @@ int mds_log_op_unlink(struct obd_device *obd, struct inode *inode, struct mds_obd *mds = &obd->u.mds; struct lov_stripe_md *lsm = NULL; struct llog_unlink_rec *lur; +#ifdef ENABLE_ORPHANS + struct llog_obd_ctxt *ctxt; +#endif int rc; ENTRY; @@ -116,7 +111,8 @@ int mds_log_op_unlink(struct obd_device *obd, struct inode *inode, lur->lur_ogen = inode->i_generation; #ifdef ENABLE_ORPHANS - rc = obd_llog_origin_add(mds->mds_osc_exp, 0, &lur->lur_hdr, + ctxt = obd->obd_llog_ctxt[LLOG_UNLINK_ORIG_CTXT]; + rc = llog_add(ctxt, &lur->lur_hdr, lsm, lustre_msg_buf(repmsg, offset + 1, 0), repmsg->buflens[offset + 1] / sizeof(struct llog_cookie)); @@ -127,3 +123,56 @@ int mds_log_op_unlink(struct obd_device *obd, struct inode *inode, RETURN(rc); } + +static struct llog_operations mds_unlink_orig_logops = { + //lop_cleanup: mds_logop_cleanup, + lop_add: mds_llog_origin_add, +}; + +static struct llog_operations mds_size_repl_logops = { + //lop_cleanup: mds_logop_cleanup, + lop_cancel: mds_llog_repl_cancel +}; + +int mds_llog_init(struct obd_device *obd, struct obd_device *tgt, + int count, struct llog_logid *logid) +{ + struct obd_device *lov_obd = obd->u.mds.mds_osc_obd; + int rc; + ENTRY; + + rc = llog_setup(obd, LLOG_UNLINK_ORIG_CTXT, tgt, 0, NULL, &mds_unlink_orig_logops); + if (rc) + RETURN(rc); + + rc = llog_setup(obd, LLOG_SIZE_REPL_CTXT, tgt, 0, NULL, &mds_size_repl_logops); + if (rc) + RETURN(rc); + + rc = obd_llog_init(lov_obd, tgt, count, logid); + if (rc) + CERROR("error lov_llog_init\n"); + + RETURN(rc); +} + +int mds_llog_finish(struct obd_device *obd, int count) +{ + struct obd_device *lov_obd = obd->u.mds.mds_osc_obd; + int rc; + ENTRY; + + rc = llog_cleanup(obd->obd_llog_ctxt[LLOG_UNLINK_ORIG_CTXT]); + if (rc) + RETURN(rc); + + rc = llog_cleanup(obd->obd_llog_ctxt[LLOG_SIZE_REPL_CTXT]); + if (rc) + RETURN(rc); + + rc = obd_llog_finish(lov_obd, count); + if (rc) + CERROR("error lov_llog_finish\n"); + + RETURN(rc); +} diff --git a/lustre/mgmt/mgmt_svc.c b/lustre/mgmt/mgmt_svc.c index c638dfa..51abb74 100644 --- a/lustre/mgmt/mgmt_svc.c +++ b/lustre/mgmt/mgmt_svc.c @@ -92,25 +92,22 @@ static int mgmt_setup(struct obd_device *obd, obd_count len, void *buf) mgmt_service = ptlrpc_init_svc(MGMT_NEVENTS, MGMT_NBUFS, MGMT_BUFSIZE, MGMT_MAXREQSIZE, MGMT_REQUEST_PORTAL, MGMT_REPLY_PORTAL, mgmt_handler, - "mgmt", obd); + "mgmt", obd->obd_proc_entry); if (!mgmt_service) { CERROR("Failed to start mgmt service\n"); RETURN(-ENOMEM); } - for (i = 0; i < MGMT_NUM_THREADS; i++) { - char name[32]; - sprintf(name, "mgmt_%02d", i); - rc = ptlrpc_start_thread(obd, mgmt_service, name); - if (rc) { - CERROR("failed to start mgmt thread %d: %d\n", i, rc); - LBUG(); - } - } - + rc = ptlrpc_start_n_threads(obd, mgmt_service, MGMT_NUM_THREADS,"mgmt"); + if (rc) + GOTO(err, rc); + mgmt_initialized = 1; RETURN(0); +err: + ptlrpc_unregister_service(mgmt_service); + RETURN(rc): } static int mgmt_cleanup(struct obd_device *obd, int flags) diff --git a/lustre/obdclass/llog_obd.c b/lustre/obdclass/llog_obd.c index 1522a73..2210f50 100644 --- a/lustre/obdclass/llog_obd.c +++ b/lustre/obdclass/llog_obd.c @@ -21,160 +21,149 @@ /* helper functions for calling the llog obd methods */ -int obd_llog_setup(struct obd_device *obd, struct obd_device *disk_obd, - int index, int count, struct llog_logid *logid) +int llog_setup(struct obd_device *obd, int index, struct obd_device *disk_obd, + int count, struct llog_logid *logid, struct llog_operations *op) { - int rc; + int rc = 0; + struct llog_obd_ctxt *ctxt; ENTRY; - OBD_CHECK_OP(obd, llog_setup, 0); - OBD_COUNTER_INCREMENT(obd, llog_setup); + if (index < 0 || index >= LLOG_MAX_CTXTS) + RETURN(-EFAULT); + + OBD_ALLOC(ctxt, sizeof(*ctxt)); + if (!ctxt) + RETURN(-ENOMEM); + + obd->obd_llog_ctxt[index] = ctxt; + ctxt->loc_obd = obd; + ctxt->loc_exp = class_export_get(disk_obd->obd_self_export); + ctxt->loc_idx = index; + ctxt->loc_logops = op; + sema_init(&ctxt->loc_sem, 1); + + if (op->lop_setup) + rc = op->lop_setup(obd, index, disk_obd, count, logid); + if (ctxt && rc) + OBD_FREE(ctxt, sizeof(*ctxt)); - rc = OBP(obd, llog_setup)(obd, disk_obd, index, count, logid); RETURN(rc); } -EXPORT_SYMBOL(obd_llog_setup); +EXPORT_SYMBOL(llog_setup); -int obd_llog_cleanup(struct obd_device *obd) +int llog_cleanup(struct llog_obd_ctxt *ctxt) { - int rc; + int rc = 0; ENTRY; - OBD_CHECK_OP(obd, llog_cleanup, 0); - OBD_COUNTER_INCREMENT(obd, llog_cleanup); + LASSERT(ctxt); + + if (CTXTP(ctxt, cleanup)) + rc = CTXTP(ctxt, cleanup)(ctxt); + + ctxt->loc_obd->obd_llog_ctxt[ctxt->loc_idx] = NULL; + class_export_put(ctxt->loc_exp); + ctxt->loc_exp = NULL; + OBD_FREE(ctxt, sizeof(*ctxt)); - rc = OBP(obd, llog_cleanup)(obd); RETURN(rc); } -EXPORT_SYMBOL(obd_llog_cleanup); +EXPORT_SYMBOL(llog_cleanup); -int obd_llog_origin_add(struct obd_export *exp, - int index, - struct llog_rec_hdr *rec, struct lov_stripe_md *lsm, - struct llog_cookie *logcookies, int numcookies) +int llog_add(struct llog_obd_ctxt *ctxt, + struct llog_rec_hdr *rec, struct lov_stripe_md *lsm, + struct llog_cookie *logcookies, int numcookies) { int rc; ENTRY; - EXP_CHECK_OP(exp, llog_origin_add); - OBD_COUNTER_INCREMENT(exp->exp_obd, llog_origin_add); + LASSERT(ctxt); + CTXT_CHECK_OP(ctxt, add, -EOPNOTSUPP); - rc = OBP(exp->exp_obd, llog_origin_add) - (exp, index, rec, lsm, logcookies, numcookies); + rc = CTXTP(ctxt, add)(ctxt, rec, lsm, logcookies, numcookies); RETURN(rc); } -EXPORT_SYMBOL(obd_llog_origin_add); +EXPORT_SYMBOL(llog_add); -int obd_llog_repl_cancel(struct obd_device *obd, struct lov_stripe_md *lsm, - int count, struct llog_cookie *cookies, int flags) +int llog_cancel(struct llog_obd_ctxt *ctxt, struct lov_stripe_md *lsm, + int count, struct llog_cookie *cookies, int flags) { int rc; ENTRY; - OBD_CHECK_OP(obd, llog_repl_cancel, -EOPNOTSUPP); - OBD_COUNTER_INCREMENT(obd, llog_repl_cancel); - - rc = OBP(obd, llog_repl_cancel)(obd, lsm, count, cookies, flags); + LASSERT(ctxt); + CTXT_CHECK_OP(ctxt, cancel, -EOPNOTSUPP); + rc = CTXTP(ctxt, cancel)(ctxt, lsm, count, cookies, flags); RETURN(rc); } -EXPORT_SYMBOL(obd_llog_repl_cancel); +EXPORT_SYMBOL(llog_cancel); -/* now some implementations of these stubs useful on the OSC and OBDFILTER */ -int llog_obd_setup(struct obd_device *obd, struct obd_device *disk_obd, - int index, int count, struct llog_logid *logid) + +/* lop_setup method for filter/osc */ +// XXX how to set exports +int llog_obd_origin_setup(struct obd_device *obd, int index, struct obd_device *disk_obd, + int count, struct llog_logid *logid) { struct llog_obd_ctxt *ctxt; struct llog_handle *handle; struct obd_run_ctxt saved; int rc; + ENTRY; - LASSERT(count == 1); - - if (disk_obd->obd_llog_ctxt && - disk_obd->obd_llog_ctxt->loc_handles[index]) + if (count == 0) RETURN(0); - if (index == 0) { - if (disk_obd->obd_llog_ctxt) { - CERROR("llog_ctxt already allocated\n"); - LBUG(); - } - - OBD_ALLOC(ctxt, sizeof(*ctxt)); - if (!ctxt) - RETURN(-ENOMEM); - disk_obd->obd_llog_ctxt = ctxt; - - sema_init(&disk_obd->obd_llog_ctxt->loc_sem, 1); - } else - ctxt = disk_obd->obd_llog_ctxt; - - if (index < 0 || index >= LLOG_OBD_MAX_HANDLES) { - CERROR("llog_ctxt index out of range\n"); - LBUG(); - } + LASSERT(count == 1); + + LASSERT(obd->obd_llog_ctxt[index]); + ctxt = obd->obd_llog_ctxt[index]; if (logid->lgl_oid) - rc = llog_create(disk_obd, &handle, logid, NULL); + rc = llog_create(ctxt, &handle, logid, NULL); else { - rc = llog_create(disk_obd, &handle, NULL, NULL); + rc = llog_create(ctxt, &handle, NULL, NULL); if (!rc) *logid = handle->lgh_id; } if (rc) GOTO(out, rc); - disk_obd->obd_llog_ctxt->loc_handles[index] = handle; + ctxt->loc_handle = handle; push_ctxt(&saved, &disk_obd->obd_ctxt, NULL); rc = llog_init_handle(handle, LLOG_F_IS_CAT, NULL); pop_ctxt(&saved, &disk_obd->obd_ctxt, NULL); out: - if (ctxt && rc) + if (ctxt && rc) { + obd->obd_llog_ctxt[index] = NULL; OBD_FREE(ctxt, sizeof(*ctxt)); + } RETURN(rc); } -EXPORT_SYMBOL(llog_obd_setup); +EXPORT_SYMBOL(llog_obd_origin_setup); -int llog_obd_cleanup(struct obd_device *obd) +int llog_obd_origin_cleanup(struct llog_obd_ctxt *ctxt) { - int i; - struct llog_obd_ctxt *ctxt = obd->obd_llog_ctxt; - if (!ctxt) return 0; - if (ctxt->loc_imp) { - //class_destroy_import(ctxt->loc_imp); - ctxt->loc_imp = NULL; - } - - for (i=0 ; i < LLOG_OBD_MAX_HANDLES ;i++ ) - if (obd->obd_llog_ctxt->loc_handles[i]) - llog_cat_put(obd->obd_llog_ctxt->loc_handles[i]); + if (ctxt->loc_handle) + llog_cat_put(ctxt->loc_handle); - OBD_FREE(obd->obd_llog_ctxt, sizeof(*obd->obd_llog_ctxt)); - obd->obd_llog_ctxt = NULL; return 0; } -EXPORT_SYMBOL(llog_obd_cleanup); +EXPORT_SYMBOL(llog_obd_origin_cleanup); + -int llog_obd_origin_add(struct obd_export *exp, - int index, - struct llog_rec_hdr *rec, struct lov_stripe_md *lsm, - struct llog_cookie *logcookies, int numcookies) +/* add for obdfilter/sz and mds/unlink */ +int llog_obd_origin_add(struct llog_obd_ctxt *ctxt, + struct llog_rec_hdr *rec, struct lov_stripe_md *lsm, + struct llog_cookie *logcookies, int numcookies) { struct llog_handle *cathandle; - struct obd_export *export = exp->exp_obd->obd_log_exp; int rc; ENTRY; - if (index < 0 || index >= LLOG_OBD_MAX_HANDLES) { - LBUG(); - RETURN(-EINVAL); - } - - //cathandle = exp->exp_obd->obd_llog_ctxt->loc_handles[index]; - cathandle = export->exp_obd->obd_llog_ctxt->loc_handles[index]; + cathandle = ctxt->loc_handle; LASSERT(cathandle != NULL); rc = llog_cat_add_rec(cathandle, rec, logcookies, NULL); if (rc != 1) @@ -183,86 +172,36 @@ int llog_obd_origin_add(struct obd_export *exp, } EXPORT_SYMBOL(llog_obd_origin_add); -/* initialize the local storage obd for the logs */ -int llog_initialize(struct obd_device *obd) -{ - struct obd_export *exp; - ENTRY; - - if (obd->obd_log_exp) - RETURN(0); - - exp = class_new_export(obd); - if (exp == NULL) - RETURN(-ENOMEM); - memcpy(&exp->exp_client_uuid, &obd->obd_uuid, - sizeof(exp->exp_client_uuid)); - obd->obd_log_exp = exp; - class_export_put(exp); - - obd->obd_logops = &llog_lvfs_ops; - RETURN(0); -} -EXPORT_SYMBOL(llog_initialize); - -/* disconnect the local storage obd for the logs */ -int llog_disconnect(struct obd_device *obd) -{ - struct obd_export *exp; - ENTRY; - - LASSERT(obd->obd_log_exp); - exp = obd->obd_log_exp; - - class_handle_unhash(&exp->exp_handle); - spin_lock(&exp->exp_obd->obd_dev_lock); - list_del_init(&exp->exp_obd_chain); - exp->exp_obd->obd_num_exports--; - spin_unlock(&exp->exp_obd->obd_dev_lock); - OBD_FREE(exp, sizeof(*exp)); - if (obd->obd_set_up) { - atomic_dec(&obd->obd_refcount); - wake_up(&obd->obd_refcount_waitq); - } - - obd->obd_log_exp = NULL; - obd->obd_logops = NULL; - RETURN(0); -} -EXPORT_SYMBOL(llog_disconnect); - int llog_cat_initialize(struct obd_device *obd, int count) { - int rc, i; - char name[32]; struct llog_logid *idarray; int size = sizeof(*idarray) * count; + char name[32] = "CATLIST"; + int rc; ENTRY; - LASSERT(obd->obd_log_exp); - OBD_ALLOC(idarray, size); if (!idarray) RETURN(-ENOMEM); - for (i = 0; i < LLOG_OBD_MAX_HANDLES; i++) { - sprintf(name, "CATLIST-%d", i); - memset(idarray, 0, size); - rc = llog_get_cat_list(obd, obd, name, count, idarray); - if (rc) { - CERROR("rc: %d\n", rc); - GOTO(out, rc); - } - rc = obd_llog_setup(obd, obd, i, count, idarray); - if (rc) { - CERROR("rc: %d\n", rc); - GOTO(out, rc); - } - rc = llog_put_cat_list(obd, obd, name, count, idarray); - if (rc) { - CERROR("rc: %d\n", rc); - GOTO(out, rc); - } + memset(idarray, 0, size); + + rc = llog_get_cat_list(obd, obd, name, count, idarray); + if (rc) { + CERROR("rc: %d\n", rc); + GOTO(out, rc); + } + + rc = obd_llog_init(obd, obd, count, idarray); + if (rc) { + CERROR("rc: %d\n", rc); + GOTO(out, rc); + } + + rc = llog_put_cat_list(obd, obd, name, count, idarray); + if (rc) { + CERROR("rc: %d\n", rc); + GOTO(out, rc); } out: @@ -270,3 +209,28 @@ int llog_cat_initialize(struct obd_device *obd, int count) RETURN(rc); } EXPORT_SYMBOL(llog_cat_initialize); + +int obd_llog_init(struct obd_device *obd, struct obd_device *disk_obd, + int count, struct llog_logid *logid) +{ + int rc; + ENTRY; + OBD_CHECK_OP(obd, llog_init, 0); + OBD_COUNTER_INCREMENT(obd, llog_init); + + rc = OBP(obd, llog_init)(obd, disk_obd, count, logid); + RETURN(rc); +} +EXPORT_SYMBOL(obd_llog_init); + +int obd_llog_finish(struct obd_device *obd, int count) +{ + int rc; + ENTRY; + OBD_CHECK_OP(obd, llog_finish, 0); + OBD_COUNTER_INCREMENT(obd, llog_finish); + + rc = OBP(obd, llog_finish)(obd, count); + RETURN(rc); +} +EXPORT_SYMBOL(obd_llog_finish); diff --git a/lustre/obdfilter/filter_log.c b/lustre/obdfilter/filter_log.c index 520c4a3..8f526b6 100644 --- a/lustre/obdfilter/filter_log.c +++ b/lustre/obdfilter/filter_log.c @@ -97,6 +97,7 @@ void filter_cancel_cookies_cb(struct obd_device *obd, __u64 transno, void *cb_data, int error) { struct llog_cookie *cookie = cb_data; - llog_obd_repl_cancel(obd, NULL, 1, cookie, OBD_LLOG_FL_SENDNOW); + llog_obd_repl_cancel(obd->obd_llog_ctxt[LLOG_UNLINK_REPL_CTXT], + NULL, 1, cookie, OBD_LLOG_FL_SENDNOW); OBD_FREE(cb_data, sizeof(struct llog_cookie)); } diff --git a/lustre/portals/include/linux/kp30.h b/lustre/portals/include/linux/kp30.h index 9656c83..f152725 100644 --- a/lustre/portals/include/linux/kp30.h +++ b/lustre/portals/include/linux/kp30.h @@ -1033,6 +1033,7 @@ enum { TOENAL, TCPNAL, SCIMACNAL, + ROUTER, NAL_ENUM_END_MARKER }; diff --git a/lustre/portals/include/linux/portals_lib.h b/lustre/portals/include/linux/portals_lib.h index 14d60c6..609290d 100644 --- a/lustre/portals/include/linux/portals_lib.h +++ b/lustre/portals/include/linux/portals_lib.h @@ -47,6 +47,11 @@ static inline int size_round16(int val) return (val + 0xf) & (~0xf); } +static inline int size_round32(int val) +{ + return (val + 0x1f) & (~0x1f); +} + static inline int size_round0(int val) { if (!val) diff --git a/lustre/portals/libcfs/module.c b/lustre/portals/libcfs/module.c index bfa959d..d233903 100644 --- a/lustre/portals/libcfs/module.c +++ b/lustre/portals/libcfs/module.c @@ -210,6 +210,84 @@ kportal_get_route(int index, __u32 *gateway_nalidp, ptl_nid_t *gateway_nidp, return (rc); } +static int +kportal_router_cmd(struct portals_cfg *pcfg, void * private) +{ + int err; + ENTRY; + + switch(pcfg->pcfg_command) { + case IOC_PORTAL_ADD_ROUTE: + CDEBUG(D_IOCTL, "Adding route: [%d] "LPU64" : "LPU64" - "LPU64"\n", + pcfg->pcfg_nal, pcfg->pcfg_nid, + pcfg->pcfg_nid2, pcfg->pcfg_nid3); + err = kportal_add_route(pcfg->pcfg_nal, pcfg->pcfg_nid, + pcfg->pcfg_nid2, pcfg->pcfg_nid3); + break; + + case IOC_PORTAL_DEL_ROUTE: + CDEBUG (D_IOCTL, "Removing routes via [%d] "LPU64" : "LPU64" - "LPU64"\n", + pcfg->pcfg_nal, pcfg->pcfg_nid, + pcfg->pcfg_nid2, pcfg->pcfg_nid3); + err = kportal_del_route (pcfg->pcfg_nal, pcfg->pcfg_nid, + pcfg->pcfg_nid2, pcfg->pcfg_nid3); + break; + + case IOC_PORTAL_NOTIFY_ROUTER: { + CDEBUG (D_IOCTL, "Notifying peer [%d] "LPU64" %s @ %ld\n", + pcfg->pcfg_nal, pcfg->pcfg_nid, + pcfg->pcfg_flags ? "Enabling" : "Disabling", + (time_t)pcfg->pcfg_nid3); + + err = kportal_notify_router (pcfg->pcfg_nal, pcfg->pcfg_nid, + pcfg->pcfg_flags, + (time_t)pcfg->pcfg_nid3); + break; + } + + case IOC_PORTAL_GET_ROUTE: + CDEBUG (D_IOCTL, "Getting route [%d]\n", pcfg->pcfg_count); + err = kportal_get_route(pcfg->pcfg_count, &pcfg->pcfg_nal, + &pcfg->pcfg_nid, + &pcfg->pcfg_nid2, &pcfg->pcfg_nid3, + &pcfg->pcfg_flags); + break; + } + RETURN(err); +} + +static int +kportal_register_router (void) +{ + int rc; + kpr_control_interface_t *ci; + + ci = (kpr_control_interface_t *)PORTAL_SYMBOL_GET(kpr_control_interface); + if (ci == NULL) + return (0); + + rc = kportal_nal_register(ROUTER, kportal_router_cmd, NULL); + + PORTAL_SYMBOL_PUT(kpr_control_interface); + return (rc); +} + +static int +kportal_unregister_router (void) +{ + int rc; + kpr_control_interface_t *ci; + + ci = (kpr_control_interface_t *)PORTAL_SYMBOL_GET(kpr_control_interface); + if (ci == NULL) + return (0); + + rc = kportal_nal_unregister(ROUTER); + + PORTAL_SYMBOL_PUT(kpr_control_interface); + return (rc); +} + int kportal_nal_cmd(struct portals_cfg *pcfg) { @@ -393,45 +471,6 @@ static int kportal_ioctl(struct inode *inode, struct file *file, RETURN(0); } - case IOC_PORTAL_ADD_ROUTE: - CDEBUG(D_IOCTL, "Adding route: [%d] "LPU64" : "LPU64" - "LPU64"\n", - data->ioc_nal, data->ioc_nid, - data->ioc_nid2, data->ioc_nid3); - err = kportal_add_route(data->ioc_nal, data->ioc_nid, - data->ioc_nid2, data->ioc_nid3); - break; - - case IOC_PORTAL_DEL_ROUTE: - CDEBUG (D_IOCTL, "Removing routes via [%d] "LPU64" : "LPU64" - "LPU64"\n", - data->ioc_nal, data->ioc_nid, - data->ioc_nid2, data->ioc_nid3); - err = kportal_del_route (data->ioc_nal, data->ioc_nid, - data->ioc_nid2, data->ioc_nid3); - break; - - case IOC_PORTAL_NOTIFY_ROUTER: { - CDEBUG (D_IOCTL, "Notifying peer [%d] "LPU64" %s @ %ld\n", - data->ioc_nal, data->ioc_nid, - data->ioc_flags ? "Enabling" : "Disabling", - (time_t)data->ioc_nid3); - - err = kportal_notify_router (data->ioc_nal, data->ioc_nid, - data->ioc_flags, - (time_t)data->ioc_nid3); - break; - } - - case IOC_PORTAL_GET_ROUTE: - CDEBUG (D_IOCTL, "Getting route [%d]\n", data->ioc_count); - err = kportal_get_route(data->ioc_count, &data->ioc_nal, - &data->ioc_nid, - &data->ioc_nid2, &data->ioc_nid3, - &data->ioc_flags); - if (err == 0) - if (copy_to_user((char *)arg, data, sizeof (*data))) - err = -EFAULT; - break; - case IOC_PORTAL_GET_NID: { const ptl_handle_ni_t *nip; ptl_process_id_t pid; @@ -575,9 +614,17 @@ static int init_kportals_module(void) goto cleanup_fini; } + rc = kportal_register_router(); + if (rc) { + CERROR("kportals_register_router: error %d\n", rc); + goto cleanup_proc; + } + CDEBUG (D_OTHER, "portals setup OK\n"); return (0); + cleanup_proc: + remove_proc(); cleanup_fini: PtlFini(); cleanup_deregister: @@ -595,6 +642,7 @@ static void exit_kportals_module(void) { int rc; + kportal_unregister_router(); remove_proc(); PtlFini(); diff --git a/lustre/portals/utils/portals.c b/lustre/portals/utils/portals.c index 23f2a5f..270a840 100644 --- a/lustre/portals/utils/portals.c +++ b/lustre/portals/utils/portals.c @@ -1224,7 +1224,7 @@ jt_ptl_nagle (int argc, char **argv) int jt_ptl_add_route (int argc, char **argv) { - struct portal_ioctl_data data; + struct portals_cfg pcfg; ptl_nid_t nid1; ptl_nid_t nid2; ptl_nid_t gateway_nid; @@ -1259,13 +1259,13 @@ jt_ptl_add_route (int argc, char **argv) return (-1); } - PORTAL_IOC_INIT(data); - data.ioc_nid = gateway_nid; - data.ioc_nal = g_nal; - data.ioc_nid2 = MIN (nid1, nid2); - data.ioc_nid3 = MAX (nid1, nid2); + PCFG_INIT(pcfg, IOC_PORTAL_ADD_ROUTE); + pcfg.pcfg_nid = gateway_nid; + pcfg.pcfg_nal = g_nal; + pcfg.pcfg_nid2 = MIN (nid1, nid2); + pcfg.pcfg_nid3 = MAX (nid1, nid2); - rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_ADD_ROUTE, &data); + rc = pcfg_ioctl(&pcfg); if (rc != 0) { fprintf (stderr, "IOC_PORTAL_ADD_ROUTE failed: %s\n", strerror (errno)); @@ -1278,7 +1278,7 @@ jt_ptl_add_route (int argc, char **argv) int jt_ptl_del_route (int argc, char **argv) { - struct portal_ioctl_data data; + struct portals_cfg pcfg; ptl_nid_t nid; ptl_nid_t nid1 = PTL_NID_ANY; ptl_nid_t nid2 = PTL_NID_ANY; @@ -1322,13 +1322,13 @@ jt_ptl_del_route (int argc, char **argv) } } - PORTAL_IOC_INIT(data); - data.ioc_nal = g_nal; - data.ioc_nid = nid; - data.ioc_nid2 = nid1; - data.ioc_nid3 = nid2; + PCFG_INIT(pcfg, IOC_PORTAL_DEL_ROUTE); + pcfg.pcfg_nal = g_nal; + pcfg.pcfg_nid = nid; + pcfg.pcfg_nid2 = nid1; + pcfg.pcfg_nid3 = nid2; - rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_DEL_ROUTE, &data); + rc = pcfg_ioctl(&pcfg); if (rc != 0) { fprintf (stderr, "IOC_PORTAL_DEL_ROUTE ("LPX64") failed: %s\n", nid, strerror (errno)); @@ -1341,7 +1341,7 @@ jt_ptl_del_route (int argc, char **argv) int jt_ptl_notify_router (int argc, char **argv) { - struct portal_ioctl_data data; + struct portals_cfg pcfg; int enable; ptl_nid_t nid; int rc; @@ -1381,14 +1381,14 @@ jt_ptl_notify_router (int argc, char **argv) return (-1); } - PORTAL_IOC_INIT(data); - data.ioc_nal = g_nal; - data.ioc_nid = nid; - data.ioc_flags = enable; + PCFG_INIT(pcfg, IOC_PORTAL_NOTIFY_ROUTER); + pcfg.pcfg_nal = g_nal; + pcfg.pcfg_nid = nid; + pcfg.pcfg_flags = enable; /* Yeuch; 'cept I need a __u64 on 64 bit machines... */ - data.ioc_nid3 = (__u64)when; + pcfg.pcfg_nid3 = (__u64)when; - rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_NOTIFY_ROUTER, &data); + rc = pcfg_ioctl(&pcfg); if (rc != 0) { fprintf (stderr, "IOC_PORTAL_NOTIFY_ROUTER ("LPX64") failed: %s\n", @@ -1403,7 +1403,7 @@ int jt_ptl_print_routes (int argc, char **argv) { char buffer[3][128]; - struct portal_ioctl_data data; + struct portals_cfg pcfg; int rc; int index; int gateway_nal; @@ -1414,18 +1414,18 @@ jt_ptl_print_routes (int argc, char **argv) for (index = 0;;index++) { - PORTAL_IOC_INIT(data); - data.ioc_count = index; + PCFG_INIT(pcfg, IOC_PORTAL_GET_ROUTE); + pcfg.pcfg_count = index; - rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_GET_ROUTE, &data); + rc = pcfg_ioctl(&pcfg); if (rc != 0) break; - gateway_nal = data.ioc_nal; - gateway_nid = data.ioc_nid; - nid1 = data.ioc_nid2; - nid2 = data.ioc_nid3; - alive = data.ioc_flags; + gateway_nal = pcfg.pcfg_nal; + gateway_nid = pcfg.pcfg_nid; + nid1 = pcfg.pcfg_nid2; + nid2 = pcfg.pcfg_nid3; + alive = pcfg.pcfg_flags; printf ("%8s %18s : %s - %s, %s\n", nal2name (gateway_nal), diff --git a/lustre/ptlrpc/llog_net.c b/lustre/ptlrpc/llog_net.c index 1154dbe..c553aa8 100644 --- a/lustre/ptlrpc/llog_net.c +++ b/lustre/ptlrpc/llog_net.c @@ -39,69 +39,25 @@ #include -/* This is a callback from the llog_* functions. - * Assumes caller has already pushed us into the kernel context. */ -static int llog_net_create(struct obd_device *obd, struct llog_handle **res, - struct llog_logid *logid, char *name) -{ - struct llog_handle *handle; - ENTRY; - - handle = llog_alloc_handle(); - if (handle == NULL) - RETURN(-ENOMEM); - *res = handle; - - if (!logid) { - CERROR("llog_net_create: must pass logid\n"); - llog_free_handle(handle); - RETURN(-EINVAL); - } - - handle->lgh_file = NULL; - handle->lgh_obd = obd; - handle->lgh_id.lgl_ogr = 1; - handle->lgh_id.lgl_oid = - handle->lgh_file->f_dentry->d_inode->i_ino; - handle->lgh_id.lgl_ogen = - handle->lgh_file->f_dentry->d_inode->i_generation; - - RETURN(0); -} - #ifdef ENABLE_ORPHANS -int llog_origin_handle_cancel(struct obd_device *obd, +int llog_origin_handle_cancel(struct llog_obd_ctxt *ctxt, struct ptlrpc_request *req) { + struct obd_device *obd = ctxt->loc_exp->exp_obd; struct llog_cookie *logcookies; int num_cookies, rc = 0; struct obd_run_ctxt saved; struct llog_handle *cathandle; - int i; ENTRY; - LASSERT(obd->obd_llog_ctxt); - logcookies = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*logcookies)); num_cookies = req->rq_reqmsg->buflens[0]/sizeof(*logcookies); if (logcookies == NULL || num_cookies == 0) { DEBUG_REQ(D_HA, req, "no cookies sent"); RETURN(-EFAULT); } -#if 0 - /* workaround until we don't need to send replies */ - rc = lustre_pack_msg(0, NULL, NULL, &req->rq_replen, &req->rq_repmsg); - req->rq_repmsg->status = rc; - if (rc) - RETURN(rc); - /* end workaround */ -#endif - i = logcookies->lgc_subsys; - if (i < 0 || i > LLOG_OBD_MAX_HANDLES) { - LBUG(); - RETURN(-EINVAL); - } - cathandle = obd->obd_llog_ctxt->loc_handles[i]; + + cathandle = ctxt->loc_handle; LASSERT(cathandle); push_ctxt(&saved, &obd->obd_ctxt, NULL); @@ -110,34 +66,26 @@ int llog_origin_handle_cancel(struct obd_device *obd, CERROR("cancel %d llog-records failed: %d\n", num_cookies, rc); pop_ctxt(&saved, &obd->obd_ctxt, NULL); - //req->rq_repmsg->status = rc; RETURN(rc); } EXPORT_SYMBOL(llog_origin_handle_cancel); #endif -int llog_receptor_accept(struct obd_device *obd, struct obd_import *imp) +int llog_receptor_accept(struct llog_obd_ctxt *ctxt, struct obd_import *imp) { ENTRY; - LASSERT(obd->obd_llog_ctxt); - obd->obd_llog_ctxt->loc_imp = imp; + LASSERT(ctxt); + ctxt->loc_imp = imp; RETURN(0); } EXPORT_SYMBOL(llog_receptor_accept); -int llog_initiator_connect(struct obd_device *obd) +int llog_initiator_connect(struct llog_obd_ctxt *ctxt) { ENTRY; - LASSERT(obd->obd_llog_ctxt); - obd->obd_llog_ctxt->loc_imp = obd->u.cli.cl_import; + LASSERT(ctxt); + ctxt->loc_imp = ctxt->loc_obd->u.cli.cl_import; RETURN(0); } EXPORT_SYMBOL(llog_initiator_connect); -struct llog_operations llog_net_ops = { - //lop_next_block: llog_lvfs_next_block, - //lop_read_header: llog_lvfs_read_header, - lop_create: llog_net_create, -}; - -EXPORT_SYMBOL(llog_lvfs_ops); diff --git a/lustre/ptlrpc/ptlrpc_lib.c b/lustre/ptlrpc/ptlrpc_lib.c index 68d7be6..7883c9f 100644 --- a/lustre/ptlrpc/ptlrpc_lib.c +++ b/lustre/ptlrpc/ptlrpc_lib.c @@ -135,9 +135,7 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) cli->cl_max_mds_easize = sizeof(struct lov_mds_md); cli->cl_max_mds_cookiesize = sizeof(struct llog_cookie); cli->cl_sandev = to_kdev_t(0); - - obddev->obd_logops = &llogd_client_ops; - + if (lcfg->lcfg_inllen3 == 0) RETURN(0); diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 479bec7..cd90043 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -22,7 +22,7 @@ FSTYPE=${FSTYPE:-ext3} TIMEOUT=${TIMEOUT:-5} STRIPE_BYTES=65536 -STRIPES_PER_OBJ=1 +STRIPES_PER_OBJ=0 gen_config() { rm -f replay-single.xml @@ -30,18 +30,21 @@ gen_config() { add_facet ost add_facet client --lustre_upcall $UPCALL do_lmc --add mds --node mds_facet --mds mds1 --dev $MDSDEV --size $MDSSIZE + do_lmc --add lov --mds mds1 --lov lov1 --stripe_sz $STRIPE_BYTES --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0 do_lmc --add ost --lov lov1 --node ost_facet --ost ost1 --dev $OSTDEV --size $OSTSIZE do_lmc --add ost --lov lov1 --node ost_facet --ost ost2 --dev ${OSTDEV}-2 --size $OSTSIZE do_lmc --add mtpt --node client_facet --path $MOUNT --mds mds1 --ost lov1 + +# do_lmc --add ost --node ost_facet --ost ost1 --dev $OSTDEV --size $OSTSIZE +# do_lmc --add mtpt --node client_facet --path $MOUNT --mds mds1 --ost ost1 } build_test_filter cleanup() { - [ "$DAEMONFILE" ] && lctl debug_daemon stop - umount $MOUNT || true - rmmod llite || true + lconf --cleanup --zeroconf --mds_uuid mds1_UUID --mds_nid localhost \ + --local_nid localhost --profile client_facet --mount $MOUNT stop mds ${FORCE} $MDSLCONFARGS stop ost ${FORCE} --dump cleanup.log } @@ -54,15 +57,14 @@ fi gen_config +start mds --write_conf --reformat $MDSLCONFARGS -v start ost --reformat $OSTLCONFARGS [ "$DAEMONFILE" ] && lctl debug_daemon start $DAEMONFILE $DAEMONSIZE -start mds --write_conf --reformat $MDSLCONFARGS +start mds $MDSLCONFARGS --gdb # 0-conf client -insmod ../llite/llite.o || true -[ -d /r ] && lctl modules > /r/tmp/ogdb-`hostname` -[ -d $MOUNT ] || mkdir $MOUNT -mount -t lustre_lite -o mds_uuid=mds1_UUID,profile=client_facet replay-single $MOUNT +lconf --zeroconf --mds_uuid mds1_UUID --mds_nid localhost \ + --local_nid localhost --profile client_facet --mount $MOUNT if [ "$ONLY" == "setup" ]; then exit 0 diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 35ba77f..2e5d51e 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -550,11 +550,11 @@ check_llogd_body(void) CHECK_MEMBER(llogd_body, lgd_saved_index); CHECK_MEMBER(llogd_body, lgd_cur_offset); - CHECK_VALUE(LLOGD_CREATE); - CHECK_VALUE(LLOGD_NEXT_BLOCK); - CHECK_VALUE(LLOGD_READ_HEADER); - CHECK_VALUE(LLOGD_WRITE_REC); - CHECK_VALUE(LLOGD_CLOSE); + CHECK_VALUE(LLOG_ORIGIN_HANDLE_CREATE); + CHECK_VALUE(LLOG_ORIGIN_HANDLE_NEXT_BLOCK); + CHECK_VALUE(LLOG_ORIGIN_HANDLE_READ_HEADER); + CHECK_VALUE(LLOG_ORIGIN_HANDLE_WRITE_REC); + CHECK_VALUE(LLOG_ORIGIN_HANDLE_CLOSE); } int @@ -617,7 +617,6 @@ main(int argc, char **argv) CHECK_VALUE(MDS_DISCONNECT); CHECK_VALUE(MDS_GETSTATUS); CHECK_VALUE(MDS_STATFS); - CHECK_VALUE(MDS_GETLOVINFO); CHECK_VALUE(MDS_LAST_OPC); CHECK_VALUE(MDS_FIRST_OPC); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index fbee219..b42f4d4 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -63,7 +63,6 @@ void lustre_assert_wire_constants(void) LASSERT(MDS_DISCONNECT == 39); LASSERT(MDS_GETSTATUS == 40); LASSERT(MDS_STATFS == 41); - LASSERT(MDS_GETLOVINFO == 42); LASSERT(MDS_LAST_OPC == 46); LASSERT(MDS_FIRST_OPC == 33); LASSERT(REINT_SETATTR == 1); @@ -664,10 +663,10 @@ void lustre_assert_wire_constants(void) LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_saved_index) == 4); LASSERT(offsetof(struct llogd_body, lgd_cur_offset) == 32); LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8); - LASSERT(LLOGD_CREATE == 501); - LASSERT(LLOGD_NEXT_BLOCK == 502); - LASSERT(LLOGD_READ_HEADER == 503); - LASSERT(LLOGD_WRITE_REC == 504); - LASSERT(LLOGD_CLOSE == 505); + LASSERT(LLOG_ORIGIN_HANDLE_CREATE == 501); + LASSERT(LLOG_ORIGIN_HANDLE_NEXT_BLOCK == 502); + LASSERT(LLOG_ORIGIN_HANDLE_READ_HEADER == 503); + LASSERT(LLOG_ORIGIN_HANDLE_WRITE_REC == 504); + LASSERT(LLOG_ORIGIN_HANDLE_CLOSE == 505); } -- 1.8.3.1