Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / include / lustre_net.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2002, 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 #ifndef _LUSTRE_NET_H
24 #define _LUSTRE_NET_H
25
26 #if defined(__linux__)
27 #include <linux/lustre_net.h>
28 #elif defined(__APPLE__)
29 #include <darwin/lustre_net.h>
30 #elif defined(__WINNT__)
31 #include <winnt/lustre_net.h>
32 #else
33 #error Unsupported operating system.
34 #endif
35
36 #include <libcfs/kp30.h>
37 // #include <obd.h>
38 #include <lnet/lnet.h>
39 #include <lustre/lustre_idl.h>
40 #include <lustre_ha.h>
41 #include <lustre_sec.h>
42 #include <lustre_import.h>
43 #include <lprocfs_status.h>
44 #include <lu_object.h>
45 #include <lustre_req_layout.h>
46
47 /* MD flags we _always_ use */
48 #define PTLRPC_MD_OPTIONS  0
49
50 /* Define maxima for bulk I/O
51  * CAVEAT EMPTOR, with multinet (i.e. routers forwarding between networks)
52  * these limits are system wide and not interface-local. */
53 #define PTLRPC_MAX_BRW_BITS     LNET_MTU_BITS
54 #define PTLRPC_MAX_BRW_SIZE     (1<<LNET_MTU_BITS)
55 #define PTLRPC_MAX_BRW_PAGES    (PTLRPC_MAX_BRW_SIZE >> CFS_PAGE_SHIFT)
56
57 /* When PAGE_SIZE is a constant, we can check our arithmetic here with cpp! */
58 #ifdef __KERNEL__
59 # if ((PTLRPC_MAX_BRW_PAGES & (PTLRPC_MAX_BRW_PAGES - 1)) != 0)
60 #  error "PTLRPC_MAX_BRW_PAGES isn't a power of two"
61 # endif
62 # if (PTLRPC_MAX_BRW_SIZE != (PTLRPC_MAX_BRW_PAGES * CFS_PAGE_SIZE))
63 #  error "PTLRPC_MAX_BRW_SIZE isn't PTLRPC_MAX_BRW_PAGES * CFS_PAGE_SIZE"
64 # endif
65 # if (PTLRPC_MAX_BRW_SIZE > LNET_MTU)
66 #  error "PTLRPC_MAX_BRW_SIZE too big"
67 # endif
68 # if (PTLRPC_MAX_BRW_PAGES > LNET_MAX_IOV)
69 #  error "PTLRPC_MAX_BRW_PAGES too big"
70 # endif
71 #endif /* __KERNEL__ */
72
73 /* Size over which to OBD_VMALLOC() rather than OBD_ALLOC() service request
74  * buffers */
75 #define SVC_BUF_VMALLOC_THRESHOLD (2 * CFS_PAGE_SIZE)
76
77 /* The following constants determine how memory is used to buffer incoming
78  * service requests.
79  *
80  * ?_NBUFS              # buffers to allocate when growing the pool
81  * ?_BUFSIZE            # bytes in a single request buffer
82  * ?_MAXREQSIZE         # maximum request service will receive
83  *
84  * When fewer than ?_NBUFS/2 buffers are posted for receive, another chunk
85  * of ?_NBUFS is added to the pool.
86  *
87  * Messages larger than ?_MAXREQSIZE are dropped.  Request buffers are
88  * considered full when less than ?_MAXREQSIZE is left in them.
89  */
90
91 #define LDLM_THREADS_AUTO_MIN                                                 \
92         min((int)(num_online_cpus() * num_online_cpus() * 2), 8)
93 #define LDLM_THREADS_AUTO_MAX (LDLM_THREADS_AUTO_MIN * 16)
94 #define LDLM_BL_THREADS  LDLM_THREADS_AUTO_MIN
95 #define LDLM_NBUFS      (64 * num_online_cpus())
96 #define LDLM_BUFSIZE    (8 * 1024)
97 #define LDLM_MAXREQSIZE (5 * 1024)
98 #define LDLM_MAXREPSIZE (1024)
99
100 #define MDT_MIN_THREADS 2UL
101 #define MDT_MAX_THREADS 512UL
102 #define MDT_NUM_THREADS max(min_t(unsigned long, MDT_MAX_THREADS, \
103                                   num_physpages >> (25 - PAGE_SHIFT)), 2UL)
104 #define FLD_NUM_THREADS max(min_t(unsigned long, MDT_MAX_THREADS, \
105                                   num_physpages >> (25 - PAGE_SHIFT)), 2UL)
106 #define SEQ_NUM_THREADS max(min_t(unsigned long, MDT_MAX_THREADS, \
107                                   num_physpages >> (25 - PAGE_SHIFT)), 2UL)
108
109 /* Absolute limits */
110 #define MDS_THREADS_MIN 2
111 #define MDS_THREADS_MAX 512
112 #define MDS_THREADS_MIN_READPAGE 2
113 #define MDS_NBUFS       (64 * num_online_cpus())
114 #define MDS_BUFSIZE     (8 * 1024)
115 /* Assume file name length = FNAME_MAX = 256 (true for ext3).
116  *        path name length = PATH_MAX = 4096
117  *        LOV MD size max  = EA_MAX = 4000
118  * symlink:  FNAME_MAX + PATH_MAX  <- largest
119  * link:     FNAME_MAX + PATH_MAX  (mds_rec_link < mds_rec_create)
120  * rename:   FNAME_MAX + FNAME_MAX
121  * open:     FNAME_MAX + EA_MAX
122  *
123  * MDS_MAXREQSIZE ~= 4736 bytes =
124  * lustre_msg + ldlm_request + mds_body + mds_rec_create + FNAME_MAX + PATH_MAX
125  * MDS_MAXREPSIZE ~= 8300 bytes = lustre_msg + llog_header
126  * or, for mds_close() and mds_reint_unlink() on a many-OST filesystem:
127  *      = 9210 bytes = lustre_msg + mds_body + 160 * (easize + cookiesize)
128  *
129  * Realistic size is about 512 bytes (20 character name + 128 char symlink),
130  * except in the open case where there are a large number of OSTs in a LOV.
131  */
132 #define MDS_MAXREQSIZE  (5 * 1024)
133 #define MDS_MAXREPSIZE  max(9 * 1024, 280 + LOV_MAX_STRIPE_COUNT * 56)
134
135 /* FLD_MAXREQSIZE == lustre_msg + __u32 padding + ptlrpc_body + opc + md_fld */
136 #define FLD_MAXREQSIZE  (160)
137
138 /* FLD_MAXREPSIZE == lustre_msg + ptlrpc_body + md_fld */
139 #define FLD_MAXREPSIZE  (152)
140
141 /* SEQ_MAXREQSIZE == lustre_msg + __u32 padding + ptlrpc_body + opc + lu_range +
142  * __u32 padding */
143 #define SEQ_MAXREQSIZE  (160)
144
145 /* SEQ_MAXREPSIZE == lustre_msg + ptlrpc_body + lu_range */
146 #define SEQ_MAXREPSIZE  (152)
147
148 #define MGS_THREADS_AUTO_MIN 2
149 #define MGS_THREADS_AUTO_MAX 32
150 #define MGS_NBUFS       (64 * num_online_cpus())
151 #define MGS_BUFSIZE     (8 * 1024)
152 #define MGS_MAXREQSIZE  (7 * 1024)
153 #define MGS_MAXREPSIZE  (9 * 1024)
154
155 /* Absolute limits */
156 #define OSS_THREADS_MIN 2
157 #define OSS_THREADS_MAX 512
158 #define OST_NBUFS       (64 * num_online_cpus())
159 #define OST_BUFSIZE     (8 * 1024)
160 /* OST_MAXREQSIZE ~= 4768 bytes =
161  * lustre_msg + obdo + 16 * obd_ioobj + 256 * niobuf_remote
162  *
163  * - single object with 16 pages is 512 bytes
164  * - OST_MAXREQSIZE must be at least 1 page of cookies plus some spillover
165  */
166 #define OST_MAXREQSIZE  (5 * 1024)
167 #define OST_MAXREPSIZE  (9 * 1024)
168
169 struct ptlrpc_connection {
170         struct list_head        c_link;
171         struct hlist_node       c_hash;
172         lnet_nid_t              c_self;
173         lnet_process_id_t       c_peer;
174         struct obd_uuid         c_remote_uuid;
175         atomic_t                c_refcount;
176 };
177
178 struct ptlrpc_client {
179         __u32                     cli_request_portal;
180         __u32                     cli_reply_portal;
181         char                     *cli_name;
182 };
183
184 /* state flags of requests */
185 /* XXX only ones left are those used by the bulk descs as well! */
186 #define PTL_RPC_FL_INTR      (1 << 0)  /* reply wait was interrupted by user */
187 #define PTL_RPC_FL_TIMEOUT   (1 << 7)  /* request timed out waiting for reply */
188
189 #define REQ_MAX_ACK_LOCKS 8
190
191 union ptlrpc_async_args {
192         /* Scratchpad for passing args to completion interpreter. Users
193          * cast to the struct of their choosing, and LASSERT that this is
194          * big enough.  For _tons_ of context, OBD_ALLOC a struct and store
195          * a pointer to it here.  The pointer_arg ensures this struct is at
196          * least big enough for that. */
197         void      *pointer_arg[9];
198         __u64      space[4];
199 };
200
201 struct ptlrpc_request_set;
202 typedef int (*set_interpreter_func)(struct ptlrpc_request_set *, void *, int);
203
204 struct ptlrpc_request_set {
205         int               set_remaining; /* # uncompleted requests */
206         cfs_waitq_t       set_waitq;
207         cfs_waitq_t      *set_wakeup_ptr;
208         struct list_head  set_requests;
209         struct list_head  set_cblist; /* list of completion callbacks */
210         set_interpreter_func    set_interpret; /* completion callback */
211         void              *set_arg; /* completion context */
212         /* locked so that any old caller can communicate requests to
213          * the set holder who can then fold them into the lock-free set */
214         spinlock_t        set_new_req_lock;
215         struct list_head  set_new_requests;
216 };
217
218 struct ptlrpc_set_cbdata {
219         struct list_head        psc_item;
220         set_interpreter_func    psc_interpret;
221         void                   *psc_data;
222 };
223
224 struct ptlrpc_bulk_desc;
225
226 /*
227  * ptlrpc callback & work item stuff
228  */
229 struct ptlrpc_cb_id {
230         void   (*cbid_fn)(lnet_event_t *ev);     /* specific callback fn */
231         void    *cbid_arg;                      /* additional arg */
232 };
233
234 #define RS_MAX_LOCKS 4
235 #define RS_DEBUG     1
236
237 struct ptlrpc_reply_state {
238         struct ptlrpc_cb_id    rs_cb_id;
239         struct list_head       rs_list;
240         struct list_head       rs_exp_list;
241         struct list_head       rs_obd_list;
242 #if RS_DEBUG
243         struct list_head       rs_debug_list;
244 #endif
245         /* updates to following flag serialised by srv_request_lock */
246         unsigned long          rs_difficult:1;     /* ACK/commit stuff */
247         unsigned long          rs_scheduled:1;     /* being handled? */
248         unsigned long          rs_scheduled_ever:1;/* any schedule attempts? */
249         unsigned long          rs_handled:1;  /* been handled yet? */
250         unsigned long          rs_on_net:1;   /* reply_out_callback pending? */
251         unsigned long          rs_prealloc:1; /* rs from prealloc list */
252
253         int                    rs_size;
254         __u64                  rs_transno;
255         __u64                  rs_xid;
256         struct obd_export     *rs_export;
257         struct ptlrpc_service *rs_service;
258         lnet_handle_md_t       rs_md_h;
259         atomic_t               rs_refcount;
260
261         struct ptlrpc_svc_ctx *rs_svc_ctx;
262         struct lustre_msg     *rs_repbuf;       /* wrapper */
263         int                    rs_repbuf_len;   /* wrapper buf length */
264         int                    rs_repdata_len;  /* wrapper msg length */
265         struct lustre_msg     *rs_msg;          /* reply message */
266
267         /* locks awaiting client reply ACK */
268         int                    rs_nlocks;
269         struct lustre_handle   rs_locks[RS_MAX_LOCKS];
270         ldlm_mode_t            rs_modes[RS_MAX_LOCKS];
271 };
272
273 struct ptlrpc_thread;
274
275 enum rq_phase {
276         RQ_PHASE_NEW         = 0xebc0de00,
277         RQ_PHASE_RPC         = 0xebc0de01,
278         RQ_PHASE_BULK        = 0xebc0de02,
279         RQ_PHASE_INTERPRET   = 0xebc0de03,
280         RQ_PHASE_COMPLETE    = 0xebc0de04,
281 };
282
283 struct ptlrpc_request_pool {
284         spinlock_t prp_lock;
285         struct list_head prp_req_list;    /* list of ptlrpc_request structs */
286         int prp_rq_size;
287         void (*prp_populate)(struct ptlrpc_request_pool *, int);
288 };
289
290 struct lu_context;
291 struct lu_env;
292
293 struct ptlrpc_request {
294         int rq_type; /* one of PTL_RPC_MSG_* */
295         struct list_head rq_list;
296         struct list_head rq_history_list;       /* server-side history */
297         __u64            rq_history_seq;        /* history sequence # */
298         int rq_status;
299         spinlock_t rq_lock;
300         /* client-side flags */
301         unsigned long rq_intr:1, rq_replied:1, rq_err:1,
302                 rq_timedout:1, rq_resend:1, rq_restart:1,
303                 /*
304                  * when ->rq_replay is set, request is kept by the client even
305                  * after server commits corresponding transaction. This is
306                  * used for operations that require sequence of multiple
307                  * requests to be replayed. The only example currently is file
308                  * open/close/dw/setattr. When last request in such a sequence
309                  * is committed, ->rq_replay is cleared on all requests in the
310                  * sequence.
311                  */
312                 rq_replay:1,
313                 /* this is the last request in the sequence. */
314                 rq_sequence:1,
315                 rq_no_resend:1, rq_waiting:1, rq_receiving_reply:1,
316                 rq_no_delay:1, rq_net_err:1, rq_wait_ctx:1;
317         enum rq_phase rq_phase; /* one of RQ_PHASE_* */
318         atomic_t rq_refcount;   /* client-side refcount for SENT race */
319
320         struct ptlrpc_thread *rq_svc_thread; /* initial thread servicing req */
321
322         int rq_request_portal;  /* XXX FIXME bug 249 */
323         int rq_reply_portal;    /* XXX FIXME bug 249 */
324
325         int rq_nob_received; /* client-side # reply bytes actually received  */
326
327         int rq_reqlen;
328         struct lustre_msg *rq_reqmsg;
329
330         int rq_timeout;         /* time to wait for reply (seconds) */
331         int rq_replen;
332         struct lustre_msg *rq_repmsg;
333         __u64 rq_transno;
334         __u64 rq_xid;
335         struct list_head rq_replay_list;
336         struct list_head rq_mod_list;
337
338         struct ptlrpc_cli_ctx   *rq_cli_ctx;     /* client's half ctx */
339         struct ptlrpc_svc_ctx   *rq_svc_ctx;     /* server's half ctx */
340         struct list_head         rq_ctx_chain;   /* link to waited ctx */
341
342         struct sptlrpc_flavor    rq_flvr;        /* client & server */
343         enum lustre_sec_part     rq_sp_from;
344
345         unsigned long            /* client/server security flags */
346                                  rq_ctx_init:1,      /* context initiation */
347                                  rq_ctx_fini:1,      /* context destroy */
348                                  rq_bulk_read:1,     /* request bulk read */
349                                  rq_bulk_write:1,    /* request bulk write */
350                                  /* server authentication flags */
351                                  rq_auth_gss:1,      /* authenticated by gss */
352                                  rq_auth_remote:1,   /* authed as remote user */
353                                  rq_auth_usr_root:1, /* authed as root */
354                                  rq_auth_usr_mdt:1,  /* authed as mdt */
355                                  /* security tfm flags */
356                                  rq_pack_udesc:1,
357                                  rq_pack_bulk:1,
358                                  /* doesn't expect reply FIXME */
359                                  rq_no_reply:1;
360
361         uid_t                    rq_auth_uid;        /* authed uid */
362         uid_t                    rq_auth_mapped_uid; /* authed uid mapped to */
363
364         /* (server side), pointed directly into req buffer */
365         struct ptlrpc_user_desc *rq_user_desc;
366
367         /* various buffer pointers */
368         struct lustre_msg       *rq_reqbuf;      /* req wrapper */
369         int                      rq_reqbuf_len;  /* req wrapper buf len */
370         int                      rq_reqdata_len; /* req wrapper msg len */
371         struct lustre_msg       *rq_repbuf;      /* rep wrapper */
372         int                      rq_repbuf_len;  /* rep wrapper buf len */
373         int                      rq_repdata_len; /* rep wrapper msg len */
374         struct lustre_msg       *rq_clrbuf;      /* only in priv mode */
375         int                      rq_clrbuf_len;  /* only in priv mode */
376         int                      rq_clrdata_len; /* only in priv mode */
377
378         __u32 rq_req_swab_mask;
379         __u32 rq_rep_swab_mask;
380
381         int rq_import_generation;
382         enum lustre_imp_state rq_send_state;
383
384         /* client+server request */
385         lnet_handle_md_t     rq_req_md_h;
386         struct ptlrpc_cb_id  rq_req_cbid;
387
388         /* server-side... */
389         struct timeval       rq_arrival_time;       /* request arrival time */
390         struct ptlrpc_reply_state *rq_reply_state;  /* separated reply state */
391         struct ptlrpc_request_buffer_desc *rq_rqbd; /* incoming request buffer*/
392 #ifdef CRAY_XT3
393         __u32                rq_uid;            /* peer uid, used in MDS only */
394 #endif
395
396         /* client-only incoming reply */
397         lnet_handle_md_t     rq_reply_md_h;
398         cfs_waitq_t          rq_reply_waitq;
399         struct ptlrpc_cb_id  rq_reply_cbid;
400
401         lnet_nid_t           rq_self;
402         lnet_process_id_t    rq_peer;
403         struct obd_export   *rq_export;
404         struct obd_import   *rq_import;
405
406         void (*rq_replay_cb)(struct ptlrpc_request *);
407         void (*rq_commit_cb)(struct ptlrpc_request *);
408         void  *rq_cb_data;
409
410         struct ptlrpc_bulk_desc *rq_bulk;       /* client side bulk */
411         time_t rq_sent;                         /* when request sent, seconds,
412                                                  * or time when request should
413                                                  * be sent */
414         /* Multi-rpc bits */
415         struct list_head rq_set_chain;
416         struct ptlrpc_request_set *rq_set;
417         void *rq_interpret_reply;               /* Async completion handler */
418         union ptlrpc_async_args rq_async_args;  /* Async completion context */
419         struct ptlrpc_request_pool *rq_pool;    /* Pool if request from
420                                                    preallocated list */
421         struct lu_context           rq_session;
422
423         /* request format */
424         struct req_capsule          rq_pill;
425 };
426
427 static inline void ptlrpc_close_replay_seq(struct ptlrpc_request *req)
428 {
429         spin_lock(&req->rq_lock);
430         req->rq_replay = 0;
431         req->rq_sequence = 1;
432         spin_unlock(&req->rq_lock);
433 }
434
435 static inline void lustre_set_req_swabbed(struct ptlrpc_request *req, int index)
436 {
437         LASSERT(index < sizeof(req->rq_req_swab_mask) * 8);
438         LASSERT((req->rq_req_swab_mask & (1 << index)) == 0);
439         req->rq_req_swab_mask |= 1 << index;
440 }
441
442 static inline void lustre_set_rep_swabbed(struct ptlrpc_request *req, int index)
443 {
444         LASSERT(index < sizeof(req->rq_rep_swab_mask) * 8);
445         LASSERT((req->rq_rep_swab_mask & (1 << index)) == 0);
446         req->rq_rep_swab_mask |= 1 << index;
447 }
448
449 static inline int lustre_req_swabbed(struct ptlrpc_request *req, int index)
450
451         LASSERT(index < sizeof(req->rq_req_swab_mask) * 8);
452         return req->rq_req_swab_mask & (1 << index);
453 }
454
455 static inline int lustre_rep_swabbed(struct ptlrpc_request *req, int index)
456 {
457         LASSERT(index < sizeof(req->rq_rep_swab_mask) * 8);
458         return req->rq_rep_swab_mask & (1 << index);
459 }
460
461 static inline const char *
462 ptlrpc_rqphase2str(const struct ptlrpc_request *req)
463 {
464         switch (req->rq_phase) {
465         case RQ_PHASE_NEW:
466                 return "New";
467         case RQ_PHASE_RPC:
468                 return "Rpc";
469         case RQ_PHASE_BULK:
470                 return "Bulk";
471         case RQ_PHASE_INTERPRET:
472                 return "Interpret";
473         case RQ_PHASE_COMPLETE:
474                 return "Complete";
475         default:
476                 return "?Phase?";
477         }
478 }
479
480 /* Spare the preprocessor, spoil the bugs. */
481 #define FLAG(field, str) (field ? str : "")
482
483 #define DEBUG_REQ_FLAGS(req)                                                    \
484         ptlrpc_rqphase2str(req),                                                \
485         FLAG(req->rq_intr, "I"), FLAG(req->rq_replied, "R"),                    \
486         FLAG(req->rq_err, "E"),                                                 \
487         FLAG(req->rq_timedout, "X") /* eXpired */, FLAG(req->rq_resend, "S"),   \
488         FLAG(req->rq_restart, "T"), FLAG(req->rq_replay, "P"),                  \
489         FLAG(req->rq_no_resend, "N"),                                           \
490         FLAG(req->rq_waiting, "W"),                                             \
491         FLAG(req->rq_wait_ctx, "C")
492
493 #define REQ_FLAGS_FMT "%s:%s%s%s%s%s%s%s%s%s%s"
494
495 void _debug_req(struct ptlrpc_request *req, __u32 mask,
496                 struct libcfs_debug_msg_data *data, const char *fmt, ...)
497         __attribute__ ((format (printf, 4, 5)));
498
499 #define debug_req(cdls, level, req, file, func, line, fmt, a...)              \
500 do {                                                                          \
501         CHECK_STACK();                                                        \
502                                                                               \
503         if (((level) & D_CANTMASK) != 0 ||                                    \
504             ((libcfs_debug & (level)) != 0 &&                                 \
505              (libcfs_subsystem_debug & DEBUG_SUBSYSTEM) != 0)) {              \
506                 static struct libcfs_debug_msg_data _req_dbg_data =           \
507                 DEBUG_MSG_DATA_INIT(cdls, DEBUG_SUBSYSTEM, file, func, line); \
508                 _debug_req((req), (level), &_req_dbg_data, fmt, ##a);         \
509         }                                                                     \
510 } while(0)
511
512 /* for most callers (level is a constant) this is resolved at compile time */
513 #define DEBUG_REQ(level, req, fmt, args...)                                   \
514 do {                                                                          \
515         if ((level) & (D_ERROR | D_WARNING)) {                                \
516                 static cfs_debug_limit_state_t cdls;                          \
517                 debug_req(&cdls, level, req, __FILE__, __func__, __LINE__,    \
518                           "@@@ "fmt" ", ## args);                             \
519         } else                                                                \
520                 debug_req(NULL, level, req, __FILE__, __func__, __LINE__,     \
521                           "@@@ "fmt" ", ## args);                             \
522 } while (0)
523
524 struct ptlrpc_bulk_page {
525         struct list_head bp_link;
526         int              bp_buflen;
527         int              bp_pageoffset; /* offset within a page */
528         struct page     *bp_page;
529 };
530
531 #define BULK_GET_SOURCE   0
532 #define BULK_PUT_SINK     1
533 #define BULK_GET_SINK     2
534 #define BULK_PUT_SOURCE   3
535
536 struct ptlrpc_bulk_desc {
537         unsigned long bd_success:1;              /* completed successfully */
538         unsigned long bd_network_rw:1;           /* accessible to the network */
539         unsigned long bd_type:2;                 /* {put,get}{source,sink} */
540         unsigned long bd_registered:1;           /* client side */
541         spinlock_t   bd_lock;                   /* serialise with callback */
542         int bd_import_generation;
543         struct obd_export *bd_export;
544         struct obd_import *bd_import;
545         __u32 bd_portal;
546         struct ptlrpc_request *bd_req;          /* associated request */
547         cfs_waitq_t            bd_waitq;        /* server side only WQ */
548         int                    bd_iov_count;    /* # entries in bd_iov */
549         int                    bd_max_iov;      /* allocated size of bd_iov */
550         int                    bd_nob;          /* # bytes covered */
551         int                    bd_nob_transferred; /* # bytes GOT/PUT */
552
553         __u64                  bd_last_xid;
554
555         struct ptlrpc_cb_id    bd_cbid;         /* network callback info */
556         lnet_handle_md_t       bd_md_h;         /* associated MD */
557         lnet_nid_t             bd_sender;       /* stash event::sender */
558
559         cfs_page_t           **bd_enc_pages;
560 #if defined(__KERNEL__)
561         lnet_kiov_t            bd_iov[0];
562 #else
563         lnet_md_iovec_t        bd_iov[0];
564 #endif
565 };
566
567 struct ptlrpc_thread {
568
569         struct list_head t_link; /* active threads for service, from svc->srv_threads */
570
571         void *t_data;            /* thread-private data (preallocated memory) */
572         __u32 t_flags;
573
574         unsigned int t_id; /* service thread index, from ptlrpc_start_threads */
575         cfs_waitq_t t_ctl_waitq;
576         struct lu_env *t_env;
577 };
578
579 struct ptlrpc_request_buffer_desc {
580         struct list_head       rqbd_list;
581         struct list_head       rqbd_reqs;
582         struct ptlrpc_service *rqbd_service;
583         lnet_handle_md_t       rqbd_md_h;
584         int                    rqbd_refcount;
585         char                  *rqbd_buffer;
586         struct ptlrpc_cb_id    rqbd_cbid;
587         struct ptlrpc_request  rqbd_req;
588 };
589
590 typedef int (*svc_handler_t)(struct ptlrpc_request *req);
591 typedef void (*svcreq_printfn_t)(void *, struct ptlrpc_request *);
592
593 struct ptlrpc_service {
594         struct list_head srv_list;              /* chain thru all services */
595         int              srv_max_req_size;      /* biggest request to receive */
596         int              srv_max_reply_size;    /* biggest reply to send */
597         int              srv_buf_size;          /* size of individual buffers */
598         int              srv_nbuf_per_group;    /* # buffers to allocate in 1 group */
599         int              srv_nbufs;             /* total # req buffer descs allocated */
600         int              srv_threads_min;       /* threads to start at SOW */
601         int              srv_threads_max;       /* thread upper limit */
602         int              srv_threads_started;   /* index of last started thread */
603         int              srv_threads_running;   /* # running threads */
604         int              srv_n_difficult_replies; /* # 'difficult' replies */
605         int              srv_n_active_reqs;     /* # reqs being served */
606         cfs_duration_t   srv_rqbd_timeout;      /* timeout before re-posting reqs, in tick */
607         int              srv_watchdog_timeout; /* soft watchdog timeout, in ms */
608         unsigned         srv_cpu_affinity:1;    /* bind threads to CPUs */
609
610         __u32            srv_req_portal;
611         __u32            srv_rep_portal;
612
613         int               srv_n_queued_reqs;    /* # reqs waiting to be served */
614         struct list_head  srv_request_queue;    /* reqs waiting for service */
615
616         struct list_head  srv_request_history;  /* request history */
617         __u64             srv_request_seq;      /* next request sequence # */
618         __u64             srv_request_max_cull_seq; /* highest seq culled from history */
619         svcreq_printfn_t  srv_request_history_print_fn; /* service-specific print fn */
620
621         struct list_head  srv_idle_rqbds;       /* request buffers to be reposted */
622         struct list_head  srv_active_rqbds;     /* req buffers receiving */
623         struct list_head  srv_history_rqbds;    /* request buffer history */
624         int               srv_nrqbd_receiving;  /* # posted request buffers */
625         int               srv_n_history_rqbds;  /* # request buffers in history */
626         int               srv_max_history_rqbds;/* max # request buffers in history */
627
628         atomic_t          srv_outstanding_replies;
629         struct list_head  srv_active_replies;   /* all the active replies */
630         struct list_head  srv_reply_queue;      /* replies waiting for service */
631
632         cfs_waitq_t       srv_waitq; /* all threads sleep on this. This
633                                       * wait-queue is signalled when new
634                                       * incoming request arrives and when
635                                       * difficult reply has to be handled. */
636
637         struct list_head   srv_threads;         /* service thread list */
638         svc_handler_t      srv_handler;
639
640         char *srv_name; /* only statically allocated strings here; we don't clean them */
641         char *srv_thread_name; /* only statically allocated strings here; we don't clean them */
642
643         spinlock_t               srv_lock;
644
645         cfs_proc_dir_entry_t    *srv_procroot;
646         struct lprocfs_stats    *srv_stats;
647
648         /* List of free reply_states */
649         struct list_head         srv_free_rs_list;
650         /* waitq to run, when adding stuff to srv_free_rs_list */
651         cfs_waitq_t              srv_free_rs_waitq;
652
653         /*
654          * Tags for lu_context associated with this thread, see struct
655          * lu_context.
656          */
657         __u32                    srv_ctx_tags;
658         /*
659          * if non-NULL called during thread creation (ptlrpc_start_thread())
660          * to initialize service specific per-thread state.
661          */
662         int (*srv_init)(struct ptlrpc_thread *thread);
663         /*
664          * if non-NULL called during thread shutdown (ptlrpc_main()) to
665          * destruct state created by ->srv_init().
666          */
667         void (*srv_done)(struct ptlrpc_thread *thread);
668
669         //struct ptlrpc_srv_ni srv_interfaces[0];
670 };
671
672 /* ptlrpc/events.c */
673 extern lnet_handle_eq_t ptlrpc_eq_h;
674 extern int ptlrpc_uuid_to_peer(struct obd_uuid *uuid,
675                                lnet_process_id_t *peer, lnet_nid_t *self);
676 extern void request_out_callback (lnet_event_t *ev);
677 extern void reply_in_callback(lnet_event_t *ev);
678 extern void client_bulk_callback (lnet_event_t *ev);
679 extern void request_in_callback(lnet_event_t *ev);
680 extern void reply_out_callback(lnet_event_t *ev);
681 extern void server_bulk_callback (lnet_event_t *ev);
682
683 /* ptlrpc/connection.c */
684 void ptlrpc_dump_connections(void);
685 void ptlrpc_readdress_connection(struct ptlrpc_connection *, struct obd_uuid *);
686 struct ptlrpc_connection *ptlrpc_get_connection(lnet_process_id_t peer,
687                                                 lnet_nid_t self, struct obd_uuid *uuid);
688 int ptlrpc_put_connection(struct ptlrpc_connection *c);
689 struct ptlrpc_connection *ptlrpc_connection_addref(struct ptlrpc_connection *);
690 int ptlrpc_init_connection(void);
691 void ptlrpc_cleanup_connection(void);
692 extern lnet_pid_t ptl_get_pid(void);
693
694 /* ptlrpc/niobuf.c */
695 int ptlrpc_start_bulk_transfer(struct ptlrpc_bulk_desc *desc);
696 void ptlrpc_abort_bulk(struct ptlrpc_bulk_desc *desc);
697 int ptlrpc_register_bulk(struct ptlrpc_request *req);
698 void ptlrpc_unregister_bulk (struct ptlrpc_request *req);
699
700 static inline int ptlrpc_bulk_active (struct ptlrpc_bulk_desc *desc)
701 {
702         int           rc;
703
704         spin_lock(&desc->bd_lock);
705         rc = desc->bd_network_rw;
706         spin_unlock(&desc->bd_lock);
707         return (rc);
708 }
709
710 int ptlrpc_send_reply(struct ptlrpc_request *req, int);
711 int ptlrpc_reply(struct ptlrpc_request *req);
712 int ptlrpc_error(struct ptlrpc_request *req);
713 void ptlrpc_resend_req(struct ptlrpc_request *request);
714 int ptl_send_rpc(struct ptlrpc_request *request, int noreply);
715 int ptlrpc_register_rqbd (struct ptlrpc_request_buffer_desc *rqbd);
716
717 /* ptlrpc/client.c */
718 void ptlrpc_init_client(int req_portal, int rep_portal, char *name,
719                         struct ptlrpc_client *);
720 void ptlrpc_cleanup_client(struct obd_import *imp);
721 struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid);
722
723 static inline int
724 ptlrpc_client_receiving_reply (struct ptlrpc_request *req)
725 {
726         int           rc;
727
728         spin_lock(&req->rq_lock);
729         rc = req->rq_receiving_reply;
730         spin_unlock(&req->rq_lock);
731         return (rc);
732 }
733
734 static inline int
735 ptlrpc_client_replied (struct ptlrpc_request *req)
736 {
737         int           rc;
738
739         spin_lock(&req->rq_lock);
740         rc = req->rq_replied;
741         spin_unlock(&req->rq_lock);
742         return (rc);
743 }
744
745 static inline void
746 ptlrpc_wake_client_req (struct ptlrpc_request *req)
747 {
748         if (req->rq_set == NULL)
749                 cfs_waitq_signal(&req->rq_reply_waitq);
750         else
751                 cfs_waitq_signal(&req->rq_set->set_waitq);
752 }
753
754 int ptlrpc_queue_wait(struct ptlrpc_request *req);
755 int ptlrpc_replay_req(struct ptlrpc_request *req);
756 void ptlrpc_unregister_reply(struct ptlrpc_request *req);
757 void ptlrpc_restart_req(struct ptlrpc_request *req);
758 void ptlrpc_abort_inflight(struct obd_import *imp);
759
760 struct ptlrpc_request_set *ptlrpc_prep_set(void);
761 int ptlrpc_set_add_cb(struct ptlrpc_request_set *set,
762                       set_interpreter_func fn, void *data);
763 int ptlrpc_set_next_timeout(struct ptlrpc_request_set *);
764 int ptlrpc_check_set(struct ptlrpc_request_set *set);
765 int ptlrpc_set_wait(struct ptlrpc_request_set *);
766 int ptlrpc_expired_set(void *data);
767 void ptlrpc_interrupted_set(void *data);
768 void ptlrpc_mark_interrupted(struct ptlrpc_request *req);
769 void ptlrpc_set_destroy(struct ptlrpc_request_set *);
770 void ptlrpc_set_add_req(struct ptlrpc_request_set *, struct ptlrpc_request *);
771 void ptlrpc_set_add_new_req(struct ptlrpc_request_set *,
772                             struct ptlrpc_request *);
773
774 void ptlrpc_free_rq_pool(struct ptlrpc_request_pool *pool);
775 void ptlrpc_add_rqs_to_pool(struct ptlrpc_request_pool *pool, int num_rq);
776 struct ptlrpc_request_pool *ptlrpc_init_rq_pool(int, int,
777                                                 void (*populate_pool)(struct ptlrpc_request_pool *, int));
778 struct ptlrpc_request *ptlrpc_request_alloc(struct obd_import *imp,
779                                             const struct req_format *format);
780 struct ptlrpc_request *ptlrpc_request_alloc_pool(struct obd_import *imp,
781                                             struct ptlrpc_request_pool *,
782                                             const struct req_format *format);
783 void ptlrpc_request_free(struct ptlrpc_request *request);
784 int ptlrpc_request_pack(struct ptlrpc_request *request,
785                         __u32 version, int opcode);
786 struct ptlrpc_request *ptlrpc_request_alloc_pack(struct obd_import *imp,
787                                                 const struct req_format *format,
788                                                 __u32 version, int opcode);
789 int ptlrpc_request_bufs_pack(struct ptlrpc_request *request,
790                              __u32 version, int opcode, char **bufs,
791                              struct ptlrpc_cli_ctx *ctx);
792 struct ptlrpc_request *ptlrpc_prep_req(struct obd_import *imp, __u32 version,
793                                        int opcode, int count, int *lengths,
794                                        char **bufs);
795 struct ptlrpc_request *ptlrpc_prep_req_pool(struct obd_import *imp,
796                                              __u32 version, int opcode,
797                                             int count, int *lengths, char **bufs,
798                                             struct ptlrpc_request_pool *pool);
799 void ptlrpc_free_req(struct ptlrpc_request *request);
800 void ptlrpc_req_finished(struct ptlrpc_request *request);
801 void ptlrpc_req_finished_with_imp_lock(struct ptlrpc_request *request);
802 struct ptlrpc_request *ptlrpc_request_addref(struct ptlrpc_request *req);
803 struct ptlrpc_bulk_desc *ptlrpc_prep_bulk_imp (struct ptlrpc_request *req,
804                                                int npages, int type, int portal);
805 struct ptlrpc_bulk_desc *ptlrpc_prep_bulk_exp(struct ptlrpc_request *req,
806                                               int npages, int type, int portal);
807 void ptlrpc_free_bulk(struct ptlrpc_bulk_desc *bulk);
808 void ptlrpc_prep_bulk_page(struct ptlrpc_bulk_desc *desc,
809                            cfs_page_t *page, int pageoffset, int len);
810 void ptlrpc_retain_replayable_request(struct ptlrpc_request *req,
811                                       struct obd_import *imp);
812 __u64 ptlrpc_next_xid(void);
813 __u64 ptlrpc_sample_next_xid(void);
814 __u64 ptlrpc_req_xid(struct ptlrpc_request *request);
815
816 struct ptlrpc_service_conf {
817         int psc_nbufs;
818         int psc_bufsize;
819         int psc_max_req_size;
820         int psc_max_reply_size;
821         int psc_req_portal;
822         int psc_rep_portal;
823         int psc_watchdog_timeout; /* in ms */
824         int psc_min_threads;
825         int psc_max_threads;
826         __u32 psc_ctx_tags;
827 };
828
829 /* ptlrpc/service.c */
830 void ptlrpc_save_lock (struct ptlrpc_request *req,
831                        struct lustre_handle *lock, int mode);
832 void ptlrpc_commit_replies (struct obd_device *obd);
833 void ptlrpc_schedule_difficult_reply (struct ptlrpc_reply_state *rs);
834 struct ptlrpc_service *ptlrpc_init_svc_conf(struct ptlrpc_service_conf *c,
835                                             svc_handler_t h, char *name,
836                                             struct proc_dir_entry *proc_entry,
837                                             svcreq_printfn_t prntfn,
838                                             char *threadname);
839
840 struct ptlrpc_service *ptlrpc_init_svc(int nbufs, int bufsize, int max_req_size,
841                                        int max_reply_size,
842                                        int req_portal, int rep_portal,
843                                        int watchdog_timeout, /* in ms */
844                                        svc_handler_t, char *name,
845                                        cfs_proc_dir_entry_t *proc_entry,
846                                        svcreq_printfn_t,
847                                        int min_threads, int max_threads,
848                                        char *threadname, __u32 ctx_tags);
849 void ptlrpc_stop_all_threads(struct ptlrpc_service *svc);
850
851 int ptlrpc_start_threads(struct obd_device *dev, struct ptlrpc_service *svc);
852 int ptlrpc_start_thread(struct obd_device *dev, struct ptlrpc_service *svc);
853 int ptlrpc_unregister_service(struct ptlrpc_service *service);
854 int liblustre_check_services (void *arg);
855 void ptlrpc_daemonize(char *name);
856 int ptlrpc_service_health_check(struct ptlrpc_service *);
857
858
859 struct ptlrpc_svc_data {
860         char *name;
861         struct ptlrpc_service *svc;
862         struct ptlrpc_thread *thread;
863         struct obd_device *dev;
864 };
865
866 /* ptlrpc/import.c */
867 int ptlrpc_connect_import(struct obd_import *imp, char * new_uuid);
868 int ptlrpc_init_import(struct obd_import *imp);
869 int ptlrpc_disconnect_import(struct obd_import *imp, int noclose);
870 int ptlrpc_import_recovery_state_machine(struct obd_import *imp);
871
872 /* ptlrpc/pack_generic.c */
873 int lustre_msg_swabbed(struct lustre_msg *msg);
874 int lustre_msg_check_version(struct lustre_msg *msg, __u32 version);
875 void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, int *lens,
876                         char **bufs);
877 int lustre_pack_request(struct ptlrpc_request *, __u32 magic, int count,
878                         int *lens, char **bufs);
879 int lustre_pack_reply(struct ptlrpc_request *, int count, int *lens,
880                       char **bufs);
881 int lustre_pack_reply_v2(struct ptlrpc_request *req, int count,
882                          int *lens, char **bufs);
883 int lustre_shrink_msg(struct lustre_msg *msg, int segment,
884                       unsigned int newlen, int move_data);
885 void lustre_free_reply_state(struct ptlrpc_reply_state *rs);
886 int lustre_msg_hdr_size(__u32 magic, int count);
887 int lustre_msg_size(__u32 magic, int count, int *lengths);
888 int lustre_msg_size_v2(int count, int *lengths);
889 int lustre_packed_msg_size(struct lustre_msg *msg);
890 int lustre_unpack_msg(struct lustre_msg *m, int len);
891 void *lustre_msg_buf_v1(void *msg, int n, int min_size);
892 void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, int n, int min_size);
893 void *lustre_msg_buf(struct lustre_msg *m, int n, int minlen);
894 int lustre_msg_buflen(struct lustre_msg *m, int n);
895 void lustre_msg_set_buflen(struct lustre_msg *m, int n, int len);
896 int lustre_msg_bufcount(struct lustre_msg *m);
897 char *lustre_msg_string (struct lustre_msg *m, int n, int max_len);
898 void *lustre_swab_buf(struct lustre_msg *, int n, int minlen, void *swabber);
899 void *lustre_swab_reqbuf(struct ptlrpc_request *req, int n, int minlen,
900                          void *swabber);
901 void *lustre_swab_repbuf(struct ptlrpc_request *req, int n, int minlen,
902                          void *swabber);
903 __u32 lustre_msg_get_flags(struct lustre_msg *msg);
904 void lustre_msg_add_flags(struct lustre_msg *msg, int flags);
905 void lustre_msg_set_flags(struct lustre_msg *msg, int flags);
906 void lustre_msg_clear_flags(struct lustre_msg *msg, int flags);
907 __u32 lustre_msg_get_op_flags(struct lustre_msg *msg);
908 void lustre_msg_add_op_flags(struct lustre_msg *msg, int flags);
909 void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags);
910 struct lustre_handle *lustre_msg_get_handle(struct lustre_msg *msg);
911 __u32 lustre_msg_get_type(struct lustre_msg *msg);
912 __u32 lustre_msg_get_version(struct lustre_msg *msg);
913 void lustre_msg_add_version(struct lustre_msg *msg, int version);
914 __u32 lustre_msg_get_opc(struct lustre_msg *msg);
915 __u64 lustre_msg_get_last_xid(struct lustre_msg *msg);
916 __u64 lustre_msg_get_last_committed(struct lustre_msg *msg);
917 __u64 lustre_msg_get_transno(struct lustre_msg *msg);
918 __u64 lustre_msg_get_slv(struct lustre_msg *msg);
919 __u32 lustre_msg_get_limit(struct lustre_msg *msg);
920 void lustre_msg_set_slv(struct lustre_msg *msg, __u64 slv);
921 void lustre_msg_set_limit(struct lustre_msg *msg, __u64 limit);
922 int lustre_msg_get_status(struct lustre_msg *msg);
923 __u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg);
924 __u32 lustre_msg_get_magic(struct lustre_msg *msg);
925 void lustre_msg_set_handle(struct lustre_msg *msg,struct lustre_handle *handle);
926 void lustre_msg_set_type(struct lustre_msg *msg, __u32 type);
927 void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc);
928 void lustre_msg_set_last_xid(struct lustre_msg *msg, __u64 last_xid);
929 void lustre_msg_set_last_committed(struct lustre_msg *msg,__u64 last_committed);
930 void lustre_msg_set_transno(struct lustre_msg *msg, __u64 transno);
931 void lustre_msg_set_status(struct lustre_msg *msg, __u32 status);
932 void lustre_msg_set_conn_cnt(struct lustre_msg *msg, __u32 conn_cnt);
933 void ptlrpc_req_set_repsize(struct ptlrpc_request *req, int count, int *sizes);
934 void ptlrpc_request_set_replen(struct ptlrpc_request *req);
935
936 static inline void
937 lustre_shrink_reply(struct ptlrpc_request *req, int segment,
938                     unsigned int newlen, int move_data)
939 {
940         LASSERT(req->rq_reply_state);
941         LASSERT(req->rq_repmsg);
942         req->rq_replen = lustre_shrink_msg(req->rq_repmsg, segment,
943                                            newlen, move_data);
944 }
945
946 static inline void
947 ptlrpc_rs_addref(struct ptlrpc_reply_state *rs)
948 {
949         LASSERT(atomic_read(&rs->rs_refcount) > 0);
950         atomic_inc(&rs->rs_refcount);
951 }
952
953 static inline void
954 ptlrpc_rs_decref(struct ptlrpc_reply_state *rs)
955 {
956         LASSERT(atomic_read(&rs->rs_refcount) > 0);
957         if (atomic_dec_and_test(&rs->rs_refcount))
958                 lustre_free_reply_state(rs);
959 }
960
961 static inline __u32 lustre_request_magic(struct ptlrpc_request *req)
962 {
963         return lustre_msg_get_magic(req->rq_reqmsg);
964 }
965
966 static inline int ptlrpc_req_get_repsize(struct ptlrpc_request *req)
967 {
968         switch (req->rq_reqmsg->lm_magic) {
969         case LUSTRE_MSG_MAGIC_V1:
970                 CERROR("function not supported for lustre_msg V1!\n");
971                 return -ENOTSUPP;
972         case LUSTRE_MSG_MAGIC_V2:
973                 return req->rq_reqmsg->lm_repsize;
974         default:
975                 LASSERTF(0, "incorrect message magic: %08x\n",
976                          req->rq_reqmsg->lm_magic);
977                 return -EFAULT;
978         }
979 }
980
981 /* ldlm/ldlm_lib.c */
982 int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg);
983 int client_obd_cleanup(struct obd_device *obddev);
984 int client_connect_import(const struct lu_env *env,
985                           struct lustre_handle *conn, struct obd_device *obd,
986                           struct obd_uuid *cluuid, struct obd_connect_data *);
987 int client_disconnect_export(struct obd_export *exp);
988 int client_import_add_conn(struct obd_import *imp, struct obd_uuid *uuid,
989                            int priority);
990 int client_import_del_conn(struct obd_import *imp, struct obd_uuid *uuid);
991 int import_set_conn_priority(struct obd_import *imp, struct obd_uuid *uuid);
992
993 /* ptlrpc/pinger.c */
994 int ptlrpc_pinger_add_import(struct obd_import *imp);
995 int ptlrpc_pinger_del_import(struct obd_import *imp);
996 cfs_time_t ptlrpc_suspend_wakeup_time(void);
997 #ifdef __KERNEL__
998 void ping_evictor_start(void);
999 void ping_evictor_stop(void);
1000 #else
1001 #define ping_evictor_start()    do {} while (0)
1002 #define ping_evictor_stop()     do {} while (0)
1003 #endif
1004 int ptlrpc_check_and_wait_suspend(struct ptlrpc_request *req);
1005
1006 /* ptlrpc/ptlrpcd.c */
1007 void ptlrpcd_wake(struct ptlrpc_request *req);
1008 void ptlrpcd_add_req(struct ptlrpc_request *req);
1009 int ptlrpcd_addref(void);
1010 void ptlrpcd_decref(void);
1011
1012 /* ptlrpc/lproc_ptlrpc.c */
1013 const char* ll_opcode2str(__u32 opcode);
1014 #ifdef LPROCFS
1015 void ptlrpc_lprocfs_register_obd(struct obd_device *obd);
1016 void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd);
1017 void ptlrpc_lprocfs_brw(struct ptlrpc_request *req, int opc, int bytes);
1018 #else
1019 static inline void ptlrpc_lprocfs_register_obd(struct obd_device *obd) {}
1020 static inline void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd) {}
1021 static inline void ptlrpc_lprocfs_brw(struct ptlrpc_request *req, int opc,
1022                                       int bytes) {}
1023 #endif
1024
1025 /* ptlrpc/llog_server.c */
1026 int llog_origin_handle_create(struct ptlrpc_request *req);
1027 int llog_origin_handle_destroy(struct ptlrpc_request *req);
1028 int llog_origin_handle_prev_block(struct ptlrpc_request *req);
1029 int llog_origin_handle_next_block(struct ptlrpc_request *req);
1030 int llog_origin_handle_read_header(struct ptlrpc_request *req);
1031 int llog_origin_handle_close(struct ptlrpc_request *req);
1032 int llog_origin_handle_cancel(struct ptlrpc_request *req);
1033 int llog_catinfo(struct ptlrpc_request *req);
1034
1035 /* ptlrpc/llog_client.c */
1036 extern struct llog_operations llog_client_ops;
1037
1038 #endif