aboutsummaryrefslogtreecommitdiff
blob: 59eeb06e6632900db1f8ed75516208dd145e2431 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
From 917c26236db7d3684733f693ccc579c3dd41f26c Mon Sep 17 00:00:00 2001
From: James Simmons <uja.ornl@gmail.com>
Date: Thu, 14 Nov 2013 09:48:08 -0500
Subject: [PATCH 09/18] LU-3319 procfs: move ost proc handling over to seq_file

Most of the current proc handling of the OST is already
based on seq_file handling except for the reporting of
the UUID of the OST. This patch moves this last piece
so that the OST layer will use strictly proc files with
seq_files.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: Idf2bc014ada9292d545f761aa27c777412a66671
---
 lustre/ost/Makefile.in    |  2 +-
 lustre/ost/lproc_ost.c    | 58 -----------------------------------------------
 lustre/ost/ost_handler.c  | 21 +++++++++++------
 lustre/ost/ost_internal.h |  9 --------
 4 files changed, 15 insertions(+), 75 deletions(-)
 delete mode 100644 lustre/ost/lproc_ost.c

diff --git a/lustre/ost/Makefile.in b/lustre/ost/Makefile.in
index 6bd8be3..bae023e 100644
--- a/lustre/ost/Makefile.in
+++ b/lustre/ost/Makefile.in
@@ -1,5 +1,5 @@
 MODULES := ost
-ost-objs := ost_handler.o lproc_ost.o
+ost-objs := ost_handler.o
 
 EXTRA_DIST = $(ost-objs:%.o=%.c) ost_internal.h
 
diff --git a/lustre/ost/lproc_ost.c b/lustre/ost/lproc_ost.c
deleted file mode 100644
index a978c51..0000000
--- a/lustre/ost/lproc_ost.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-#define DEBUG_SUBSYSTEM S_OST
-
-#include <obd_class.h>
-#include <lprocfs_status.h>
-#include <linux/seq_file.h>
-#include "ost_internal.h"
-
-#ifdef LPROCFS
-static struct lprocfs_vars lprocfs_ost_obd_vars[] = {
-        { "uuid",            lprocfs_rd_uuid,   0, 0 },
-        { 0 }
-};
-
-static struct lprocfs_vars lprocfs_ost_module_vars[] = {
-        { "num_refs",       lprocfs_rd_numrefs, 0, 0 },
-        { 0 }
-};
-
-void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars)
-{
-    lvars->module_vars  = lprocfs_ost_module_vars;
-    lvars->obd_vars     = lprocfs_ost_obd_vars;
-}
-
-#endif /* LPROCFS */
diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c
index 662a489..7567acf 100644
--- a/lustre/ost/ost_handler.c
+++ b/lustre/ost/ost_handler.c
@@ -538,12 +538,20 @@ static int ost_io_hpreq_handler(struct ptlrpc_request *req)
 
 static struct cfs_cpt_table	*ost_io_cptable;
 
+#ifdef LPROCFS
+LPROC_SEQ_FOPS_RO_TYPE(ost, uuid);
+
+static struct lprocfs_seq_vars lprocfs_ost_obd_vars[] = {
+	{ "uuid",	&ost_uuid_fops	},
+	{ 0 }
+};
+#endif /* LPROCFS */
+
 /* Sigh - really, this is an OSS, the _server_, not the _target_ */
 static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
 {
 	static struct ptlrpc_service_conf	svc_conf;
 	struct ost_obd *ost = &obd->u.ost;
-	struct lprocfs_static_vars lvars;
 	nodemask_t		*mask;
 	int rc;
 	ENTRY;
@@ -552,9 +560,10 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
         if (rc)
                 RETURN(rc);
 
-        lprocfs_ost_init_vars(&lvars);
-        lprocfs_obd_setup(obd, lvars.obd_vars);
-
+#ifdef LPROCFS
+	obd->obd_vars = lprocfs_ost_obd_vars;
+	lprocfs_seq_obd_setup(obd);
+#endif
 	mutex_init(&ost->ost_health_mutex);
 
 	svc_conf = (typeof(svc_conf)) {
@@ -877,15 +886,13 @@ static struct obd_ops ost_obd_ops = {
 
 static int __init ost_init(void)
 {
-	struct lprocfs_static_vars lvars;
 	int rc;
 
 	ENTRY;
 
-        lprocfs_ost_init_vars(&lvars);
 	rc = class_register_type(&ost_obd_ops, NULL, NULL,
 #ifndef HAVE_ONLY_PROCFS_SEQ
-				lvars.module_vars,
+				NULL,
 #endif
 				LUSTRE_OSS_NAME, NULL);
 
diff --git a/lustre/ost/ost_internal.h b/lustre/ost/ost_internal.h
index 8b475a1..63c8415 100644
--- a/lustre/ost/ost_internal.h
+++ b/lustre/ost/ost_internal.h
@@ -39,13 +39,4 @@
 
 #define OSS_SERVICE_WATCHDOG_FACTOR 2
 
-#ifdef LPROCFS
-void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars);
-#else
-static void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars)
-{
-        memset(lvars, 0, sizeof(*lvars));
-}
-#endif
-
 #endif /* OST_INTERNAL_H */
-- 
1.8.5.1