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 struct ldlm_namespace;
31 struct ptlrpc_request_set;
33 /* ldlm hooks that we need, managed via inter_module_{get,put} */
34 extern int (*ptlrpc_ldlm_namespace_cleanup)(struct ldlm_namespace *, int);
35 extern int (*ptlrpc_ldlm_cli_cancel_unused)(struct ldlm_namespace *,
36 struct ldlm_res_id *, int);
37 extern int (*ptlrpc_ldlm_replay_locks)(struct obd_import *);
39 int ptlrpc_get_ldlm_hooks(void);
40 void ptlrpc_daemonize(void);
42 void ptlrpc_request_handle_eviction(struct ptlrpc_request *);
43 void lustre_assert_wire_constants (void);
45 void ptlrpc_lprocfs_register_service(struct obd_device *obddev,
46 struct ptlrpc_service *svc);
47 void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc);
50 static inline int opcode_offset(__u32 opc) {
51 if (opc < OST_LAST_OPC) {
53 return (opc - OST_FIRST_OPC);
54 } else if (opc < MDS_LAST_OPC) {
56 return (opc - MDS_FIRST_OPC +
57 (OST_LAST_OPC - OST_FIRST_OPC));
58 } else if (opc < LDLM_LAST_OPC) {
60 return (opc - LDLM_FIRST_OPC +
61 (MDS_LAST_OPC - MDS_FIRST_OPC) +
62 (OST_LAST_OPC - OST_FIRST_OPC));
63 } else if (opc < PTLBD_LAST_OPC) {
64 /* Portals Block Device */
65 return (opc - PTLBD_FIRST_OPC +
66 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
67 (MDS_LAST_OPC - MDS_FIRST_OPC) +
68 (OST_LAST_OPC - OST_FIRST_OPC));
69 } else if (opc == OBD_PING) {
71 return (opc - OBD_PING +
72 (PTLBD_LAST_OPC - PTLBD_FIRST_OPC) +
73 (LDLM_LAST_OPC - LDLM_FIRST_OPC) +
74 (MDS_LAST_OPC - MDS_FIRST_OPC) +
75 (OST_LAST_OPC - OST_FIRST_OPC));
82 #define LUSTRE_MAX_OPCODES (1 + (PTLBD_LAST_OPC - PTLBD_FIRST_OPC) \
83 + (LDLM_LAST_OPC - LDLM_FIRST_OPC) \
84 + (MDS_LAST_OPC - MDS_FIRST_OPC) \
85 + (OST_LAST_OPC - OST_FIRST_OPC))
88 PTLRPC_REQWAIT_CNTR = 0,
89 PTLRPC_SVCIDLETIME_CNTR = 1,
90 //PTLRPC_SVCEQDEPTH_CNTR,
94 int ptlrpc_expire_one_request(struct ptlrpc_request *req);
95 int ptlrpc_check_set(struct ptlrpc_request_set *set);
97 void ptlrpc_pinger_sending_on_import(struct obd_import *imp);
98 #endif /* PTLRPC_INTERNAL_H */