X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fptlrpc_module.c;h=cd73db80c0f9823abfe6ccd3c621bb9f3ba71c9d;hb=b43c7cc6cba514687ebcbeaa1a7dcc8cf7ffa694;hp=87b385d9e8f1f3a160140b9d2a3e480015793b4b;hpb=fe79e1b3a463c6ff8d6a8c8be2b9505df5a5702a;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/ptlrpc_module.c b/lustre/ptlrpc/ptlrpc_module.c index 87b385d..cd73db8 100644 --- a/lustre/ptlrpc/ptlrpc_module.c +++ b/lustre/ptlrpc/ptlrpc_module.c @@ -1,217 +1,150 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: +/* + * GPL HEADER START * - * Copyright (c) 2002, 2003 Cluster File Systems, Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * This file is part of Lustre, http://www.lustre.org. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. * - * 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. + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). * - * Lustre is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.gnu.org/licenses/gpl-2.0.html * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * GPL HEADER END + */ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Use is subject to license terms. * + * Copyright (c) 2011, 2014, Intel Corporation. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. */ -#ifndef EXPORT_SYMTAB -# define EXPORT_SYMTAB -#endif #define DEBUG_SUBSYSTEM S_RPC -#ifdef __KERNEL__ -# include -# include -#else -# include -#endif -#include -#include -#include +#include +#include +#include +#include #include "ptlrpc_internal.h" -extern int ptlrpc_init_portals(void); -extern void ptlrpc_exit_portals(void); - -__init int ptlrpc_init(void) +static __init int ptlrpc_init(void) { - int rc; - ENTRY; + int rc; - lustre_assert_wire_constants(); + ENTRY; - rc = ptlrpc_init_portals(); - if (rc) - RETURN(rc); - - ptlrpc_init_connection(); - llog_init_commit_master(); - - ptlrpc_put_connection_superhack = ptlrpc_put_connection; - ptlrpc_abort_inflight_superhack = ptlrpc_abort_inflight; - - ptlrpc_start_pinger(); - ldlm_init(); - RETURN(0); + lustre_assert_wire_constants(); +#if RS_DEBUG + spin_lock_init(&ptlrpc_rs_debug_lock); +#endif + INIT_LIST_HEAD(&ptlrpc_all_services); + mutex_init(&ptlrpc_all_services_mutex); + mutex_init(&pinger_mutex); + mutex_init(&ptlrpcd_mutex); + ptlrpc_init_xid(); + + rc = req_layout_init(); + if (rc) + RETURN(rc); + + rc = tgt_mod_init(); + if (rc) + GOTO(err_layout, rc); + + rc = ptlrpc_hr_init(); + if (rc) + GOTO(err_tgt, rc); + + rc = ptlrpc_request_cache_init(); + if (rc) + GOTO(err_hr, rc); + + rc = ptlrpc_init_portals(); + if (rc) + GOTO(err_cache, rc); + + rc = ptlrpc_connection_init(); + if (rc) + GOTO(err_portals, rc); + + ptlrpc_put_connection_superhack = ptlrpc_connection_put; + + rc = ptlrpc_start_pinger(); + if (rc) + GOTO(err_conn, rc); + + rc = ldlm_init(); + if (rc) + GOTO(err_pinger, rc); + + rc = sptlrpc_init(); + if (rc) + GOTO(err_ldlm, rc); + + rc = ptlrpc_nrs_init(); + if (rc) + GOTO(err_sptlrpc, rc); + + rc = nodemap_mod_init(); + if (rc) + GOTO(err_nrs, rc); + + RETURN(0); +err_nrs: + ptlrpc_nrs_fini(); +err_sptlrpc: + sptlrpc_fini(); +err_ldlm: + ldlm_exit(); +err_pinger: + ptlrpc_stop_pinger(); +err_conn: + ptlrpc_connection_fini(); +err_portals: + ptlrpc_exit_portals(); +err_cache: + ptlrpc_request_cache_fini(); +err_hr: + ptlrpc_hr_fini(); +err_tgt: + tgt_mod_exit(); +err_layout: + req_layout_fini(); + return rc; } -#ifdef __KERNEL__ static void __exit ptlrpc_exit(void) { - ldlm_exit(); - ptlrpc_stop_pinger(); - ptlrpc_exit_portals(); - ptlrpc_cleanup_connection(); - llog_cleanup_commit_master(0); + nodemap_mod_exit(); + ptlrpc_nrs_fini(); + sptlrpc_fini(); + ldlm_exit(); + ptlrpc_stop_pinger(); + ptlrpc_exit_portals(); + ptlrpc_request_cache_fini(); + ptlrpc_hr_fini(); + ptlrpc_connection_fini(); + tgt_mod_exit(); + req_layout_fini(); } -/* connection.c */ -EXPORT_SYMBOL(ptlrpc_dump_connections); -EXPORT_SYMBOL(ptlrpc_readdress_connection); -EXPORT_SYMBOL(ptlrpc_get_connection); -EXPORT_SYMBOL(ptlrpc_put_connection); -EXPORT_SYMBOL(ptlrpc_connection_addref); -EXPORT_SYMBOL(ptlrpc_init_connection); -EXPORT_SYMBOL(ptlrpc_cleanup_connection); - -/* niobuf.c */ -EXPORT_SYMBOL(ptlrpc_start_bulk_transfer); -EXPORT_SYMBOL(ptlrpc_abort_bulk); -EXPORT_SYMBOL(ptlrpc_register_bulk); -EXPORT_SYMBOL(ptlrpc_unregister_bulk); -EXPORT_SYMBOL(ptlrpc_send_reply); -EXPORT_SYMBOL(ptlrpc_reply); -EXPORT_SYMBOL(ptlrpc_error); -EXPORT_SYMBOL(ptlrpc_resend_req); -EXPORT_SYMBOL(ptl_send_rpc); - -/* client.c */ -EXPORT_SYMBOL(ptlrpc_init_client); -EXPORT_SYMBOL(ptlrpc_cleanup_client); -EXPORT_SYMBOL(ptlrpc_uuid_to_connection); -EXPORT_SYMBOL(ptlrpc_queue_wait); -EXPORT_SYMBOL(ptlrpc_replay_req); -EXPORT_SYMBOL(ptlrpc_restart_req); -EXPORT_SYMBOL(ptlrpc_prep_req); -EXPORT_SYMBOL(ptlrpc_free_req); -EXPORT_SYMBOL(ptlrpc_unregister_reply); -EXPORT_SYMBOL(ptlrpc_req_finished); -EXPORT_SYMBOL(ptlrpc_req_finished_with_imp_lock); -EXPORT_SYMBOL(ptlrpc_request_addref); -EXPORT_SYMBOL(ptlrpc_prep_bulk_imp); -EXPORT_SYMBOL(ptlrpc_prep_bulk_exp); -EXPORT_SYMBOL(ptlrpc_free_bulk); -EXPORT_SYMBOL(ptlrpc_prep_bulk_page); -EXPORT_SYMBOL(ptlrpc_abort_inflight); -EXPORT_SYMBOL(ptlrpc_retain_replayable_request); -EXPORT_SYMBOL(ptlrpc_next_xid); - -EXPORT_SYMBOL(ptlrpc_prep_set); -EXPORT_SYMBOL(ptlrpc_set_add_req); -EXPORT_SYMBOL(ptlrpc_set_add_new_req); -EXPORT_SYMBOL(ptlrpc_set_destroy); -EXPORT_SYMBOL(ptlrpc_set_next_timeout); -EXPORT_SYMBOL(ptlrpc_check_set); -EXPORT_SYMBOL(ptlrpc_set_wait); -EXPORT_SYMBOL(ptlrpc_expired_set); -EXPORT_SYMBOL(ptlrpc_interrupted_set); -EXPORT_SYMBOL(ptlrpc_mark_interrupted); - -/* service.c */ -EXPORT_SYMBOL(ptlrpc_save_lock); -EXPORT_SYMBOL(ptlrpc_schedule_difficult_reply); -EXPORT_SYMBOL(ptlrpc_commit_replies); -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); - -/* pack_generic.c */ -EXPORT_SYMBOL(lustre_msg_swabbed); -EXPORT_SYMBOL(lustre_pack_request); -EXPORT_SYMBOL(lustre_pack_reply); -EXPORT_SYMBOL(lustre_free_reply_state); -EXPORT_SYMBOL(lustre_msg_size); -EXPORT_SYMBOL(lustre_unpack_msg); -EXPORT_SYMBOL(lustre_msg_buf); -EXPORT_SYMBOL(lustre_msg_string); -EXPORT_SYMBOL(lustre_swab_buf); -EXPORT_SYMBOL(lustre_swab_reqbuf); -EXPORT_SYMBOL(lustre_swab_repbuf); -EXPORT_SYMBOL(lustre_swab_obdo); -EXPORT_SYMBOL(lustre_swab_obd_statfs); -EXPORT_SYMBOL(lustre_swab_obd_ioobj); -EXPORT_SYMBOL(lustre_swab_niobuf_remote); -EXPORT_SYMBOL(lustre_swab_ost_body); -EXPORT_SYMBOL(lustre_swab_ost_last_id); -EXPORT_SYMBOL(lustre_swab_ost_lvb); -EXPORT_SYMBOL(lustre_swab_ll_fid); -EXPORT_SYMBOL(lustre_swab_mds_status_req); -EXPORT_SYMBOL(lustre_swab_mds_body); -EXPORT_SYMBOL(lustre_swab_mds_rec_setattr); -EXPORT_SYMBOL(lustre_swab_mds_rec_create); -EXPORT_SYMBOL(lustre_swab_mds_rec_link); -EXPORT_SYMBOL(lustre_swab_mds_rec_unlink); -EXPORT_SYMBOL(lustre_swab_mds_rec_rename); -EXPORT_SYMBOL(lustre_swab_lov_desc); -EXPORT_SYMBOL(lustre_swab_ldlm_res_id); -EXPORT_SYMBOL(lustre_swab_ldlm_policy_data); -EXPORT_SYMBOL(lustre_swab_ldlm_intent); -EXPORT_SYMBOL(lustre_swab_ldlm_resource_desc); -EXPORT_SYMBOL(lustre_swab_ldlm_lock_desc); -EXPORT_SYMBOL(lustre_swab_ldlm_request); -EXPORT_SYMBOL(lustre_swab_ldlm_reply); -EXPORT_SYMBOL(lustre_swab_ptlbd_op); -EXPORT_SYMBOL(lustre_swab_ptlbd_niob); -EXPORT_SYMBOL(lustre_swab_ptlbd_rsp); - -/* recover.c */ -EXPORT_SYMBOL(ptlrpc_run_recovery_over_upcall); -EXPORT_SYMBOL(ptlrpc_run_failed_import_upcall); -EXPORT_SYMBOL(ptlrpc_disconnect_import); -EXPORT_SYMBOL(ptlrpc_resend); -EXPORT_SYMBOL(ptlrpc_wake_delayed); -EXPORT_SYMBOL(ptlrpc_set_import_active); -EXPORT_SYMBOL(ptlrpc_fail_import); -EXPORT_SYMBOL(ptlrpc_fail_export); -EXPORT_SYMBOL(ptlrpc_recover_import); - -/* pinger.c */ -EXPORT_SYMBOL(ptlrpc_pinger_add_import); -EXPORT_SYMBOL(ptlrpc_pinger_del_import); -EXPORT_SYMBOL(ptlrpc_pinger_sending_on_import); - -/* ptlrpcd.c */ -EXPORT_SYMBOL(ptlrpcd_addref); -EXPORT_SYMBOL(ptlrpcd_decref); -EXPORT_SYMBOL(ptlrpcd_add_req); -EXPORT_SYMBOL(ptlrpcd_wake); - -/* lproc_ptlrpc.c */ -EXPORT_SYMBOL(ptlrpc_lprocfs_register_obd); -EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd); - -/* llogd.c */ -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); -EXPORT_SYMBOL(llog_catinfo); - -MODULE_AUTHOR("Cluster File Systems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre Request Processor and Lock Management"); +MODULE_VERSION(LUSTRE_VERSION_STRING); MODULE_LICENSE("GPL"); module_init(ptlrpc_init); module_exit(ptlrpc_exit); -#endif