Whamcloud - gitweb
add conf-sanity.sh to acceptance-small.sh
[fs/lustre-release.git] / lustre / ptlrpc / ptlrpc_internal.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2003 Cluster File Systems, Inc.
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
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.
11  *
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.
16  *
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.
20  *
21  */
22
23 /* Intramodule declarations for ptlrpc. */
24
25 #ifndef PTLRPC_INTERNAL_H
26 #define PTLRPC_INTERNAL_H
27
28 #include "../ldlm/ldlm_internal.h"
29
30 struct ldlm_namespace;
31 struct obd_import;
32 struct ldlm_res_id;
33 struct ptlrpc_request_set;
34
35 void ptlrpc_daemonize(void);
36
37 void ptlrpc_request_handle_notconn(struct ptlrpc_request *);
38 void lustre_assert_wire_constants(void);
39
40 #ifdef __KERNEL__
41 void ptlrpc_lprocfs_register_service(struct proc_dir_entry *proc_entry,
42                                      struct ptlrpc_service *svc);
43 void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc);
44 void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req);
45 void ptlrpc_lprocfs_do_request_stat (struct ptlrpc_request *req,
46                                      long q_usec, long work_usec);
47 #else
48 #define ptlrpc_lprocfs_register_service(params...) do{}while(0)
49 #define ptlrpc_lprocfs_unregister_service(params...) do{}while(0)
50 #define ptlrpc_lprocfs_rpc_sent(params...) do{}while(0)
51 #define ptlrpc_lprocfs_do_request_stat(params...) do{}while(0)
52 #endif /* __KERNEL__ */
53
54 /* recovd_thread.c */
55 int llog_init_commit_master(void);
56 int llog_cleanup_commit_master(int force);
57
58 static inline int opcode_offset(__u32 opc) {
59         if (opc < OST_LAST_OPC) {
60                  /* OST opcode */
61                 return (opc - OST_FIRST_OPC);
62         } else if (opc < MDS_LAST_OPC) {
63                 /* MDS opcode */
64                 return (opc - MDS_FIRST_OPC +
65                         (OST_LAST_OPC - OST_FIRST_OPC));
66         } else if (opc < LDLM_LAST_OPC) {
67                 /* LDLM Opcode */
68                 return (opc - LDLM_FIRST_OPC +
69                         (MDS_LAST_OPC - MDS_FIRST_OPC) +
70                         (OST_LAST_OPC - OST_FIRST_OPC));
71         } else if (opc < PTLBD_LAST_OPC) {
72                 /* Portals Block Device */
73                 return (opc - PTLBD_FIRST_OPC +
74                         (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
75                         (MDS_LAST_OPC - MDS_FIRST_OPC) +
76                         (OST_LAST_OPC - OST_FIRST_OPC));
77         } else if (opc < OBD_LAST_OPC) {
78                 /* OBD Ping */
79                 return (opc - OBD_FIRST_OPC +
80                         (PTLBD_LAST_OPC - PTLBD_FIRST_OPC) +
81                         (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
82                         (MDS_LAST_OPC - MDS_FIRST_OPC) +
83                         (OST_LAST_OPC - OST_FIRST_OPC));
84         } else {
85                 /* Unknown Opcode */
86                 return -1;
87         }
88 }
89
90 #define LUSTRE_MAX_OPCODES ((PTLBD_LAST_OPC - PTLBD_FIRST_OPC) + \
91                             (LDLM_LAST_OPC - LDLM_FIRST_OPC)   + \
92                             (MDS_LAST_OPC - MDS_FIRST_OPC)     + \
93                             (OST_LAST_OPC - OST_FIRST_OPC)     + \
94                             (OBD_LAST_OPC - OBD_FIRST_OPC))
95
96 enum {
97         PTLRPC_REQWAIT_CNTR     = 0,
98         PTLRPC_SVCIDLETIME_CNTR = 1,
99         //PTLRPC_SVCEQDEPTH_CNTR,
100         PTLRPC_LAST_CNTR
101 };
102
103 int ptlrpc_expire_one_request(struct ptlrpc_request *req);
104
105 /* pinger.c */
106 int ptlrpc_start_pinger(void);
107 int ptlrpc_stop_pinger(void);
108 void ptlrpc_pinger_sending_on_import(struct obd_import *imp);
109
110 #endif /* PTLRPC_INTERNAL_H */