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 the Lustre file system, http://www.lustre.org
7 * Lustre is a trademark of Cluster File Systems, Inc.
9 * You may have signed or agreed to another license before downloading
10 * this software. If so, you are bound by the terms and conditions
11 * of that agreement, and the following does not apply to you. See the
12 * LICENSE file included with this distribution for more information.
14 * If you did not agree to a different license, then this copy of Lustre
15 * is open source software; you can redistribute it and/or modify it
16 * under the terms of version 2 of the GNU General Public License as
17 * published by the Free Software Foundation.
19 * In either case, Lustre is distributed in the hope that it will be
20 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
21 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * license text for more details.
26 /* Intramodule declarations for ptlrpc. */
28 #ifndef PTLRPC_INTERNAL_H
29 #define PTLRPC_INTERNAL_H
31 #include "../ldlm/ldlm_internal.h"
33 struct ldlm_namespace;
36 struct ptlrpc_request_set;
37 extern int test_req_buffer_pressure;
39 void ptlrpc_request_handle_notconn(struct ptlrpc_request *);
40 void lustre_assert_wire_constants(void);
41 int ptlrpc_import_in_recovery(struct obd_import *imp);
42 int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt);
43 void ptlrpc_handle_failed_import(struct obd_import *imp);
44 int ptlrpc_replay_next(struct obd_import *imp, int *inflight);
45 void ptlrpc_initiate_recovery(struct obd_import *imp);
47 int lustre_unpack_req_ptlrpc_body(struct ptlrpc_request *req, int offset);
48 int lustre_unpack_rep_ptlrpc_body(struct ptlrpc_request *req, int offset);
52 void ptlrpc_lprocfs_register_service(struct proc_dir_entry *proc_entry,
53 struct ptlrpc_service *svc);
54 void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc);
55 void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req);
56 void ptlrpc_lprocfs_do_request_stat (struct ptlrpc_request *req,
57 long q_usec, long work_usec);
59 #define ptlrpc_lprocfs_register_service(params...) do{}while(0)
60 #define ptlrpc_lprocfs_unregister_service(params...) do{}while(0)
61 #define ptlrpc_lprocfs_rpc_sent(params...) do{}while(0)
62 #define ptlrpc_lprocfs_do_request_stat(params...) do{}while(0)
67 static inline int opcode_offset(__u32 opc) {
68 if (opc < OST_LAST_OPC) {
70 return (opc - OST_FIRST_OPC);
71 } else if (opc < MDS_LAST_OPC) {
73 return (opc - MDS_FIRST_OPC +
74 (OST_LAST_OPC - OST_FIRST_OPC));
75 } else if (opc < LDLM_LAST_OPC) {
77 return (opc - LDLM_FIRST_OPC +
78 (MDS_LAST_OPC - MDS_FIRST_OPC) +
79 (OST_LAST_OPC - OST_FIRST_OPC));
80 } else if (opc < MGS_LAST_OPC) {
82 return (opc - MGS_FIRST_OPC +
83 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
84 (MDS_LAST_OPC - MDS_FIRST_OPC) +
85 (OST_LAST_OPC - OST_FIRST_OPC));
86 } else if (opc < OBD_LAST_OPC) {
88 return (opc - OBD_FIRST_OPC +
89 (MGS_LAST_OPC - MGS_FIRST_OPC) +
90 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
91 (MDS_LAST_OPC - MDS_FIRST_OPC) +
92 (OST_LAST_OPC - OST_FIRST_OPC));
93 } else if (opc < LLOG_LAST_OPC) {
95 return (opc - LLOG_FIRST_OPC +
96 (OBD_LAST_OPC - OBD_FIRST_OPC) +
97 (MGS_LAST_OPC - MGS_FIRST_OPC) +
98 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
99 (MDS_LAST_OPC - MDS_FIRST_OPC) +
100 (OST_LAST_OPC - OST_FIRST_OPC));
107 #define LUSTRE_MAX_OPCODES ((OST_LAST_OPC - OST_FIRST_OPC) + \
108 (MDS_LAST_OPC - MDS_FIRST_OPC) + \
109 (LDLM_LAST_OPC - LDLM_FIRST_OPC) + \
110 (MGS_LAST_OPC - MGS_FIRST_OPC) + \
111 (OBD_LAST_OPC - OBD_FIRST_OPC) + \
112 (LLOG_LAST_OPC - LLOG_FIRST_OPC))
115 PTLRPC_REQWAIT_CNTR = 0,
116 PTLRPC_REQQDEPTH_CNTR,
117 PTLRPC_REQACTIVE_CNTR,
119 PTLRPC_REQBUF_AVAIL_CNTR,
123 int ptlrpc_expire_one_request(struct ptlrpc_request *req);
126 void ptlrpc_fill_bulk_md(lnet_md_t *md, struct ptlrpc_bulk_desc *desc);
127 void ptlrpc_add_bulk_page(struct ptlrpc_bulk_desc *desc, cfs_page_t *page,
128 int pageoffset, int len);
129 void ptl_rpc_wipe_bulk_pages(struct ptlrpc_bulk_desc *desc);
132 int ptlrpc_start_pinger(void);
133 int ptlrpc_stop_pinger(void);
134 void ptlrpc_pinger_sending_on_import(struct obd_import *imp);
135 void ptlrpc_pinger_wake_up(void);
136 void ptlrpc_ping_import_soon(struct obd_import *imp);
138 int ping_evictor_wake(struct obd_export *exp);
140 #define ping_evictor_wake(exp) 1
143 #endif /* PTLRPC_INTERNAL_H */