1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2003 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 /* Intramodule declarations for ptlrpc. */
25 #ifndef PTLRPC_INTERNAL_H
26 #define PTLRPC_INTERNAL_H
28 #include "../ldlm/ldlm_internal.h"
30 struct ldlm_namespace;
33 struct ptlrpc_request_set;
35 void ptlrpc_request_handle_notconn(struct ptlrpc_request *);
36 void lustre_assert_wire_constants(void);
37 int ptlrpc_import_in_recovery(struct obd_import *imp);
38 int ptlrpc_set_import_discon(struct obd_import *imp);
39 void ptlrpc_handle_failed_import(struct obd_import *imp);
40 int ptlrpc_replay_next(struct obd_import *imp, int *inflight);
41 void ptlrpc_initiate_recovery(struct obd_import *imp);
45 void ptlrpc_lprocfs_register_service(struct proc_dir_entry *proc_entry,
46 struct ptlrpc_service *svc);
47 void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc);
48 void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req);
49 void ptlrpc_lprocfs_do_request_stat (struct ptlrpc_request *req,
50 long q_usec, long work_usec);
52 #define ptlrpc_lprocfs_register_service(params...) do{}while(0)
53 #define ptlrpc_lprocfs_unregister_service(params...) do{}while(0)
54 #define ptlrpc_lprocfs_rpc_sent(params...) do{}while(0)
55 #define ptlrpc_lprocfs_do_request_stat(params...) do{}while(0)
56 #endif /* __KERNEL__ */
59 int llog_init_commit_master(void);
60 int llog_cleanup_commit_master(int force);
62 static inline int opcode_offset(__u32 opc) {
63 if (opc < OST_LAST_OPC) {
65 return (opc - OST_FIRST_OPC);
66 } else if (opc < MDS_LAST_OPC) {
68 return (opc - MDS_FIRST_OPC +
69 (OST_LAST_OPC - OST_FIRST_OPC));
70 } else if (opc < LDLM_LAST_OPC) {
72 return (opc - LDLM_FIRST_OPC +
73 (MDS_LAST_OPC - MDS_FIRST_OPC) +
74 (OST_LAST_OPC - OST_FIRST_OPC));
75 } else if (opc < PTLBD_LAST_OPC) {
76 /* Portals Block Device */
77 return (opc - PTLBD_FIRST_OPC +
78 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
79 (MDS_LAST_OPC - MDS_FIRST_OPC) +
80 (OST_LAST_OPC - OST_FIRST_OPC));
81 } else if (opc < OBD_LAST_OPC) {
83 return (opc - OBD_FIRST_OPC +
84 (PTLBD_LAST_OPC - PTLBD_FIRST_OPC) +
85 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
86 (MDS_LAST_OPC - MDS_FIRST_OPC) +
87 (OST_LAST_OPC - OST_FIRST_OPC));
88 } else if (opc < SEC_LAST_OPC) {
89 /* Security negotiate */
90 return (opc - SEC_FIRST_OPC +
91 (PTLBD_LAST_OPC - PTLBD_FIRST_OPC) +
92 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
93 (MDS_LAST_OPC - MDS_FIRST_OPC) +
94 (OST_LAST_OPC - OST_FIRST_OPC) +
95 (OBD_LAST_OPC - OBD_FIRST_OPC));
102 #define LUSTRE_MAX_OPCODES ((PTLBD_LAST_OPC - PTLBD_FIRST_OPC) + \
103 (LDLM_LAST_OPC - LDLM_FIRST_OPC) + \
104 (MDS_LAST_OPC - MDS_FIRST_OPC) + \
105 (OST_LAST_OPC - OST_FIRST_OPC) + \
106 (OBD_LAST_OPC - OBD_FIRST_OPC) + \
107 (SEC_LAST_OPC - SEC_FIRST_OPC))
110 PTLRPC_REQWAIT_CNTR = 0,
111 PTLRPC_REQQDEPTH_CNTR,
112 PTLRPC_REQACTIVE_CNTR,
113 PTLRPC_REQBUF_AVAIL_CNTR,
117 int ptlrpc_expire_one_request(struct ptlrpc_request *req);
120 void ptlrpc_fill_bulk_md(ptl_md_t *md, struct ptlrpc_bulk_desc *desc);
121 void ptlrpc_add_bulk_page(struct ptlrpc_bulk_desc *desc, struct page *page,
122 int pageoffset, int len);
125 int ptlrpc_start_pinger(void);
126 int ptlrpc_stop_pinger(void);
127 void ptlrpc_pinger_sending_on_import(struct obd_import *imp);
128 void ptlrpc_pinger_wake_up(void);
130 #endif /* PTLRPC_INTERNAL_H */