Whamcloud - gitweb
b=14184
[fs/lustre-release.git] / lustre / ost / lproc_ost.c
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 the Lustre file system, http://www.lustre.org
7  *   Lustre is a trademark of Cluster File Systems, Inc.
8  *
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.
13  *
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.
18  *
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.
23  *
24  */
25 #define DEBUG_SUBSYSTEM S_OST
26
27 #include <obd_class.h>
28 #include <lprocfs_status.h>
29 #include <linux/seq_file.h>
30 #include "ost_internal.h"
31
32 #ifdef LPROCFS
33 static struct lprocfs_vars lprocfs_ost_obd_vars[] = {
34         { "uuid",            lprocfs_rd_uuid,   0, 0 },
35         { 0 }
36 };
37
38 static struct lprocfs_vars lprocfs_ost_module_vars[] = {
39         { "num_refs",       lprocfs_rd_numrefs, 0, 0 },
40         { 0 }
41 };
42
43 void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars)
44 {
45     lvars->module_vars  = lprocfs_ost_module_vars;
46     lvars->obd_vars     = lprocfs_ost_obd_vars;
47 }
48
49 void
50 ost_print_req(void *seq_file, struct ptlrpc_request *req)
51 {
52         /* Called holding srv_lock with irqs disabled.
53          * Print specific req contents and a newline.
54          * CAVEAT EMPTOR: check request message length before printing!!!
55          * You might have received any old crap so you must be just as
56          * careful here as the service's request parser!!! */
57         struct seq_file *sf = seq_file;
58
59         switch (req->rq_phase) {
60         case RQ_PHASE_NEW:
61                 /* still awaiting a service thread's attention, or rejected
62                  * because the generic request message didn't unpack */
63                 seq_printf(sf, "<not swabbed>\n");
64                 break;
65                 
66         case RQ_PHASE_INTERPRET:
67                 /* being handled, so basic msg swabbed, and opc is valid
68                  * but racing with ost_handle() */
69                 seq_printf(sf, "opc %d\n", lustre_msg_get_opc(req->rq_reqmsg));
70                 break;
71                 
72         case RQ_PHASE_COMPLETE:
73                 /* been handled by ost_handle() reply state possibly still
74                  * volatile */
75                 seq_printf(sf, "opc %d\n", lustre_msg_get_opc(req->rq_reqmsg));
76                 break;
77
78         default:
79                 LBUG();
80         }
81 }
82 #endif /* LPROCFS */