Gentoo Archives: gentoo-commits

From: Alexey Shvetsov <alexxy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sys-cluster/lustre/, sys-cluster/lustre/files/
Date: Wed, 02 Apr 2014 10:50:25
Message-Id: 1396435798.43571edfe360d4cbbf44cf273b8da80c9c3ba80e.alexxy@gentoo
1 commit: 43571edfe360d4cbbf44cf273b8da80c9c3ba80e
2 Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
3 AuthorDate: Wed Apr 2 10:49:58 2014 +0000
4 Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 2 10:49:58 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=43571edf
7
8 Lustre need more patches
9
10 Package-Manager: portage-2.2.10
11 RepoMan-Options: --force
12
13 ---
14 sys-cluster/lustre/ChangeLog | 22 +
15 ...ld-make-AC-check-for-linux-arch-sandbox-f.patch | 95 --
16 .../0001-LU-3319-procfs-fix-symlink-handling.patch | 1132 ++++++++++++++++++++
17 ...cfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch | 123 +++
18 ...fs-update-zfs-proc-handling-to-seq_files.patch} | 67 +-
19 .../0004-LU-3319-procfs-fix-symlink-handling.patch | 371 -------
20 ...ocfs-move-mgs-proc-handling-to-seq_files.patch} | 22 +-
21 ...rocfs-move-osp-proc-handling-to-seq_files.patch | 192 ++--
22 ...rocfs-move-lod-proc-handling-to-seq_files.patch | 200 ++--
23 ...fs-move-mdt-mds-proc-handling-to-seq_fil.patch} | 215 ++--
24 ...fs-move-mdd-ofd-proc-handling-to-seq_fil.patch} | 455 +++++---
25 ...cfs-update-ldiskfs-proc-handling-to-seq_f.patch | 204 ++--
26 ...0010-LU-3319-lprocfs-client-side-cleanups.patch | 463 --------
27 ...-LU-3974-llite-use-new-struct-dir_context.patch | 254 -----
28 ...-LU-3974-llite-invalidatepage-api-changed.patch | 134 ---
29 sys-cluster/lustre/lustre-9999.ebuild | 15 +-
30 16 files changed, 2028 insertions(+), 1936 deletions(-)
31
32 diff --git a/sys-cluster/lustre/ChangeLog b/sys-cluster/lustre/ChangeLog
33 index 73299e5..6b3ecb1 100644
34 --- a/sys-cluster/lustre/ChangeLog
35 +++ b/sys-cluster/lustre/ChangeLog
36 @@ -2,6 +2,28 @@
37 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
38 # $Header: $
39
40 + 02 Apr 2014; Alexey Shvetsov <alexxy@g.o>
41 + +files/0001-LU-3319-procfs-fix-symlink-handling.patch,
42 + +files/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch,
43 + +files/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch,
44 + +files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch,
45 + +files/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch,
46 + +files/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch,
47 + -files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch,
48 + -files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch,
49 + -files/0003-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch,
50 + -files/0004-LU-3319-procfs-fix-symlink-handling.patch,
51 + -files/0007-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch,
52 + -files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch,
53 + -files/0010-LU-3319-lprocfs-client-side-cleanups.patch,
54 + -files/0011-LU-3974-llite-use-new-struct-dir_context.patch,
55 + -files/0012-LU-3974-llite-invalidatepage-api-changed.patch,
56 + files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch,
57 + files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch,
58 + files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch,
59 + lustre-9999.ebuild:
60 + Lustre need more patches
61 +
62 27 Feb 2014; Alexey Shvetsov <alexxy@g.o>
63 files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch,
64 files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch,
65
66 diff --git a/sys-cluster/lustre/files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch b/sys-cluster/lustre/files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch
67 deleted file mode 100644
68 index 63fcb0a..0000000
69 --- a/sys-cluster/lustre/files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch
70 +++ /dev/null
71 @@ -1,95 +0,0 @@
72 -From f384f155612fb8b3fa6a12c4c969e29629f82027 Mon Sep 17 00:00:00 2001
73 -From: Alexey Shvetsov <alexxy@g.o>
74 -Date: Mon, 18 Mar 2013 16:22:27 +0400
75 -Subject: [PATCH 01/12] LU-2982 build: make AC check for linux arch sandbox
76 - friendly
77 -
78 -this commit makes AC check for linux kernel arch sandbox friendly
79 -
80 -Signed-off-by: Alexey Shvetsov <alexxy@g.o>
81 -Change-Id: I173cd892bca5587519806cf6d300a5053dfb935f
82 -Signed-off-by: Alexey Shvetsov <alexxy@g.o>
83 ----
84 - config/lustre-build-linux.m4 | 66 ++++++++++++++++++++++++++++++++++++++------
85 - 1 file changed, 58 insertions(+), 8 deletions(-)
86 -
87 -diff --git a/config/lustre-build-linux.m4 b/config/lustre-build-linux.m4
88 -index 894101c..8062ace 100644
89 ---- a/config/lustre-build-linux.m4
90 -+++ b/config/lustre-build-linux.m4
91 -@@ -394,14 +394,64 @@ rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.
92 - # Determine the kernel's idea of the current architecture
93 - #
94 - AC_DEFUN([LB_LINUX_ARCH],
95 -- [AC_MSG_CHECKING([Linux kernel architecture])
96 -- AS_IF([rm -f $PWD/build/arch
97 -- make -s --no-print-directory echoarch -f $PWD/build/Makefile \
98 -- LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -C $LINUX $CROSS_VARS \
99 -- ARCHFILE=$PWD/build/arch && LINUX_ARCH=`cat $PWD/build/arch`],
100 -- [AC_MSG_RESULT([$LINUX_ARCH])],
101 -- [AC_MSG_ERROR([Could not determine the kernel architecture.])])
102 -- rm -f build/arch])
103 -+[LINUXARCH=
104 -+rm -f build/conftest.i
105 -+AC_MSG_CHECKING([Linux kernel architecture])
106 -+if test -s $LINUX_OBJ/include/$AUTOCONF_HDIR/compile.h ; then
107 -+ LINUXARCHHEADER=$AUTOCONF_HDIR/compile.h
108 -+else
109 -+ LINUXARCHHEADER=linux/autoconf.h
110 -+fi
111 -+LB_LINUX_TRY_MAKE([
112 -+#include <$LINUXARCHHEADER>
113 -+
114 -+#ifndef UTS_MACHINE
115 -+
116 -+ #ifdef CONFIG_X86
117 -+ #ifdef CONFIG_X86_32
118 -+ #define UTS_MACHINE i386
119 -+ #endif
120 -+ #ifdef CONFIG_X86_64
121 -+ #define UTS_MACHINE x86_64
122 -+ #endif
123 -+ #endif
124 -+
125 -+ #ifdef CONFIG_IA64
126 -+ #define UTS_MACHINE ia64
127 -+ #endif
128 -+
129 -+ #ifdef CONFIG_PPC
130 -+ #ifdef CONFIG_PPC32
131 -+ #define UTS_MACHINE ppc
132 -+ #endif
133 -+ #ifdef CONFIG_PPC64
134 -+ #define UTS_MACHINE ppc64
135 -+ #endif
136 -+ #endif
137 -+
138 -+#endif
139 -+],[
140 -+ char *LINUXARCH;
141 -+ LINUXARCH=UTS_MACHINE;
142 -+],[
143 -+ $makerule LUSTRE_KERNEL_TEST=conftest.i
144 -+],[
145 -+ test -s build/conftest.i
146 -+],[
147 -+ # LINUXARCH="UTS_MACHINE"
148 -+ eval $(grep "LINUXARCH=" build/conftest.i)
149 -+],[
150 -+ AC_MSG_RESULT([unknown])
151 -+ AC_MSG_ERROR([Could not preprocess test program. Consult config.log for details.])
152 -+])
153 -+ rm -f build/conftest.i
154 -+ if test x$LINUXARCH = x ; then
155 -+ AC_MSG_RESULT([unknown])
156 -+ AC_MSG_ERROR([Could not determine Linux architecture from linux/version.h.])
157 -+ fi
158 -+AC_MSG_RESULT([$LINUXARCH])
159 -+AC_SUBST(LINUXARCH)
160 -+])
161 -
162 - #
163 - # LB_LINUX_TRY_COMPILE
164 ---
165 -1.8.5.3
166 -
167
168 diff --git a/sys-cluster/lustre/files/0001-LU-3319-procfs-fix-symlink-handling.patch b/sys-cluster/lustre/files/0001-LU-3319-procfs-fix-symlink-handling.patch
169 new file mode 100644
170 index 0000000..d0b6e9c
171 --- /dev/null
172 +++ b/sys-cluster/lustre/files/0001-LU-3319-procfs-fix-symlink-handling.patch
173 @@ -0,0 +1,1132 @@
174 +From 4c418e7208a62c7bb7d61c1f97cf300675215bd4 Mon Sep 17 00:00:00 2001
175 +From: James Simmons <uja.ornl@×××××.com>
176 +Date: Fri, 28 Mar 2014 11:19:07 -0400
177 +Subject: [PATCH 1/9] LU-3319 procfs: fix symlink handling
178 +
179 +While working on symlink handling for seq files I noticed a
180 +long outstanding bug. Code was developed to link osc obds
181 +to target_obds of the lov layer. The target_obds directory
182 +was never created for the symlinks. This patch enables this
183 +long forgotten feature. Also addressed is the race condition
184 +experinced with server side code ported to seq_files that
185 +used symlinks. To avoid the race the handle obd_proc_private
186 +was moved from struct obd_device to struct obd_type which
187 +now allows earlier registeration that only happens once.
188 +The second problem addressed is the module loading race.
189 +Several modules share the same top proc directory entry which
190 +can become a issue if a client exist on a server node since
191 +the linux proc system allows multiple directories of the same
192 +name. Original Lustre had a lprocfs_srch but that doesn't
193 +work if you use the kernels internal cache for the proc
194 +system so you need to keep track of who grabs the proc root
195 +first and then use the first one registered for when the
196 +next module loads.
197 +
198 +Change-Id: Ib158ec4444ed7abc0f3c3e820ee4a333631a58d1
199 +Signed-off-by: James Simmons <uja.ornl@×××××.com>
200 +---
201 + lustre/include/lprocfs_status.h | 4 +-
202 + lustre/include/obd.h | 17 +++--
203 + lustre/include/obd_class.h | 5 +-
204 + lustre/lmv/lmv_obd.c | 65 +++++-----------
205 + lustre/lod/lod_dev.c | 28 +++----
206 + lustre/lov/lov_obd.c | 156 ++++++++++++++++++++++++---------------
207 + lustre/mdc/mdc_request.c | 6 +-
208 + lustre/mdd/mdd_device.c | 6 +-
209 + lustre/mdt/mdt_handler.c | 6 +-
210 + lustre/mdt/mdt_mds.c | 6 +-
211 + lustre/mgc/libmgc.c | 6 +-
212 + lustre/mgc/mgc_request.c | 6 +-
213 + lustre/mgs/mgs_handler.c | 6 +-
214 + lustre/obdclass/genops.c | 55 ++++++++------
215 + lustre/obdclass/llog_test.c | 6 +-
216 + lustre/obdclass/lprocfs_status.c | 1 -
217 + lustre/obdecho/echo_client.c | 10 +--
218 + lustre/ofd/ofd_dev.c | 6 +-
219 + lustre/osc/osc_request.c | 49 +++++++++---
220 + lustre/osd-ldiskfs/osd_handler.c | 6 +-
221 + lustre/osd-zfs/osd_handler.c | 6 +-
222 + lustre/osp/osp_dev.c | 33 +++++----
223 + lustre/ost/ost_handler.c | 6 +-
224 + lustre/quota/qmt_dev.c | 6 +-
225 + 24 files changed, 277 insertions(+), 224 deletions(-)
226 +
227 +diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h
228 +index 978b10c..0d6fd4c 100644
229 +--- a/lustre/include/lprocfs_status.h
230 ++++ b/lustre/include/lprocfs_status.h
231 +@@ -1145,12 +1145,10 @@ static inline int lprocfs_seq_add_vars(cfs_proc_dir_entry_t *root,
232 + struct lprocfs_seq_vars *var,
233 + void *data)
234 + { return 0; }
235 +-#ifndef HAVE_ONLY_PROCFS_SEQ
236 + static inline cfs_proc_dir_entry_t *
237 + lprocfs_seq_register(const char *name, cfs_proc_dir_entry_t *parent,
238 +- struct lprocfs_vars *list, void *data)
239 ++ struct lprocfs_seq_vars *list, void *data)
240 + { return NULL; }
241 +-#endif
242 + static inline void lprocfs_remove(cfs_proc_dir_entry_t **root)
243 + { return; }
244 + static inline void lprocfs_remove_proc_entry(const char *name,
245 +diff --git a/lustre/include/obd.h b/lustre/include/obd.h
246 +index bb67e43..5353524 100644
247 +--- a/lustre/include/obd.h
248 ++++ b/lustre/include/obd.h
249 +@@ -190,13 +190,15 @@ struct obd_info {
250 + };
251 +
252 + struct obd_type {
253 +- cfs_list_t typ_chain;
254 +- struct obd_ops *typ_dt_ops;
255 +- struct md_ops *typ_md_ops;
256 +- cfs_proc_dir_entry_t *typ_procroot;
257 +- char *typ_name;
258 +- int typ_refcnt;
259 +- struct lu_device_type *typ_lu;
260 ++ struct list_head typ_chain;
261 ++ struct obd_ops *typ_dt_ops;
262 ++ struct md_ops *typ_md_ops;
263 ++ struct proc_dir_entry *typ_procroot;
264 ++ struct proc_dir_entry *typ_procsym;
265 ++ __u32 typ_sym_filter;
266 ++ char *typ_name;
267 ++ int typ_refcnt;
268 ++ struct lu_device_type *typ_lu;
269 + spinlock_t obd_type_lock;
270 + };
271 +
272 +@@ -834,7 +836,6 @@ struct obd_device {
273 +
274 + struct proc_dir_entry *obd_proc_entry;
275 + struct proc_dir_entry *obd_proc_exports_entry;
276 +- void *obd_proc_private; /* type private PDEs */
277 + struct proc_dir_entry *obd_svc_procroot;
278 + struct lprocfs_stats *obd_svc_stats;
279 + struct lprocfs_seq_vars *obd_vars;
280 +diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h
281 +index aeb94ba..5de7cd7 100644
282 +--- a/lustre/include/obd_class.h
283 ++++ b/lustre/include/obd_class.h
284 +@@ -86,13 +86,12 @@ struct lu_device_type;
285 +
286 + /* genops.c */
287 + struct obd_export *class_conn2export(struct lustre_handle *);
288 +-int class_register_type(struct obd_ops *, struct md_ops *,
289 ++int class_register_type(struct obd_ops *, struct md_ops *, bool enable_proc,
290 + struct lprocfs_seq_vars *module_vars,
291 + #ifndef HAVE_ONLY_PROCFS_SEQ
292 + struct lprocfs_vars *,
293 + #endif
294 +- const char *nm,
295 +- struct lu_device_type *ldt);
296 ++ const char *nm, struct lu_device_type *ldt);
297 + int class_unregister_type(const char *nm);
298 +
299 + struct obd_device *class_newdev(const char *type_name, const char *name);
300 +diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c
301 +index 8f26e6c..cd16eaf 100644
302 +--- a/lustre/lmv/lmv_obd.c
303 ++++ b/lustre/lmv/lmv_obd.c
304 +@@ -270,9 +270,6 @@ static int lmv_connect(const struct lu_env *env,
305 + struct obd_uuid *cluuid, struct obd_connect_data *data,
306 + void *localdata)
307 + {
308 +-#ifdef __KERNEL__
309 +- struct proc_dir_entry *lmv_proc_dir;
310 +-#endif
311 + struct lmv_obd *lmv = &obd->u.lmv;
312 + struct lustre_handle conn = { 0 };
313 + int rc = 0;
314 +@@ -304,21 +301,16 @@ static int lmv_connect(const struct lu_env *env,
315 + if (data)
316 + lmv->conn_data = *data;
317 +
318 +-#ifdef __KERNEL__
319 +- if (obd->obd_proc_private != NULL) {
320 +- lmv_proc_dir = obd->obd_proc_private;
321 +- } else {
322 +- lmv_proc_dir = lprocfs_seq_register("target_obds",
323 +- obd->obd_proc_entry,
324 +- NULL, NULL);
325 +- if (IS_ERR(lmv_proc_dir)) {
326 ++ if (obd->obd_type->typ_procsym == NULL) {
327 ++ obd->obd_type->typ_procsym = lprocfs_seq_register("target_obds",
328 ++ obd->obd_proc_entry,
329 ++ NULL, NULL);
330 ++ if (IS_ERR(obd->obd_type->typ_procsym)) {
331 + CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.",
332 + obd->obd_type->typ_name, obd->obd_name);
333 +- lmv_proc_dir = NULL;
334 ++ obd->obd_type->typ_procsym = NULL;
335 + }
336 +- obd->obd_proc_private = lmv_proc_dir;
337 + }
338 +-#endif
339 +
340 + /*
341 + * All real clients should perform actual connection right away, because
342 +@@ -329,12 +321,8 @@ static int lmv_connect(const struct lu_env *env,
343 + if (data != NULL && (data->ocd_connect_flags & OBD_CONNECT_REAL))
344 + rc = lmv_check_connect(obd);
345 +
346 +-#ifdef __KERNEL__
347 +- if (rc && lmv_proc_dir) {
348 +- lprocfs_remove(&lmv_proc_dir);
349 +- obd->obd_proc_private = NULL;
350 +- }
351 +-#endif
352 ++ if (rc && obd->obd_type->typ_procsym != NULL)
353 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
354 + RETURN(rc);
355 + }
356 +
357 +@@ -416,9 +404,6 @@ static int lmv_init_ea_size(struct obd_export *exp, int easize,
358 +
359 + int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
360 + {
361 +-#ifdef __KERNEL__
362 +- struct proc_dir_entry *lmv_proc_dir;
363 +-#endif
364 + struct lmv_obd *lmv = &obd->u.lmv;
365 + struct obd_uuid *cluuid = &lmv->cluuid;
366 + struct obd_uuid lmv_mdc_uuid = { "LMV_MDC_UUID" };
367 +@@ -497,15 +482,13 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
368 + mdc_obd->obd_name, mdc_obd->obd_uuid.uuid,
369 + atomic_read(&obd->obd_refcount));
370 +
371 +-#ifdef __KERNEL__
372 +- lmv_proc_dir = obd->obd_proc_private;
373 +- if (lmv_proc_dir) {
374 ++ if (obd->obd_type->typ_procsym != NULL) {
375 + struct proc_dir_entry *mdc_symlink;
376 +
377 + LASSERT(mdc_obd->obd_type != NULL);
378 + LASSERT(mdc_obd->obd_type->typ_name != NULL);
379 + mdc_symlink = lprocfs_add_symlink(mdc_obd->obd_name,
380 +- lmv_proc_dir,
381 ++ obd->obd_type->typ_procsym,
382 + "../../../%s/%s",
383 + mdc_obd->obd_type->typ_name,
384 + mdc_obd->obd_name);
385 +@@ -514,11 +497,9 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
386 + "/proc/fs/lustre/%s/%s/target_obds/%s.",
387 + obd->obd_type->typ_name, obd->obd_name,
388 + mdc_obd->obd_name);
389 +- lprocfs_remove(&lmv_proc_dir);
390 +- obd->obd_proc_private = NULL;
391 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
392 + }
393 + }
394 +-#endif
395 + RETURN(0);
396 + }
397 +
398 +@@ -706,9 +687,6 @@ int lmv_check_connect(struct obd_device *obd)
399 +
400 + static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
401 + {
402 +-#ifdef __KERNEL__
403 +- struct proc_dir_entry *lmv_proc_dir;
404 +-#endif
405 + struct lmv_obd *lmv = &obd->u.lmv;
406 + struct obd_device *mdc_obd;
407 + int rc;
408 +@@ -725,11 +703,10 @@ static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
409 + mdc_obd->obd_no_recov = obd->obd_no_recov;
410 + }
411 +
412 +-#ifdef __KERNEL__
413 +- lmv_proc_dir = obd->obd_proc_private;
414 +- if (lmv_proc_dir)
415 +- lprocfs_remove_proc_entry(mdc_obd->obd_name, lmv_proc_dir);
416 +-#endif
417 ++ if (obd->obd_type->typ_procsym != NULL)
418 ++ lprocfs_remove_proc_entry(mdc_obd->obd_name,
419 ++ obd->obd_type->typ_procsym);
420 ++
421 + rc = obd_fid_fini(tgt->ltd_exp->exp_obd);
422 + if (rc)
423 + CERROR("Can't finanize fids factory\n");
424 +@@ -777,13 +754,11 @@ static int lmv_disconnect(struct obd_export *exp)
425 + lmv_disconnect_mdc(obd, lmv->tgts[i]);
426 + }
427 +
428 +-#ifdef __KERNEL__
429 +- if (obd->obd_proc_private)
430 +- lprocfs_remove((struct proc_dir_entry **)&obd->obd_proc_private);
431 ++ if (obd->obd_type->typ_procsym != NULL)
432 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
433 + else
434 + CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n",
435 + obd->obd_type->typ_name, obd->obd_name);
436 +-#endif
437 +
438 + out_local:
439 + /*
440 +@@ -3423,11 +3398,11 @@ struct md_ops lmv_md_ops = {
441 +
442 + int __init lmv_init(void)
443 + {
444 +- return class_register_type(&lmv_obd_ops, &lmv_md_ops, NULL,
445 ++ return class_register_type(&lmv_obd_ops, &lmv_md_ops, true, NULL,
446 + #ifndef HAVE_ONLY_PROCFS_SEQ
447 +- NULL,
448 ++ NULL,
449 + #endif
450 +- LUSTRE_LMV_NAME, NULL);
451 ++ LUSTRE_LMV_NAME, NULL);
452 + }
453 +
454 + #ifdef __KERNEL__
455 +diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c
456 +index 1d4849f..a653d6a 100644
457 +--- a/lustre/lod/lod_dev.c
458 ++++ b/lustre/lod/lod_dev.c
459 +@@ -892,8 +892,8 @@ static struct obd_ops lod_obd_device_ops = {
460 + static int __init lod_mod_init(void)
461 + {
462 + struct lprocfs_static_vars lvars = { 0 };
463 +- cfs_proc_dir_entry_t *lov_proc_dir;
464 +- int rc;
465 ++ struct obd_type *type;
466 ++ int rc;
467 +
468 + rc = lu_kmem_init(lod_caches);
469 + if (rc)
470 +@@ -901,32 +901,32 @@ static int __init lod_mod_init(void)
471 +
472 + lprocfs_lod_init_vars(&lvars);
473 +
474 +- rc = class_register_type(&lod_obd_device_ops, NULL, NULL,
475 ++ rc = class_register_type(&lod_obd_device_ops, NULL, true, NULL,
476 + #ifndef HAVE_ONLY_PROCFS_SEQ
477 +- lvars.module_vars,
478 ++ lvars.module_vars,
479 + #endif
480 +- LUSTRE_LOD_NAME, &lod_device_type);
481 ++ LUSTRE_LOD_NAME, &lod_device_type);
482 + if (rc) {
483 + lu_kmem_fini(lod_caches);
484 + return rc;
485 + }
486 +
487 + /* create "lov" entry in procfs for compatibility purposes */
488 +- lov_proc_dir = lprocfs_srch(proc_lustre_root, "lov");
489 +- if (lov_proc_dir == NULL) {
490 +- lov_proc_dir = lprocfs_register("lov", proc_lustre_root,
491 +- NULL, NULL);
492 +- if (IS_ERR(lov_proc_dir))
493 +- CERROR("lod: can't create compat entry \"lov\": %d\n",
494 +- (int)PTR_ERR(lov_proc_dir));
495 +- }
496 ++ type = class_search_type(LUSTRE_LOV_NAME);
497 ++ if (type != NULL && type->typ_procroot != NULL)
498 ++ return rc;
499 +
500 ++ type = class_search_type(LUSTRE_LOD_NAME);
501 ++ type->typ_procsym = lprocfs_register("lov", proc_lustre_root,
502 ++ NULL, NULL);
503 ++ if (IS_ERR(type->typ_procsym))
504 ++ CERROR("lod: can't create compat entry \"lov\": %d\n",
505 ++ (int)PTR_ERR(type->typ_procsym));
506 + return rc;
507 + }
508 +
509 + static void __exit lod_mod_exit(void)
510 + {
511 +-
512 + lprocfs_try_remove_proc_entry("lov", proc_lustre_root);
513 +
514 + class_unregister_type(LUSTRE_LOD_NAME);
515 +diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c
516 +index 9d47ec5..78c11fb 100644
517 +--- a/lustre/lov/lov_obd.c
518 ++++ b/lustre/lov/lov_obd.c
519 +@@ -124,19 +124,16 @@ static int lov_notify(struct obd_device *obd, struct obd_device *watched,
520 + int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
521 + struct obd_connect_data *data)
522 + {
523 +- struct lov_obd *lov = &obd->u.lov;
524 +- struct obd_uuid *tgt_uuid;
525 +- struct obd_device *tgt_obd;
526 +- static struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
527 +- struct obd_import *imp;
528 +-#ifdef __KERNEL__
529 +- struct proc_dir_entry *lov_proc_dir;
530 +-#endif
531 +- int rc;
532 +- ENTRY;
533 ++ struct lov_obd *lov = &obd->u.lov;
534 ++ struct obd_uuid *tgt_uuid;
535 ++ struct obd_device *tgt_obd;
536 ++ static struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
537 ++ struct obd_import *imp;
538 ++ int rc;
539 ++ ENTRY;
540 +
541 +- if (!lov->lov_tgts[index])
542 +- RETURN(-EINVAL);
543 ++ if (lov->lov_tgts[index] == NULL)
544 ++ RETURN(-EINVAL);
545 +
546 + tgt_uuid = &lov->lov_tgts[index]->ltd_uuid;
547 + tgt_obd = lov->lov_tgts[index]->ltd_obd;
548 +@@ -191,32 +188,29 @@ int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
549 + CDEBUG(D_CONFIG, "Connected tgt idx %d %s (%s) %sactive\n", index,
550 + obd_uuid2str(tgt_uuid), tgt_obd->obd_name, activate ? "":"in");
551 +
552 +-#ifdef __KERNEL__
553 +- lov_proc_dir = obd->obd_proc_private;
554 +- if (lov_proc_dir) {
555 +- struct obd_device *osc_obd = lov->lov_tgts[index]->ltd_exp->exp_obd;
556 ++ if (obd->obd_type->typ_procsym != NULL) {
557 + struct proc_dir_entry *osc_symlink;
558 +-
559 +- LASSERT(osc_obd != NULL);
560 +- LASSERT(osc_obd->obd_magic == OBD_DEVICE_MAGIC);
561 +- LASSERT(osc_obd->obd_type->typ_name != NULL);
562 +-
563 +- osc_symlink = lprocfs_add_symlink(osc_obd->obd_name,
564 +- lov_proc_dir,
565 +- "../../../%s/%s",
566 +- osc_obd->obd_type->typ_name,
567 +- osc_obd->obd_name);
568 +- if (osc_symlink == NULL) {
569 +- CERROR("could not register LOV target "
570 +- "/proc/fs/lustre/%s/%s/target_obds/%s.",
571 +- obd->obd_type->typ_name, obd->obd_name,
572 +- osc_obd->obd_name);
573 +- lprocfs_remove(&lov_proc_dir);
574 +- obd->obd_proc_private = NULL;
575 ++ struct obd_device *osc_obd;
576 ++
577 ++ osc_obd = lov->lov_tgts[index]->ltd_exp->exp_obd;
578 ++
579 ++ LASSERT(osc_obd != NULL);
580 ++ LASSERT(osc_obd->obd_magic == OBD_DEVICE_MAGIC);
581 ++ LASSERT(osc_obd->obd_type->typ_name != NULL);
582 ++
583 ++ osc_symlink = lprocfs_add_symlink(osc_obd->obd_name,
584 ++ obd->obd_type->typ_procsym,
585 ++ "../../../%s/%s",
586 ++ osc_obd->obd_type->typ_name,
587 ++ osc_obd->obd_name);
588 ++ if (osc_symlink == NULL) {
589 ++ CERROR("could not register LOV target "
590 ++ "/proc/fs/lustre/%s/%s/target_obds/%s.",
591 ++ obd->obd_type->typ_name, obd->obd_name,
592 ++ osc_obd->obd_name);
593 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
594 + }
595 + }
596 +-#endif
597 +-
598 + RETURN(0);
599 + }
600 +
601 +@@ -247,6 +241,15 @@ static int lov_connect(const struct lu_env *env,
602 + if (data)
603 + lov->lov_ocd = *data;
604 +
605 ++ obd->obd_type->typ_procsym = lprocfs_seq_register("target_obds",
606 ++ obd->obd_proc_entry,
607 ++ NULL, NULL);
608 ++ if (IS_ERR(obd->obd_type->typ_procsym)) {
609 ++ CERROR("%s: could not register /proc/fs/lustre/%s/%s/target_obds.",
610 ++ obd->obd_name, obd->obd_type->typ_name, obd->obd_name);
611 ++ obd->obd_type->typ_procsym = NULL;
612 ++ }
613 ++
614 + obd_getref(obd);
615 + for (i = 0; i < lov->desc.ld_tgt_count; i++) {
616 + tgt = lov->lov_tgts[i];
617 +@@ -277,7 +280,6 @@ static int lov_connect(const struct lu_env *env,
618 +
619 + static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
620 + {
621 +- struct proc_dir_entry *lov_proc_dir;
622 + struct lov_obd *lov = &obd->u.lov;
623 + struct obd_device *osc_obd;
624 + int rc;
625 +@@ -293,19 +295,19 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
626 + tgt->ltd_exp->exp_obd->obd_inactive = 1;
627 + }
628 +
629 +- lov_proc_dir = obd->obd_proc_private;
630 +- if (lov_proc_dir)
631 +- lprocfs_remove_proc_entry(osc_obd->obd_name, lov_proc_dir);
632 ++ if (osc_obd) {
633 ++ /* Pass it on to our clients.
634 ++ * XXX This should be an argument to disconnect,
635 ++ * XXX not a back-door flag on the OBD. Ah well.
636 ++ */
637 ++ osc_obd->obd_force = obd->obd_force;
638 ++ osc_obd->obd_fail = obd->obd_fail;
639 ++ osc_obd->obd_no_recov = obd->obd_no_recov;
640 +
641 +- if (osc_obd) {
642 +- /* Pass it on to our clients.
643 +- * XXX This should be an argument to disconnect,
644 +- * XXX not a back-door flag on the OBD. Ah well.
645 +- */
646 +- osc_obd->obd_force = obd->obd_force;
647 +- osc_obd->obd_fail = obd->obd_fail;
648 +- osc_obd->obd_no_recov = obd->obd_no_recov;
649 +- }
650 ++ if (obd->obd_type->typ_procsym)
651 ++ lprocfs_remove_proc_entry(osc_obd->obd_name,
652 ++ obd->obd_type->typ_procsym);
653 ++ }
654 +
655 + obd_register_observer(osc_obd, NULL);
656 +
657 +@@ -350,6 +352,9 @@ static int lov_disconnect(struct obd_export *exp)
658 + }
659 + obd_putref(obd);
660 +
661 ++ if (obd->obd_type->typ_procsym)
662 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
663 ++
664 + out:
665 + rc = class_disconnect(exp); /* bz 9811 */
666 + RETURN(rc);
667 +@@ -779,6 +784,9 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
668 + {
669 + struct lov_desc *desc;
670 + struct lov_obd *lov = &obd->u.lov;
671 ++#ifdef LPROCFS
672 ++ struct obd_type *type;
673 ++#endif
674 + int rc;
675 + ENTRY;
676 +
677 +@@ -834,15 +842,41 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
678 +
679 + #ifdef LPROCFS
680 + obd->obd_vars = lprocfs_lov_obd_vars;
681 +- lprocfs_seq_obd_setup(obd);
682 +- rc = lprocfs_seq_create(obd->obd_proc_entry, "target_obd", 0444,
683 +- &lov_proc_target_fops, obd);
684 +- if (rc)
685 +- CWARN("Error adding the target_obd file\n");
686 ++ /* If this is true then both client (lov) and server
687 ++ * (lod) are on the same node. The lod layer if loaded
688 ++ * first will register the lov proc directory. In that
689 ++ * case obd->obd_type->typ_procroot will be not set.
690 ++ * Instead we use type->typ_procsym as the parent. */
691 ++ type = class_search_type(LUSTRE_LOD_NAME);
692 ++ if (type != NULL && type->typ_procsym != NULL) {
693 ++ obd->obd_proc_entry = lprocfs_seq_register(obd->obd_name,
694 ++ type->typ_procsym,
695 ++ obd->obd_vars, obd);
696 ++ if (IS_ERR(obd->obd_proc_entry)) {
697 ++ rc = PTR_ERR(obd->obd_proc_entry);
698 ++ CERROR("error %d setting up lprocfs for %s\n", rc,
699 ++ obd->obd_name);
700 ++ obd->obd_proc_entry = NULL;
701 ++ }
702 ++ } else {
703 ++ rc = lprocfs_seq_obd_setup(obd);
704 ++ }
705 ++
706 ++ if (rc == 0) {
707 ++ rc = lprocfs_seq_create(obd->obd_proc_entry, "target_obd",
708 ++ 0444, &lov_proc_target_fops, obd);
709 ++ if (rc)
710 ++ CWARN("Error adding the target_obd file\n");
711 +
712 +- lov->lov_pool_proc_entry = lprocfs_seq_register("pools",
713 ++ lov->lov_pool_proc_entry = lprocfs_seq_register("pools",
714 + obd->obd_proc_entry,
715 + NULL, NULL);
716 ++ if (IS_ERR(lov->lov_pool_proc_entry)) {
717 ++ rc = PTR_ERR(lov->lov_pool_proc_entry);
718 ++ CERROR("error %d setting up lprocfs for pools\n", rc);
719 ++ lov->lov_pool_proc_entry = NULL;
720 ++ }
721 ++ }
722 + #endif
723 + RETURN(0);
724 +
725 +@@ -2365,8 +2399,10 @@ extern struct lu_kmem_descr lov_caches[];
726 +
727 + int __init lov_init(void)
728 + {
729 ++ bool enable_proc = true;
730 ++ struct obd_type *type;
731 + int rc;
732 +- ENTRY;
733 ++ ENTRY;
734 +
735 + /* print an address of _any_ initialized kernel symbol from this
736 + * module, to allow debugging with gdb that doesn't support data
737 +@@ -2385,11 +2421,15 @@ int __init lov_init(void)
738 + return -ENOMEM;
739 + }
740 +
741 +- rc = class_register_type(&lov_obd_ops, NULL, NULL,
742 ++ type = class_search_type(LUSTRE_LOD_NAME);
743 ++ if (type != NULL && type->typ_procsym != NULL)
744 ++ enable_proc = false;
745 ++
746 ++ rc = class_register_type(&lov_obd_ops, NULL, enable_proc, NULL,
747 + #ifndef HAVE_ONLY_PROCFS_SEQ
748 +- NULL,
749 ++ NULL,
750 + #endif
751 +- LUSTRE_LOV_NAME, &lov_device_type);
752 ++ LUSTRE_LOV_NAME, &lov_device_type);
753 +
754 + if (rc) {
755 + kmem_cache_destroy(lov_oinfo_slab);
756 +diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c
757 +index ee3a654..cea78ac 100644
758 +--- a/lustre/mdc/mdc_request.c
759 ++++ b/lustre/mdc/mdc_request.c
760 +@@ -3429,11 +3429,11 @@ struct md_ops mdc_md_ops = {
761 +
762 + int __init mdc_init(void)
763 + {
764 +- return class_register_type(&mdc_obd_ops, &mdc_md_ops, NULL,
765 ++ return class_register_type(&mdc_obd_ops, &mdc_md_ops, true, NULL,
766 + #ifndef HAVE_ONLY_PROCFS_SEQ
767 +- NULL,
768 ++ NULL,
769 + #endif
770 +- LUSTRE_MDC_NAME, NULL);
771 ++ LUSTRE_MDC_NAME, NULL);
772 + }
773 +
774 + #ifdef __KERNEL__
775 +diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c
776 +index fe9de80..0fe590e 100644
777 +--- a/lustre/mdd/mdd_device.c
778 ++++ b/lustre/mdd/mdd_device.c
779 +@@ -1582,11 +1582,11 @@ static int __init mdd_mod_init(void)
780 + hsm_actions_logops.lop_add = llog_cat_add_rec;
781 + hsm_actions_logops.lop_declare_add = llog_cat_declare_add_rec;
782 +
783 +- rc = class_register_type(&mdd_obd_device_ops, NULL, NULL,
784 ++ rc = class_register_type(&mdd_obd_device_ops, NULL, true, NULL,
785 + #ifndef HAVE_ONLY_PROCFS_SEQ
786 +- lvars.module_vars,
787 ++ lvars.module_vars,
788 + #endif
789 +- LUSTRE_MDD_NAME, &mdd_device_type);
790 ++ LUSTRE_MDD_NAME, &mdd_device_type);
791 + if (rc)
792 + lu_kmem_fini(mdd_caches);
793 + return rc;
794 +diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c
795 +index 0e1f0f6..69b1c30 100644
796 +--- a/lustre/mdt/mdt_handler.c
797 ++++ b/lustre/mdt/mdt_handler.c
798 +@@ -5901,11 +5901,11 @@ static int __init mdt_mod_init(void)
799 + GOTO(lu_fini, rc);
800 +
801 + lprocfs_mdt_init_vars(&lvars);
802 +- rc = class_register_type(&mdt_obd_device_ops, NULL, NULL,
803 ++ rc = class_register_type(&mdt_obd_device_ops, NULL, true, NULL,
804 + #ifndef HAVE_ONLY_PROCFS_SEQ
805 +- lvars.module_vars,
806 ++ lvars.module_vars,
807 + #endif
808 +- LUSTRE_MDT_NAME, &mdt_device_type);
809 ++ LUSTRE_MDT_NAME, &mdt_device_type);
810 + if (rc)
811 + GOTO(mds_fini, rc);
812 + lu_fini:
813 +diff --git a/lustre/mdt/mdt_mds.c b/lustre/mdt/mdt_mds.c
814 +index 367f659..390164f 100644
815 +--- a/lustre/mdt/mdt_mds.c
816 ++++ b/lustre/mdt/mdt_mds.c
817 +@@ -539,11 +539,11 @@ int mds_mod_init(void)
818 + mds_num_threads = mdt_num_threads;
819 + }
820 +
821 +- return class_register_type(&mds_obd_device_ops, NULL, NULL,
822 ++ return class_register_type(&mds_obd_device_ops, NULL, true, NULL,
823 + #ifndef HAVE_ONLY_PROCFS_SEQ
824 +- lprocfs_mds_module_vars,
825 ++ lprocfs_mds_module_vars,
826 + #endif
827 +- LUSTRE_MDS_NAME, &mds_device_type);
828 ++ LUSTRE_MDS_NAME, &mds_device_type);
829 + }
830 +
831 + void mds_mod_exit(void)
832 +diff --git a/lustre/mgc/libmgc.c b/lustre/mgc/libmgc.c
833 +index 49a329a..ec915c7 100644
834 +--- a/lustre/mgc/libmgc.c
835 ++++ b/lustre/mgc/libmgc.c
836 +@@ -158,9 +158,9 @@ struct obd_ops mgc_obd_ops = {
837 +
838 + int __init mgc_init(void)
839 + {
840 +- return class_register_type(&mgc_obd_ops, NULL, NULL,
841 ++ return class_register_type(&mgc_obd_ops, NULL, true, NULL,
842 + #ifndef HAVE_ONLY_PROCFS_SEQ
843 +- NULL,
844 ++ NULL,
845 + #endif
846 +- LUSTRE_MGC_NAME, NULL);
847 ++ LUSTRE_MGC_NAME, NULL);
848 + }
849 +diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c
850 +index 8935814..7741bbf 100644
851 +--- a/lustre/mgc/mgc_request.c
852 ++++ b/lustre/mgc/mgc_request.c
853 +@@ -2022,11 +2022,11 @@ struct obd_ops mgc_obd_ops = {
854 +
855 + int __init mgc_init(void)
856 + {
857 +- return class_register_type(&mgc_obd_ops, NULL, NULL,
858 ++ return class_register_type(&mgc_obd_ops, NULL, true, NULL,
859 + #ifndef HAVE_ONLY_PROCFS_SEQ
860 +- NULL,
861 ++ NULL,
862 + #endif
863 +- LUSTRE_MGC_NAME, NULL);
864 ++ LUSTRE_MGC_NAME, NULL);
865 + }
866 +
867 + #ifdef __KERNEL__
868 +diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c
869 +index 8961fc3..85b219c 100644
870 +--- a/lustre/mgs/mgs_handler.c
871 ++++ b/lustre/mgs/mgs_handler.c
872 +@@ -1516,11 +1516,11 @@ static int __init mgs_init(void)
873 + struct lprocfs_static_vars lvars;
874 +
875 + lprocfs_mgs_init_vars(&lvars);
876 +- return class_register_type(&mgs_obd_device_ops, NULL, NULL,
877 ++ return class_register_type(&mgs_obd_device_ops, NULL, true, NULL,
878 + #ifndef HAVE_ONLY_PROCFS_SEQ
879 +- lvars.module_vars,
880 ++ lvars.module_vars,
881 + #endif
882 +- LUSTRE_MGS_NAME, &mgs_device_type);
883 ++ LUSTRE_MGS_NAME, &mgs_device_type);
884 + }
885 +
886 + static void /*__exit*/ mgs_exit(void)
887 +diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c
888 +index bf8b6ce..98dbcce 100644
889 +--- a/lustre/obdclass/genops.c
890 ++++ b/lustre/obdclass/genops.c
891 +@@ -162,7 +162,7 @@ EXPORT_SYMBOL(class_put_type);
892 + #define CLASS_MAX_NAME 1024
893 +
894 + int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
895 +- struct lprocfs_seq_vars *module_vars,
896 ++ bool enable_proc, struct lprocfs_seq_vars *module_vars,
897 + #ifndef HAVE_ONLY_PROCFS_SEQ
898 + struct lprocfs_vars *vars,
899 + #endif
900 +@@ -202,22 +202,24 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
901 + spin_lock_init(&type->obd_type_lock);
902 +
903 + #ifdef LPROCFS
904 ++ if (enable_proc) {
905 + #ifndef HAVE_ONLY_PROCFS_SEQ
906 +- if (vars) {
907 +- type->typ_procroot = lprocfs_register(type->typ_name,
908 +- proc_lustre_root,
909 +- vars, type);
910 +- } else
911 ++ if (vars) {
912 ++ type->typ_procroot = lprocfs_register(type->typ_name,
913 ++ proc_lustre_root,
914 ++ vars, type);
915 ++ } else
916 + #endif
917 +- {
918 +- type->typ_procroot = lprocfs_seq_register(type->typ_name,
919 +- proc_lustre_root,
920 +- module_vars, type);
921 +- }
922 +- if (IS_ERR(type->typ_procroot)) {
923 +- rc = PTR_ERR(type->typ_procroot);
924 +- type->typ_procroot = NULL;
925 +- GOTO (failed, rc);
926 ++ {
927 ++ type->typ_procroot = lprocfs_seq_register(type->typ_name,
928 ++ proc_lustre_root,
929 ++ module_vars, type);
930 ++ }
931 ++ if (IS_ERR(type->typ_procroot)) {
932 ++ rc = PTR_ERR(type->typ_procroot);
933 ++ type->typ_procroot = NULL;
934 ++ GOTO(failed, rc);
935 ++ }
936 + }
937 + #endif
938 + if (ldt != NULL) {
939 +@@ -233,18 +235,20 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
940 +
941 + RETURN (0);
942 +
943 +- failed:
944 +-#ifdef LPROCFS
945 ++failed:
946 + if (type->typ_name != NULL) {
947 ++#ifdef LPROCFS
948 ++ if (type->typ_procroot != NULL) {
949 + #ifndef HAVE_ONLY_PROCFS_SEQ
950 +- lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root);
951 ++ lprocfs_try_remove_proc_entry(type->typ_name,
952 ++ proc_lustre_root);
953 + #else
954 +- remove_proc_subtree(type->typ_name, proc_lustre_root);
955 ++ remove_proc_subtree(type->typ_name, proc_lustre_root);
956 + #endif
957 +- }
958 ++ }
959 + #endif
960 +- if (type->typ_name != NULL)
961 + OBD_FREE(type->typ_name, strlen(name) + 1);
962 ++ }
963 + if (type->typ_md_ops != NULL)
964 + OBD_FREE_PTR(type->typ_md_ops);
965 + if (type->typ_dt_ops != NULL)
966 +@@ -278,11 +282,16 @@ int class_unregister_type(const char *name)
967 + * we can't reference pointer as it can get invalided when another
968 + * module removes the entry */
969 + #ifdef LPROCFS
970 ++ if (type->typ_procroot != NULL) {
971 + #ifndef HAVE_ONLY_PROCFS_SEQ
972 +- lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root);
973 ++ lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root);
974 + #else
975 +- remove_proc_subtree(type->typ_name, proc_lustre_root);
976 ++ remove_proc_subtree(type->typ_name, proc_lustre_root);
977 + #endif
978 ++ }
979 ++
980 ++ if (type->typ_procsym != NULL)
981 ++ lprocfs_remove(&type->typ_procsym);
982 + #endif
983 + if (type->typ_lu)
984 + lu_device_type_fini(type->typ_lu);
985 +diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c
986 +index a1051c2..18d5843 100644
987 +--- a/lustre/obdclass/llog_test.c
988 ++++ b/lustre/obdclass/llog_test.c
989 +@@ -1261,11 +1261,11 @@ static struct obd_ops llog_obd_ops = {
990 +
991 + static int __init llog_test_init(void)
992 + {
993 +- return class_register_type(&llog_obd_ops, NULL, NULL,
994 ++ return class_register_type(&llog_obd_ops, NULL, true, NULL,
995 + #ifndef HAVE_ONLY_PROCFS_SEQ
996 +- NULL,
997 ++ NULL,
998 + #endif
999 +- "llog_test", NULL);
1000 ++ "llog_test", NULL);
1001 + }
1002 +
1003 + static void __exit llog_test_exit(void)
1004 +diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c
1005 +index 9956ada..30d9f59 100644
1006 +--- a/lustre/obdclass/lprocfs_status.c
1007 ++++ b/lustre/obdclass/lprocfs_status.c
1008 +@@ -1936,7 +1936,6 @@ lprocfs_seq_obd_setup(struct obd_device *obd)
1009 + int rc = 0;
1010 +
1011 + LASSERT(obd != NULL);
1012 +- LASSERT(obd->obd_vars != NULL);
1013 + LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
1014 + LASSERT(obd->obd_type->typ_procroot != NULL);
1015 +
1016 +diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c
1017 +index 38cff00..632bf52 100644
1018 +--- a/lustre/obdecho/echo_client.c
1019 ++++ b/lustre/obdecho/echo_client.c
1020 +@@ -3169,12 +3169,12 @@ int echo_client_init(void)
1021 +
1022 + rc = lu_kmem_init(echo_caches);
1023 + if (rc == 0) {
1024 +- rc = class_register_type(&echo_client_obd_ops, NULL, NULL,
1025 ++ rc = class_register_type(&echo_client_obd_ops, NULL, true, NULL,
1026 + #ifndef HAVE_ONLY_PROCFS_SEQ
1027 +- NULL,
1028 ++ NULL,
1029 + #endif
1030 +- LUSTRE_ECHO_CLIENT_NAME,
1031 +- &echo_device_type);
1032 ++ LUSTRE_ECHO_CLIENT_NAME,
1033 ++ &echo_device_type);
1034 + if (rc)
1035 + lu_kmem_fini(echo_caches);
1036 + }
1037 +@@ -3202,7 +3202,7 @@ static int __init obdecho_init(void)
1038 + if (rc != 0)
1039 + goto failed_0;
1040 +
1041 +- rc = class_register_type(&echo_obd_ops, NULL, NULL,
1042 ++ rc = class_register_type(&echo_obd_ops, NULL, true, NULL,
1043 + #ifndef HAVE_ONLY_PROCFS_SEQ
1044 + NULL,
1045 + #endif
1046 +diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c
1047 +index 4cafa48..5d7f0b4 100644
1048 +--- a/lustre/ofd/ofd_dev.c
1049 ++++ b/lustre/ofd/ofd_dev.c
1050 +@@ -2394,11 +2394,11 @@ int __init ofd_init(void)
1051 +
1052 + lprocfs_ofd_init_vars(&lvars);
1053 +
1054 +- rc = class_register_type(&ofd_obd_ops, NULL, NULL,
1055 ++ rc = class_register_type(&ofd_obd_ops, NULL, true, NULL,
1056 + #ifndef HAVE_ONLY_PROCFS_SEQ
1057 +- lvars.module_vars,
1058 ++ lvars.module_vars,
1059 + #endif
1060 +- LUSTRE_OST_NAME, &ofd_device_type);
1061 ++ LUSTRE_OST_NAME, &ofd_device_type);
1062 + return rc;
1063 + }
1064 +
1065 +diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c
1066 +index 2b60765..076dcf6 100644
1067 +--- a/lustre/osc/osc_request.c
1068 ++++ b/lustre/osc/osc_request.c
1069 +@@ -3091,9 +3091,10 @@ static int brw_queue_work(const struct lu_env *env, void *data)
1070 +
1071 + int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
1072 + {
1073 +- struct client_obd *cli = &obd->u.cli;
1074 +- void *handler;
1075 +- int rc;
1076 ++ struct client_obd *cli = &obd->u.cli;
1077 ++ struct obd_type *type;
1078 ++ void *handler;
1079 ++ int rc;
1080 + ENTRY;
1081 +
1082 + rc = ptlrpcd_addref();
1083 +@@ -3119,10 +3120,32 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
1084 + GOTO(out_ptlrpcd_work, rc);
1085 +
1086 + cli->cl_grant_shrink_interval = GRANT_SHRINK_INTERVAL;
1087 ++
1088 + #ifdef LPROCFS
1089 + obd->obd_vars = lprocfs_osc_obd_vars;
1090 + #endif
1091 +- if (lprocfs_seq_obd_setup(obd) == 0) {
1092 ++ /* If this is true then both client (osc) and server (osp) are on the
1093 ++ * same node. The osp layer if loaded first will register the osc proc
1094 ++ * directory. In that case this obd_device will be attached its proc
1095 ++ * tree to type->typ_procsym instead of obd->obd_type->typ_procroot. */
1096 ++ type = class_search_type(LUSTRE_OSP_NAME);
1097 ++ if (type && type->typ_procsym) {
1098 ++ obd->obd_proc_entry = lprocfs_seq_register(obd->obd_name,
1099 ++ type->typ_procsym,
1100 ++ obd->obd_vars, obd);
1101 ++ if (IS_ERR(obd->obd_proc_entry)) {
1102 ++ rc = PTR_ERR(obd->obd_proc_entry);
1103 ++ CERROR("error %d setting up lprocfs for %s\n", rc,
1104 ++ obd->obd_name);
1105 ++ obd->obd_proc_entry = NULL;
1106 ++ }
1107 ++ } else {
1108 ++ rc = lprocfs_seq_obd_setup(obd);
1109 ++ }
1110 ++
1111 ++ /* If the basic OSC proc tree construction succeeded then
1112 ++ * lets do the rest. */
1113 ++ if (rc == 0) {
1114 + lproc_osc_attach_seqstat(obd);
1115 + sptlrpc_lprocfs_cliobd_attach(obd);
1116 + ptlrpc_lprocfs_register_obd(obd);
1117 +@@ -3140,7 +3163,7 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
1118 +
1119 + CFS_INIT_LIST_HEAD(&cli->cl_grant_shrink_list);
1120 + ns_register_cancel(obd->obd_namespace, osc_cancel_weight);
1121 +- RETURN(rc);
1122 ++ RETURN(0);
1123 +
1124 + out_ptlrpcd_work:
1125 + if (cli->cl_writeback_work != NULL) {
1126 +@@ -3282,8 +3305,10 @@ extern struct lock_class_key osc_ast_guard_class;
1127 +
1128 + int __init osc_init(void)
1129 + {
1130 +- int rc;
1131 +- ENTRY;
1132 ++ bool enable_proc = true;
1133 ++ struct obd_type *type;
1134 ++ int rc;
1135 ++ ENTRY;
1136 +
1137 + /* print an address of _any_ initialized kernel symbol from this
1138 + * module, to allow debugging with gdb that doesn't support data
1139 +@@ -3294,11 +3319,15 @@ int __init osc_init(void)
1140 + if (rc)
1141 + RETURN(rc);
1142 +
1143 +- rc = class_register_type(&osc_obd_ops, NULL, NULL,
1144 ++ type = class_search_type(LUSTRE_OSP_NAME);
1145 ++ if (type != NULL && type->typ_procsym != NULL)
1146 ++ enable_proc = false;
1147 ++
1148 ++ rc = class_register_type(&osc_obd_ops, NULL, enable_proc, NULL,
1149 + #ifndef HAVE_ONLY_PROCFS_SEQ
1150 +- NULL,
1151 ++ NULL,
1152 + #endif
1153 +- LUSTRE_OSC_NAME, &osc_device_type);
1154 ++ LUSTRE_OSC_NAME, &osc_device_type);
1155 + if (rc) {
1156 + lu_kmem_fini(osc_caches);
1157 + RETURN(rc);
1158 +diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c
1159 +index 7461f9d..e0da7e6 100644
1160 +--- a/lustre/osd-ldiskfs/osd_handler.c
1161 ++++ b/lustre/osd-ldiskfs/osd_handler.c
1162 +@@ -6019,11 +6019,11 @@ static int __init osd_mod_init(void)
1163 + if (rc)
1164 + return rc;
1165 +
1166 +- rc = class_register_type(&osd_obd_device_ops, NULL, NULL,
1167 ++ rc = class_register_type(&osd_obd_device_ops, NULL, true, NULL,
1168 + #ifndef HAVE_ONLY_PROCFS_SEQ
1169 +- lprocfs_osd_module_vars,
1170 ++ lprocfs_osd_module_vars,
1171 + #endif
1172 +- LUSTRE_OSD_LDISKFS_NAME, &osd_device_type);
1173 ++ LUSTRE_OSD_LDISKFS_NAME, &osd_device_type);
1174 + if (rc)
1175 + lu_kmem_fini(ldiskfs_caches);
1176 + return rc;
1177 +diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c
1178 +index 1025be9..47bbc76 100644
1179 +--- a/lustre/osd-zfs/osd_handler.c
1180 ++++ b/lustre/osd-zfs/osd_handler.c
1181 +@@ -912,11 +912,11 @@ int __init osd_init(void)
1182 + if (rc)
1183 + return rc;
1184 +
1185 +- rc = class_register_type(&osd_obd_device_ops, NULL, NULL,
1186 ++ rc = class_register_type(&osd_obd_device_ops, NULL, true, NULL,
1187 + #ifndef HAVE_ONLY_PROCFS_SEQ
1188 +- lprocfs_osd_module_vars,
1189 ++ lprocfs_osd_module_vars,
1190 + #endif
1191 +- LUSTRE_OSD_ZFS_NAME, &osd_device_type);
1192 ++ LUSTRE_OSD_ZFS_NAME, &osd_device_type);
1193 + if (rc)
1194 + lu_kmem_fini(osd_caches);
1195 + return rc;
1196 +diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c
1197 +index 550ba5e..60bf8ef 100644
1198 +--- a/lustre/osp/osp_dev.c
1199 ++++ b/lustre/osp/osp_dev.c
1200 +@@ -1239,7 +1239,7 @@ struct llog_operations osp_mds_ost_orig_logops;
1201 + static int __init osp_mod_init(void)
1202 + {
1203 + struct lprocfs_static_vars lvars;
1204 +- cfs_proc_dir_entry_t *osc_proc_dir;
1205 ++ struct obd_type *type;
1206 + int rc;
1207 +
1208 + rc = lu_kmem_init(osp_caches);
1209 +@@ -1248,11 +1248,11 @@ static int __init osp_mod_init(void)
1210 +
1211 + lprocfs_osp_init_vars(&lvars);
1212 +
1213 +- rc = class_register_type(&osp_obd_device_ops, NULL, NULL,
1214 ++ rc = class_register_type(&osp_obd_device_ops, NULL, true, NULL,
1215 + #ifndef HAVE_ONLY_PROCFS_SEQ
1216 +- lvars.module_vars,
1217 ++ lvars.module_vars,
1218 + #endif
1219 +- LUSTRE_OSP_NAME, &osp_device_type);
1220 ++ LUSTRE_OSP_NAME, &osp_device_type);
1221 +
1222 + /* create "osc" entry in procfs for compatibility purposes */
1223 + if (rc != 0) {
1224 +@@ -1262,11 +1262,11 @@ static int __init osp_mod_init(void)
1225 +
1226 + lprocfs_lwp_init_vars(&lvars);
1227 +
1228 +- rc = class_register_type(&lwp_obd_device_ops, NULL, NULL,
1229 ++ rc = class_register_type(&lwp_obd_device_ops, NULL, true, NULL,
1230 + #ifndef HAVE_ONLY_PROCFS_SEQ
1231 +- lvars.module_vars,
1232 ++ lvars.module_vars,
1233 + #endif
1234 +- LUSTRE_LWP_NAME, &lwp_device_type);
1235 ++ LUSTRE_LWP_NAME, &lwp_device_type);
1236 + if (rc != 0) {
1237 + class_unregister_type(LUSTRE_OSP_NAME);
1238 + lu_kmem_fini(osp_caches);
1239 +@@ -1278,14 +1278,17 @@ static int __init osp_mod_init(void)
1240 + osp_mds_ost_orig_logops.lop_add = llog_cat_add_rec;
1241 + osp_mds_ost_orig_logops.lop_declare_add = llog_cat_declare_add_rec;
1242 +
1243 +- osc_proc_dir = lprocfs_srch(proc_lustre_root, "osc");
1244 +- if (osc_proc_dir == NULL) {
1245 +- osc_proc_dir = lprocfs_register("osc", proc_lustre_root, NULL,
1246 +- NULL);
1247 +- if (IS_ERR(osc_proc_dir))
1248 +- CERROR("osp: can't create compat entry \"osc\": %d\n",
1249 +- (int) PTR_ERR(osc_proc_dir));
1250 +- }
1251 ++ /* create "osc" entry in procfs for compatibility purposes */
1252 ++ type = class_search_type(LUSTRE_OSC_NAME);
1253 ++ if (type != NULL && type->typ_procroot != NULL)
1254 ++ return rc;
1255 ++
1256 ++ type = class_search_type(LUSTRE_OSP_NAME);
1257 ++ type->typ_procsym = lprocfs_register("osc", proc_lustre_root,
1258 ++ NULL, NULL);
1259 ++ if (IS_ERR(type->typ_procsym))
1260 ++ CERROR("osp: can't create compat entry \"osc\": %d\n",
1261 ++ (int) PTR_ERR(type->typ_procsym));
1262 + return rc;
1263 + }
1264 +
1265 +diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c
1266 +index f7448d4..d8897cc 100644
1267 +--- a/lustre/ost/ost_handler.c
1268 ++++ b/lustre/ost/ost_handler.c
1269 +@@ -470,11 +470,11 @@ static int __init ost_init(void)
1270 +
1271 + ENTRY;
1272 +
1273 +- rc = class_register_type(&ost_obd_ops, NULL, NULL,
1274 ++ rc = class_register_type(&ost_obd_ops, NULL, true, NULL,
1275 + #ifndef HAVE_ONLY_PROCFS_SEQ
1276 +- NULL,
1277 ++ NULL,
1278 + #endif
1279 +- LUSTRE_OSS_NAME, NULL);
1280 ++ LUSTRE_OSS_NAME, NULL);
1281 +
1282 + if (ost_num_threads != 0 && oss_num_threads == 0) {
1283 + LCONSOLE_INFO("ost_num_threads module parameter is deprecated, "
1284 +diff --git a/lustre/quota/qmt_dev.c b/lustre/quota/qmt_dev.c
1285 +index 02ec55b..28783a0 100644
1286 +--- a/lustre/quota/qmt_dev.c
1287 ++++ b/lustre/quota/qmt_dev.c
1288 +@@ -466,11 +466,11 @@ int qmt_glb_init(void)
1289 + int rc;
1290 + ENTRY;
1291 +
1292 +- rc = class_register_type(&qmt_obd_ops, NULL, NULL,
1293 ++ rc = class_register_type(&qmt_obd_ops, NULL, true, NULL,
1294 + #ifndef HAVE_ONLY_PROCFS_SEQ
1295 +- NULL,
1296 ++ NULL,
1297 + #endif
1298 +- LUSTRE_QMT_NAME, &qmt_device_type);
1299 ++ LUSTRE_QMT_NAME, &qmt_device_type);
1300 + RETURN(rc);
1301 + }
1302 +
1303 +--
1304 +1.9.1
1305 +
1306
1307 diff --git a/sys-cluster/lustre/files/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch b/sys-cluster/lustre/files/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch
1308 new file mode 100644
1309 index 0000000..d7da497
1310 --- /dev/null
1311 +++ b/sys-cluster/lustre/files/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch
1312 @@ -0,0 +1,123 @@
1313 +From 7dbddd98e60ab73580ea52c8b53274da2283d624 Mon Sep 17 00:00:00 2001
1314 +From: James Simmons <uja.ornl@×××××.com>
1315 +Date: Tue, 25 Feb 2014 12:54:05 -0500
1316 +Subject: [PATCH 2/9] LU-3319 procfs: Move NRS TBF proc handling to seq_files
1317 +
1318 +With newer kernels moving their proc file system handling
1319 +to seq_files this patch migrates the proc handling for NRS
1320 +TBF to this new approach.
1321 +
1322 +Change-Id: I121755b611296bf7b9527de65d0e6cf8c4980151
1323 +Signed-off-by: James Simmons <uja.ornl@×××××.com>
1324 +---
1325 + lustre/ptlrpc/nrs_tbf.c | 35 ++++++++++++++---------------------
1326 + 1 file changed, 14 insertions(+), 21 deletions(-)
1327 +
1328 +diff --git a/lustre/ptlrpc/nrs_tbf.c b/lustre/ptlrpc/nrs_tbf.c
1329 +index 96eac30..09ab0e7 100644
1330 +--- a/lustre/ptlrpc/nrs_tbf.c
1331 ++++ b/lustre/ptlrpc/nrs_tbf.c
1332 +@@ -1572,30 +1572,26 @@ static void nrs_tbf_req_stop(struct ptlrpc_nrs_policy *policy,
1333 + */
1334 + #define LPROCFS_NRS_RATE_MAX 65535
1335 +
1336 +-static int ptlrpc_lprocfs_rd_nrs_tbf_rule(char *page, char **start,
1337 +- off_t off, int count, int *eof,
1338 +- void *data)
1339 ++static int
1340 ++ptlrpc_lprocfs_nrs_tbf_rule_seq_show(struct seq_file *m, void *data)
1341 + {
1342 +- struct ptlrpc_service *svc = data;
1343 ++ struct ptlrpc_service *svc = m->private;
1344 + int rc;
1345 + int rc2;
1346 + struct nrs_tbf_dump dump;
1347 +
1348 +- rc2 = snprintf(page, count, "regular_requests:\n");
1349 ++ rc2 = seq_printf(m, "regular_requests:\n");
1350 + /**
1351 + * Perform two separate calls to this as only one of the NRS heads'
1352 + * policies may be in the ptlrpc_nrs_pol_state::NRS_POL_STATE_STARTED or
1353 + * ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPING state.
1354 + */
1355 + dump.td_length = 0;
1356 +- dump.td_buff = page + rc2;
1357 +- dump.td_size = count - rc2;
1358 + rc = ptlrpc_nrs_policy_control(svc, PTLRPC_NRS_QUEUE_REG,
1359 + NRS_POL_NAME_TBF,
1360 + NRS_CTL_TBF_RD_RULE,
1361 + false, &dump);
1362 + if (rc == 0) {
1363 +- *eof = 1;
1364 + rc2 += dump.td_length;
1365 + /**
1366 + * Ignore -ENODEV as the regular NRS head's policy may be in the
1367 +@@ -1608,16 +1604,13 @@ static int ptlrpc_lprocfs_rd_nrs_tbf_rule(char *page, char **start,
1368 + if (!nrs_svc_has_hp(svc))
1369 + goto no_hp;
1370 +
1371 +- rc2 += snprintf(page + rc2, count - rc2, "high_priority_requests:\n");
1372 ++ rc2 += seq_printf(m, "high_priority_requests:\n");
1373 + dump.td_length = 0;
1374 +- dump.td_buff = page + rc2;
1375 +- dump.td_size = count - rc2;
1376 + rc = ptlrpc_nrs_policy_control(svc, PTLRPC_NRS_QUEUE_HP,
1377 + NRS_POL_NAME_TBF,
1378 + NRS_CTL_TBF_RD_RULE,
1379 + false, &dump);
1380 + if (rc == 0) {
1381 +- *eof = 1;
1382 + rc2 += dump.td_length;
1383 + /**
1384 + * Ignore -ENODEV as the high priority NRS head's policy may be
1385 +@@ -1762,11 +1755,12 @@ out:
1386 +
1387 + extern struct nrs_core nrs_core;
1388 + #define LPROCFS_WR_NRS_TBF_MAX_CMD (4096)
1389 +-static int ptlrpc_lprocfs_wr_nrs_tbf_rule(struct file *file,
1390 +- const char *buffer,
1391 +- unsigned long count, void *data)
1392 ++static ssize_t
1393 ++ptlrpc_lprocfs_nrs_tbf_rule_seq_write(struct file *file, const char *buffer,
1394 ++ size_t count, loff_t *off)
1395 + {
1396 +- struct ptlrpc_service *svc = data;
1397 ++ struct seq_file *m = file->private_data;
1398 ++ struct ptlrpc_service *svc = m->private;
1399 + char *kernbuf;
1400 + char *val;
1401 + int rc;
1402 +@@ -1830,7 +1824,7 @@ out_free_kernbuff:
1403 + out:
1404 + return rc ? rc : count;
1405 + }
1406 +-
1407 ++LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_tbf_rule);
1408 +
1409 + /**
1410 + * Initializes a TBF policy's lprocfs interface for service \a svc
1411 +@@ -1843,10 +1837,9 @@ out:
1412 + int nrs_tbf_lprocfs_init(struct ptlrpc_service *svc)
1413 + {
1414 + int rc;
1415 +- struct lprocfs_vars nrs_tbf_lprocfs_vars[] = {
1416 ++ struct lprocfs_seq_vars nrs_tbf_lprocfs_vars[] = {
1417 + { .name = "nrs_tbf_rule",
1418 +- .read_fptr = ptlrpc_lprocfs_rd_nrs_tbf_rule,
1419 +- .write_fptr = ptlrpc_lprocfs_wr_nrs_tbf_rule,
1420 ++ .fops = &ptlrpc_lprocfs_nrs_tbf_rule_fops,
1421 + .data = svc },
1422 + { NULL }
1423 + };
1424 +@@ -1854,7 +1847,7 @@ int nrs_tbf_lprocfs_init(struct ptlrpc_service *svc)
1425 + if (svc->srv_procroot == NULL)
1426 + return 0;
1427 +
1428 +- rc = lprocfs_add_vars(svc->srv_procroot, nrs_tbf_lprocfs_vars, NULL);
1429 ++ rc = lprocfs_seq_add_vars(svc->srv_procroot, nrs_tbf_lprocfs_vars, NULL);
1430 +
1431 + return rc;
1432 + }
1433 +--
1434 +1.9.1
1435 +
1436
1437 diff --git a/sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
1438 similarity index 79%
1439 rename from sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
1440 rename to sys-cluster/lustre/files/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
1441 index ff3c6bf..b06c8da 100644
1442 --- a/sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
1443 +++ b/sys-cluster/lustre/files/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
1444 @@ -1,7 +1,7 @@
1445 -From 699242b35f07c7c64959dca02cc359d389c7f568 Mon Sep 17 00:00:00 2001
1446 +From abe827ebe8722336c55affd8388dacfbb38b49f1 Mon Sep 17 00:00:00 2001
1447 From: James Simmons <uja.ornl@×××××.com>
1448 -Date: Fri, 3 Jan 2014 09:55:26 -0500
1449 -Subject: [PATCH 02/12] LU-3319 procfs: update zfs proc handling to seq_files
1450 +Date: Tue, 18 Feb 2014 18:44:22 -0500
1451 +Subject: [PATCH 3/9] LU-3319 procfs: update zfs proc handling to seq_files
1452
1453 Migrate all zfs proc handling to using strictly seq_files.
1454
1455 @@ -9,68 +9,61 @@ Signed-off-by: James Simmons <uja.ornl@×××××.com>
1456 Change-Id: I6dc7e65c3e74e7934a17939815ec3c334fac58c7
1457 ---
1458 lustre/osd-zfs/osd_handler.c | 13 ++++---
1459 - lustre/osd-zfs/osd_internal.h | 3 --
1460 - lustre/osd-zfs/osd_lproc.c | 88 ++++++++++++++++++++++++-------------------
1461 - 3 files changed, 57 insertions(+), 47 deletions(-)
1462 + lustre/osd-zfs/osd_internal.h | 3 +-
1463 + lustre/osd-zfs/osd_lproc.c | 90 +++++++++++++++++++++++++------------------
1464 + 3 files changed, 60 insertions(+), 46 deletions(-)
1465
1466 diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c
1467 -index 1025be9..c9bf49a 100644
1468 +index 47bbc76..05820e0 100644
1469 --- a/lustre/osd-zfs/osd_handler.c
1470 +++ b/lustre/osd-zfs/osd_handler.c
1471 -@@ -748,6 +748,7 @@ static int osd_device_init(const struct lu_env *env, struct lu_device *d,
1472 - static int osd_process_config(const struct lu_env *env,
1473 - struct lu_device *d, struct lustre_cfg *cfg)
1474 - {
1475 -+ struct obd_device *obd = d->ld_obd;
1476 - struct osd_device *o = osd_dev(d);
1477 - int rc;
1478 - ENTRY;
1479 -@@ -761,12 +762,12 @@ static int osd_process_config(const struct lu_env *env,
1480 +@@ -761,12 +761,13 @@ static int osd_process_config(const struct lu_env *env,
1481 break;
1482 case LCFG_PARAM: {
1483 LASSERT(&o->od_dt_dev);
1484 - rc = class_process_proc_param(PARAM_OSD, lprocfs_osd_obd_vars,
1485 - cfg, &o->od_dt_dev);
1486 -+ rc = class_process_proc_seq_param(PARAM_OSD, obd->obd_vars,
1487 -+ cfg, &o->od_dt_dev);
1488 ++ rc = class_process_proc_seq_param(PARAM_OSD,
1489 ++ lprocfs_osd_obd_vars, cfg,
1490 ++ &o->od_dt_dev);
1491 if (rc > 0 || rc == -ENOSYS)
1492 - rc = class_process_proc_param(PARAM_OST,
1493 - lprocfs_osd_obd_vars,
1494 - cfg, &o->od_dt_dev);
1495 + rc = class_process_proc_seq_param(PARAM_OST,
1496 -+ obd->obd_vars, cfg,
1497 -+ &o->od_dt_dev);
1498 ++ lprocfs_osd_obd_vars,
1499 ++ cfg, &o->od_dt_dev);
1500 break;
1501 }
1502 default:
1503 @@ -914,7 +915,7 @@ int __init osd_init(void)
1504
1505 - rc = class_register_type(&osd_obd_device_ops, NULL, NULL,
1506 + rc = class_register_type(&osd_obd_device_ops, NULL, true, NULL,
1507 #ifndef HAVE_ONLY_PROCFS_SEQ
1508 -- lprocfs_osd_module_vars,
1509 -+ NULL,
1510 +- lprocfs_osd_module_vars,
1511 ++ NULL,
1512 #endif
1513 - LUSTRE_OSD_ZFS_NAME, &osd_device_type);
1514 + LUSTRE_OSD_ZFS_NAME, &osd_device_type);
1515 if (rc)
1516 diff --git a/lustre/osd-zfs/osd_internal.h b/lustre/osd-zfs/osd_internal.h
1517 -index bc51cb1..77b118f 100644
1518 +index bc51cb1..3dc4881 100644
1519 --- a/lustre/osd-zfs/osd_internal.h
1520 +++ b/lustre/osd-zfs/osd_internal.h
1521 -@@ -402,9 +402,6 @@ enum {
1522 +@@ -402,8 +402,7 @@ enum {
1523 };
1524
1525 /* osd_lproc.c */
1526 -extern struct lprocfs_vars lprocfs_osd_obd_vars[];
1527 -extern struct lprocfs_vars lprocfs_osd_module_vars[];
1528 --
1529 ++extern struct lprocfs_seq_vars lprocfs_osd_obd_vars[];
1530 +
1531 int osd_procfs_init(struct osd_device *osd, const char *name);
1532 int osd_procfs_fini(struct osd_device *osd);
1533 -
1534 diff --git a/lustre/osd-zfs/osd_lproc.c b/lustre/osd-zfs/osd_lproc.c
1535 -index 0854ce6..a7ce60d 100644
1536 +index 0854ce6..bed08e9 100644
1537 --- a/lustre/osd-zfs/osd_lproc.c
1538 +++ b/lustre/osd-zfs/osd_lproc.c
1539 -@@ -107,27 +107,26 @@ out:
1540 +@@ -107,27 +107,27 @@ out:
1541 RETURN(result);
1542 }
1543
1544 @@ -105,11 +98,12 @@ index 0854ce6..a7ce60d 100644
1545 + size_t count, loff_t *off)
1546 {
1547 - struct dt_device *dt = data;
1548 -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private;
1549 ++ struct seq_file *m = file->private_data;
1550 ++ struct dt_device *dt = m->private;
1551 struct lu_env env;
1552 int rc;
1553
1554 -@@ -139,20 +138,21 @@ static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer,
1555 +@@ -139,20 +139,22 @@ static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer,
1556
1557 return rc == 0 ? count : rc;
1558 }
1559 @@ -133,12 +127,13 @@ index 0854ce6..a7ce60d 100644
1560 + size_t count, loff_t *off)
1561 {
1562 - struct osd_device *osd = osd_dt_dev((struct dt_device *)data);
1563 -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private;
1564 ++ struct seq_file *m = file->private_data;
1565 ++ struct dt_device *dt = m->private;
1566 + struct osd_device *osd = osd_dt_dev(dt);
1567 int rc, val;
1568
1569 LASSERT(osd != NULL);
1570 -@@ -165,24 +165,36 @@ static int lprocfs_osd_wr_iused_est(struct file *file, const char *buffer,
1571 +@@ -165,24 +167,36 @@ static int lprocfs_osd_wr_iused_est(struct file *file, const char *buffer,
1572
1573 return count;
1574 }
1575 @@ -193,7 +188,7 @@ index 0854ce6..a7ce60d 100644
1576 { 0 }
1577 };
1578
1579 -@@ -202,7 +214,7 @@ int osd_procfs_init(struct osd_device *osd, const char *name)
1580 +@@ -202,7 +216,7 @@ int osd_procfs_init(struct osd_device *osd, const char *name)
1581 LASSERT(name != NULL);
1582 LASSERT(type != NULL);
1583
1584 @@ -203,5 +198,5 @@ index 0854ce6..a7ce60d 100644
1585 if (IS_ERR(osd->od_proc_entry)) {
1586 rc = PTR_ERR(osd->od_proc_entry);
1587 --
1588 -1.8.5.3
1589 +1.9.1
1590
1591
1592 diff --git a/sys-cluster/lustre/files/0004-LU-3319-procfs-fix-symlink-handling.patch b/sys-cluster/lustre/files/0004-LU-3319-procfs-fix-symlink-handling.patch
1593 deleted file mode 100644
1594 index 935325e..0000000
1595 --- a/sys-cluster/lustre/files/0004-LU-3319-procfs-fix-symlink-handling.patch
1596 +++ /dev/null
1597 @@ -1,371 +0,0 @@
1598 -From 4bc21601224ea84152d9c3cc83eee33af8eb8cb2 Mon Sep 17 00:00:00 2001
1599 -From: James Simmons <uja.ornl@×××××.com>
1600 -Date: Sun, 9 Feb 2014 09:37:44 -0500
1601 -Subject: [PATCH 04/12] LU-3319 procfs: fix symlink handling
1602 -
1603 -While working on symlink handling for seq files I noticed a
1604 -long outstanding bug. Code was developed to link osc obds
1605 -to target_obds of the lov layer. The target_obds directory
1606 -was never created for the symlinks. This patches enables
1607 -this long forgotten feature. Also addressed is the race
1608 -condition experinced with server side code ported to
1609 -seq_files that used symlinks. To avoid the race the handle
1610 -obd_proc_private was moved from struct obd_device to
1611 -struct obd_type which now allows earlier registeration that
1612 -only happens once.
1613 -
1614 -Change-Id: Ib158ec4444ed7abc0f3c3e820ee4a333631a58d1
1615 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
1616 ----
1617 - lustre/include/obd.h | 17 +++++----
1618 - lustre/lmv/lmv_obd.c | 48 ++++++++---------------
1619 - lustre/lov/lov_obd.c | 99 +++++++++++++++++++++++++++---------------------
1620 - lustre/obdclass/genops.c | 17 +++++----
1621 - 4 files changed, 91 insertions(+), 90 deletions(-)
1622 -
1623 -diff --git a/lustre/include/obd.h b/lustre/include/obd.h
1624 -index ac80412..42266da 100644
1625 ---- a/lustre/include/obd.h
1626 -+++ b/lustre/include/obd.h
1627 -@@ -183,13 +183,15 @@ struct obd_info {
1628 - };
1629 -
1630 - struct obd_type {
1631 -- cfs_list_t typ_chain;
1632 -- struct obd_ops *typ_dt_ops;
1633 -- struct md_ops *typ_md_ops;
1634 -- cfs_proc_dir_entry_t *typ_procroot;
1635 -- char *typ_name;
1636 -- int typ_refcnt;
1637 -- struct lu_device_type *typ_lu;
1638 -+ struct list_head typ_chain;
1639 -+ struct obd_ops *typ_dt_ops;
1640 -+ struct md_ops *typ_md_ops;
1641 -+ cfs_proc_dir_entry_t *typ_procroot;
1642 -+ cfs_proc_dir_entry_t *typ_procsym;
1643 -+ __u32 typ_sym_filter;
1644 -+ char *typ_name;
1645 -+ int typ_refcnt;
1646 -+ struct lu_device_type *typ_lu;
1647 - spinlock_t obd_type_lock;
1648 - };
1649 -
1650 -@@ -825,7 +827,6 @@ struct obd_device {
1651 -
1652 - struct proc_dir_entry *obd_proc_entry;
1653 - struct proc_dir_entry *obd_proc_exports_entry;
1654 -- void *obd_proc_private; /* type private PDEs */
1655 - struct proc_dir_entry *obd_svc_procroot;
1656 - struct lprocfs_stats *obd_svc_stats;
1657 - struct lprocfs_seq_vars *obd_vars;
1658 -diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c
1659 -index ee5f3a7..66a9448 100644
1660 ---- a/lustre/lmv/lmv_obd.c
1661 -+++ b/lustre/lmv/lmv_obd.c
1662 -@@ -263,9 +263,6 @@ static int lmv_connect(const struct lu_env *env,
1663 - struct obd_uuid *cluuid, struct obd_connect_data *data,
1664 - void *localdata)
1665 - {
1666 --#ifdef __KERNEL__
1667 -- struct proc_dir_entry *lmv_proc_dir;
1668 --#endif
1669 - struct lmv_obd *lmv = &obd->u.lmv;
1670 - struct lustre_handle conn = { 0 };
1671 - int rc = 0;
1672 -@@ -298,18 +295,15 @@ static int lmv_connect(const struct lu_env *env,
1673 - lmv->conn_data = *data;
1674 -
1675 - #ifdef __KERNEL__
1676 -- if (obd->obd_proc_private != NULL) {
1677 -- lmv_proc_dir = obd->obd_proc_private;
1678 -- } else {
1679 -- lmv_proc_dir = lprocfs_seq_register("target_obds",
1680 -- obd->obd_proc_entry,
1681 -- NULL, NULL);
1682 -- if (IS_ERR(lmv_proc_dir)) {
1683 -+ if (obd->obd_type->typ_procsym == NULL) {
1684 -+ obd->obd_type->typ_procsym = lprocfs_seq_register("target_obds",
1685 -+ obd->obd_proc_entry,
1686 -+ NULL, NULL);
1687 -+ if (IS_ERR(obd->obd_type->typ_procsym)) {
1688 - CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.",
1689 - obd->obd_type->typ_name, obd->obd_name);
1690 -- lmv_proc_dir = NULL;
1691 -+ obd->obd_type->typ_procsym = NULL;
1692 - }
1693 -- obd->obd_proc_private = lmv_proc_dir;
1694 - }
1695 - #endif
1696 -
1697 -@@ -323,10 +317,8 @@ static int lmv_connect(const struct lu_env *env,
1698 - rc = lmv_check_connect(obd);
1699 -
1700 - #ifdef __KERNEL__
1701 -- if (rc && lmv_proc_dir) {
1702 -- lprocfs_remove(&lmv_proc_dir);
1703 -- obd->obd_proc_private = NULL;
1704 -- }
1705 -+ if (rc && obd->obd_type->typ_procsym != NULL)
1706 -+ lprocfs_remove(&obd->obd_type->typ_procsym);
1707 - #endif
1708 - RETURN(rc);
1709 - }
1710 -@@ -405,9 +397,6 @@ static int lmv_init_ea_size(struct obd_export *exp, int easize,
1711 -
1712 - int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
1713 - {
1714 --#ifdef __KERNEL__
1715 -- struct proc_dir_entry *lmv_proc_dir;
1716 --#endif
1717 - struct lmv_obd *lmv = &obd->u.lmv;
1718 - struct obd_uuid *cluuid = &lmv->cluuid;
1719 - struct obd_uuid lmv_mdc_uuid = { "LMV_MDC_UUID" };
1720 -@@ -487,14 +476,13 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
1721 - cfs_atomic_read(&obd->obd_refcount));
1722 -
1723 - #ifdef __KERNEL__
1724 -- lmv_proc_dir = obd->obd_proc_private;
1725 -- if (lmv_proc_dir) {
1726 -+ if (obd->obd_type->typ_procsym != NULL) {
1727 - struct proc_dir_entry *mdc_symlink;
1728 -
1729 - LASSERT(mdc_obd->obd_type != NULL);
1730 - LASSERT(mdc_obd->obd_type->typ_name != NULL);
1731 - mdc_symlink = lprocfs_add_symlink(mdc_obd->obd_name,
1732 -- lmv_proc_dir,
1733 -+ obd->obd_type->typ_procsym,
1734 - "../../../%s/%s",
1735 - mdc_obd->obd_type->typ_name,
1736 - mdc_obd->obd_name);
1737 -@@ -503,8 +491,7 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
1738 - "/proc/fs/lustre/%s/%s/target_obds/%s.",
1739 - obd->obd_type->typ_name, obd->obd_name,
1740 - mdc_obd->obd_name);
1741 -- lprocfs_remove(&lmv_proc_dir);
1742 -- obd->obd_proc_private = NULL;
1743 -+ lprocfs_remove(&obd->obd_type->typ_procsym);
1744 - }
1745 - }
1746 - #endif
1747 -@@ -696,9 +683,6 @@ int lmv_check_connect(struct obd_device *obd)
1748 -
1749 - static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
1750 - {
1751 --#ifdef __KERNEL__
1752 -- struct proc_dir_entry *lmv_proc_dir;
1753 --#endif
1754 - struct lmv_obd *lmv = &obd->u.lmv;
1755 - struct obd_device *mdc_obd;
1756 - int rc;
1757 -@@ -716,9 +700,9 @@ static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
1758 - }
1759 -
1760 - #ifdef __KERNEL__
1761 -- lmv_proc_dir = obd->obd_proc_private;
1762 -- if (lmv_proc_dir)
1763 -- lprocfs_remove_proc_entry(mdc_obd->obd_name, lmv_proc_dir);
1764 -+ if (obd->obd_type->typ_procsym != NULL)
1765 -+ lprocfs_remove_proc_entry(mdc_obd->obd_name,
1766 -+ obd->obd_type->typ_procsym);
1767 - #endif
1768 - rc = obd_fid_fini(tgt->ltd_exp->exp_obd);
1769 - if (rc)
1770 -@@ -768,8 +752,8 @@ static int lmv_disconnect(struct obd_export *exp)
1771 - }
1772 -
1773 - #ifdef __KERNEL__
1774 -- if (obd->obd_proc_private)
1775 -- lprocfs_remove((struct proc_dir_entry **)&obd->obd_proc_private);
1776 -+ if (obd->obd_type->typ_procsym != NULL)
1777 -+ lprocfs_remove(&obd->obd_type->typ_procsym);
1778 - else
1779 - CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n",
1780 - obd->obd_type->typ_name, obd->obd_name);
1781 -diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c
1782 -index 286cd15..a3310fd 100644
1783 ---- a/lustre/lov/lov_obd.c
1784 -+++ b/lustre/lov/lov_obd.c
1785 -@@ -127,19 +127,16 @@ static int lov_notify(struct obd_device *obd, struct obd_device *watched,
1786 - int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
1787 - struct obd_connect_data *data)
1788 - {
1789 -- struct lov_obd *lov = &obd->u.lov;
1790 -- struct obd_uuid *tgt_uuid;
1791 -- struct obd_device *tgt_obd;
1792 -- static struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
1793 -- struct obd_import *imp;
1794 --#ifdef __KERNEL__
1795 -- struct proc_dir_entry *lov_proc_dir;
1796 --#endif
1797 -- int rc;
1798 -- ENTRY;
1799 -+ struct lov_obd *lov = &obd->u.lov;
1800 -+ struct obd_uuid *tgt_uuid;
1801 -+ struct obd_device *tgt_obd;
1802 -+ static struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
1803 -+ struct obd_import *imp;
1804 -+ int rc;
1805 -+ ENTRY;
1806 -
1807 -- if (!lov->lov_tgts[index])
1808 -- RETURN(-EINVAL);
1809 -+ if (lov->lov_tgts[index] == NULL)
1810 -+ RETURN(-EINVAL);
1811 -
1812 - tgt_uuid = &lov->lov_tgts[index]->ltd_uuid;
1813 - tgt_obd = lov->lov_tgts[index]->ltd_obd;
1814 -@@ -195,27 +192,25 @@ int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
1815 - obd_uuid2str(tgt_uuid), tgt_obd->obd_name, activate ? "":"in");
1816 -
1817 - #ifdef __KERNEL__
1818 -- lov_proc_dir = obd->obd_proc_private;
1819 -- if (lov_proc_dir) {
1820 -- struct obd_device *osc_obd = lov->lov_tgts[index]->ltd_exp->exp_obd;
1821 -+ if (obd->obd_type->typ_procsym != NULL) {
1822 -+ struct obd_device *osc_obd = lov->lov_tgts[index]->ltd_exp->exp_obd;
1823 - struct proc_dir_entry *osc_symlink;
1824 -
1825 -- LASSERT(osc_obd != NULL);
1826 -- LASSERT(osc_obd->obd_magic == OBD_DEVICE_MAGIC);
1827 -- LASSERT(osc_obd->obd_type->typ_name != NULL);
1828 --
1829 -- osc_symlink = lprocfs_add_symlink(osc_obd->obd_name,
1830 -- lov_proc_dir,
1831 -- "../../../%s/%s",
1832 -- osc_obd->obd_type->typ_name,
1833 -- osc_obd->obd_name);
1834 -- if (osc_symlink == NULL) {
1835 -- CERROR("could not register LOV target "
1836 -- "/proc/fs/lustre/%s/%s/target_obds/%s.",
1837 -- obd->obd_type->typ_name, obd->obd_name,
1838 -- osc_obd->obd_name);
1839 -- lprocfs_remove(&lov_proc_dir);
1840 -- obd->obd_proc_private = NULL;
1841 -+ LASSERT(osc_obd != NULL);
1842 -+ LASSERT(osc_obd->obd_magic == OBD_DEVICE_MAGIC);
1843 -+ LASSERT(osc_obd->obd_type->typ_name != NULL);
1844 -+
1845 -+ osc_symlink = lprocfs_add_symlink(osc_obd->obd_name,
1846 -+ obd->obd_type->typ_procsym,
1847 -+ "../../../%s/%s",
1848 -+ osc_obd->obd_type->typ_name,
1849 -+ osc_obd->obd_name);
1850 -+ if (osc_symlink == NULL) {
1851 -+ CERROR("could not register LOV target "
1852 -+ "/proc/fs/lustre/%s/%s/target_obds/%s.",
1853 -+ obd->obd_type->typ_name, obd->obd_name,
1854 -+ osc_obd->obd_name);
1855 -+ lprocfs_remove(&obd->obd_type->typ_procsym);
1856 - }
1857 - }
1858 - #endif
1859 -@@ -250,6 +245,17 @@ static int lov_connect(const struct lu_env *env,
1860 - if (data)
1861 - lov->lov_ocd = *data;
1862 -
1863 -+#ifdef __KERNEL__
1864 -+ obd->obd_type->typ_procsym = lprocfs_seq_register("target_obds",
1865 -+ obd->obd_proc_entry,
1866 -+ NULL, NULL);
1867 -+ if (IS_ERR(obd->obd_type->typ_procsym)) {
1868 -+ CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.",
1869 -+ obd->obd_type->typ_name, obd->obd_name);
1870 -+ obd->obd_type->typ_procsym = NULL;
1871 -+ }
1872 -+#endif
1873 -+
1874 - obd_getref(obd);
1875 - for (i = 0; i < lov->desc.ld_tgt_count; i++) {
1876 - tgt = lov->lov_tgts[i];
1877 -@@ -280,7 +286,6 @@ static int lov_connect(const struct lu_env *env,
1878 -
1879 - static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
1880 - {
1881 -- struct proc_dir_entry *lov_proc_dir;
1882 - struct lov_obd *lov = &obd->u.lov;
1883 - struct obd_device *osc_obd;
1884 - int rc;
1885 -@@ -296,18 +301,18 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
1886 - tgt->ltd_exp->exp_obd->obd_inactive = 1;
1887 - }
1888 -
1889 -- lov_proc_dir = obd->obd_proc_private;
1890 -- if (lov_proc_dir)
1891 -- lprocfs_remove_proc_entry(osc_obd->obd_name, lov_proc_dir);
1892 -+ if (obd->obd_type->typ_procsym)
1893 -+ lprocfs_remove_proc_entry(osc_obd->obd_name,
1894 -+ obd->obd_type->typ_procsym);
1895 -
1896 -- if (osc_obd) {
1897 -- /* Pass it on to our clients.
1898 -- * XXX This should be an argument to disconnect,
1899 -- * XXX not a back-door flag on the OBD. Ah well.
1900 -- */
1901 -- osc_obd->obd_force = obd->obd_force;
1902 -- osc_obd->obd_fail = obd->obd_fail;
1903 -- osc_obd->obd_no_recov = obd->obd_no_recov;
1904 -+ if (osc_obd) {
1905 -+ /* Pass it on to our clients.
1906 -+ * XXX This should be an argument to disconnect,
1907 -+ * XXX not a back-door flag on the OBD. Ah well.
1908 -+ */
1909 -+ osc_obd->obd_force = obd->obd_force;
1910 -+ osc_obd->obd_fail = obd->obd_fail;
1911 -+ osc_obd->obd_no_recov = obd->obd_no_recov;
1912 - }
1913 -
1914 - obd_register_observer(osc_obd, NULL);
1915 -@@ -353,6 +358,14 @@ static int lov_disconnect(struct obd_export *exp)
1916 - }
1917 - obd_putref(obd);
1918 -
1919 -+#ifdef __KERNEL__
1920 -+ if (obd->obd_type->typ_procsym)
1921 -+ lprocfs_remove(&obd->obd_type->typ_procsym);
1922 -+ else
1923 -+ CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n",
1924 -+ obd->obd_type->typ_name, obd->obd_name);
1925 -+#endif
1926 -+
1927 - out:
1928 - rc = class_disconnect(exp); /* bz 9811 */
1929 - RETURN(rc);
1930 -diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c
1931 -index 20cd0a0..00bf342 100644
1932 ---- a/lustre/obdclass/genops.c
1933 -+++ b/lustre/obdclass/genops.c
1934 -@@ -181,14 +181,15 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
1935 - RETURN(-EEXIST);
1936 - }
1937 -
1938 -- rc = -ENOMEM;
1939 -- OBD_ALLOC(type, sizeof(*type));
1940 -- if (type == NULL)
1941 -- RETURN(rc);
1942 -+ rc = -ENOMEM;
1943 -+ OBD_ALLOC(type, sizeof(*type));
1944 -+ if (type == NULL)
1945 -+ RETURN(rc);
1946 -+ memset(type, 0, sizeof(*type));
1947 -
1948 -- OBD_ALLOC_PTR(type->typ_dt_ops);
1949 -- OBD_ALLOC_PTR(type->typ_md_ops);
1950 -- OBD_ALLOC(type->typ_name, strlen(name) + 1);
1951 -+ OBD_ALLOC_PTR(type->typ_dt_ops);
1952 -+ OBD_ALLOC_PTR(type->typ_md_ops);
1953 -+ OBD_ALLOC(type->typ_name, strlen(name) + 1);
1954 -
1955 - if (type->typ_dt_ops == NULL ||
1956 - type->typ_md_ops == NULL ||
1957 -@@ -242,6 +243,8 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
1958 - if (type->typ_dt_ops != NULL)
1959 - OBD_FREE_PTR(type->typ_dt_ops);
1960 - #ifdef LPROCFS
1961 -+ if (type->typ_procsym != NULL)
1962 -+ lprocfs_remove(&type->typ_procsym);
1963 - #ifndef HAVE_ONLY_PROCFS_SEQ
1964 - lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root);
1965 - #else
1966 ---
1967 -1.8.5.3
1968 -
1969
1970 diff --git a/sys-cluster/lustre/files/0003-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch
1971 similarity index 96%
1972 rename from sys-cluster/lustre/files/0003-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch
1973 rename to sys-cluster/lustre/files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch
1974 index 38785b2..c7d415a 100644
1975 --- a/sys-cluster/lustre/files/0003-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch
1976 +++ b/sys-cluster/lustre/files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch
1977 @@ -1,7 +1,7 @@
1978 -From 44eb91a37b43a71a0d531359c9da082b6e1ec454 Mon Sep 17 00:00:00 2001
1979 +From 00e2e7c431e38433b919735890481e4bb5707cd4 Mon Sep 17 00:00:00 2001
1980 From: James Simmons <uja.ornl@×××××.com>
1981 -Date: Fri, 3 Jan 2014 09:58:53 -0500
1982 -Subject: [PATCH 03/12] LU-3319 procfs: move mgs proc handling to seq_files
1983 +Date: Tue, 4 Mar 2014 10:45:30 -0500
1984 +Subject: [PATCH 4/9] LU-3319 procfs: move mgs proc handling to seq_files
1985
1986 With 3.10 linux kernel and above proc handling now only
1987 uses struct seq_files. This patch migrates the mgs
1988 @@ -271,22 +271,22 @@ index ffa2d0d..f0ea956 100644
1989 -}
1990 #endif
1991 diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c
1992 -index 5be9040..4bb842c 100644
1993 +index 85b219c..a9b0857 100644
1994 --- a/lustre/mgs/mgs_handler.c
1995 +++ b/lustre/mgs/mgs_handler.c
1996 -@@ -1434,12 +1434,9 @@ static struct obd_ops mgs_obd_device_ops = {
1997 +@@ -1513,12 +1513,9 @@ static struct obd_ops mgs_obd_device_ops = {
1998
1999 static int __init mgs_init(void)
2000 {
2001 - struct lprocfs_static_vars lvars;
2002 -
2003 - lprocfs_mgs_init_vars(&lvars);
2004 - return class_register_type(&mgs_obd_device_ops, NULL, NULL,
2005 + return class_register_type(&mgs_obd_device_ops, NULL, true, NULL,
2006 #ifndef HAVE_ONLY_PROCFS_SEQ
2007 -- lvars.module_vars,
2008 -+ NULL,
2009 +- lvars.module_vars,
2010 ++ NULL,
2011 #endif
2012 - LUSTRE_MGS_NAME, &mgs_device_type);
2013 + LUSTRE_MGS_NAME, &mgs_device_type);
2014 }
2015 diff --git a/lustre/mgs/mgs_internal.h b/lustre/mgs/mgs_internal.h
2016 index ca2846e..d3baacd 100644
2017 @@ -327,7 +327,7 @@ index ca2846e..d3baacd 100644
2018
2019 /* mgs/lproc_mgs.c */
2020 diff --git a/lustre/mgs/mgs_nids.c b/lustre/mgs/mgs_nids.c
2021 -index a2bae59..3248387 100644
2022 +index 24c9d22..a4d8800 100644
2023 --- a/lustre/mgs/mgs_nids.c
2024 +++ b/lustre/mgs/mgs_nids.c
2025 @@ -838,15 +838,14 @@ int lprocfs_rd_ir_state(struct seq_file *seq, void *data)
2026 @@ -352,5 +352,5 @@ index a2bae59..3248387 100644
2027 return lprocfs_wr_uint(file, buffer, count, &ir_timeout);
2028 }
2029 --
2030 -1.8.5.3
2031 +1.9.1
2032
2033
2034 diff --git a/sys-cluster/lustre/files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch
2035 index 2d5a974..e439041 100644
2036 --- a/sys-cluster/lustre/files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch
2037 +++ b/sys-cluster/lustre/files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch
2038 @@ -1,7 +1,7 @@
2039 -From e9786df9c5618c2cff7d81088548fefee874468a Mon Sep 17 00:00:00 2001
2040 +From ab793e8472447314f6428025175f80afc26339ac Mon Sep 17 00:00:00 2001
2041 From: James Simmons <uja.ornl@×××××.com>
2042 -Date: Sun, 9 Feb 2014 17:10:18 -0500
2043 -Subject: [PATCH 05/12] LU-3319 procfs: move osp proc handling to seq_files
2044 +Date: Wed, 26 Mar 2014 19:59:18 -0400
2045 +Subject: [PATCH 5/9] LU-3319 procfs: move osp proc handling to seq_files
2046
2047 With 3.10 linux kernel and above proc handling now only
2048 uses struct seq_files. This patch migrates the osp
2049 @@ -10,17 +10,17 @@ layer proc entries over to using seq_files.
2050 Signed-off-by: James Simmons <uja.ornl@×××××.com>
2051 Change-Id: Id8f77d72fd35755f1b7b1c17fcf27e0731bd5ac1
2052 ---
2053 - lustre/osp/lproc_osp.c | 373 ++++++++++++++++++++++++----------------------
2054 - lustre/osp/lwp_dev.c | 18 +--
2055 - lustre/osp/osp_dev.c | 48 +++---
2056 + lustre/osp/lproc_osp.c | 402 +++++++++++++++++++++++++---------------------
2057 + lustre/osp/lwp_dev.c | 19 +--
2058 + lustre/osp/osp_dev.c | 32 ++--
2059 lustre/osp/osp_internal.h | 2 -
2060 - 4 files changed, 222 insertions(+), 219 deletions(-)
2061 + 4 files changed, 228 insertions(+), 227 deletions(-)
2062
2063 diff --git a/lustre/osp/lproc_osp.c b/lustre/osp/lproc_osp.c
2064 -index 75ebeb1..1ec40fc 100644
2065 +index 75ebeb1..1271b7c 100644
2066 --- a/lustre/osp/lproc_osp.c
2067 +++ b/lustre/osp/lproc_osp.c
2068 -@@ -45,24 +45,23 @@
2069 +@@ -45,24 +45,24 @@
2070 #include "osp_internal.h"
2071
2072 #ifdef LPROCFS
2073 @@ -48,12 +48,13 @@ index 75ebeb1..1ec40fc 100644
2074 {
2075 - struct obd_device *dev = data;
2076 - int val, rc;
2077 -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
2078 ++ struct seq_file *m = file->private_data;
2079 ++ struct obd_device *dev = m->private;
2080 + int val, rc;
2081
2082 rc = lprocfs_write_helper(buffer, count, &val);
2083 if (rc)
2084 -@@ -81,67 +80,60 @@ static int osp_wr_active(struct file *file, const char *buffer,
2085 +@@ -81,67 +81,61 @@ static int osp_wr_active(struct file *file, const char *buffer,
2086 LPROCFS_CLIMP_EXIT(dev);
2087 return count;
2088 }
2089 @@ -137,11 +138,12 @@ index 75ebeb1..1ec40fc 100644
2090 + size_t count, loff_t *off)
2091 {
2092 - struct obd_device *dev = data;
2093 -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
2094 ++ struct seq_file *m = file->private_data;
2095 ++ struct obd_device *dev = m->private;
2096 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
2097 int val, rc;
2098
2099 -@@ -158,25 +150,24 @@ static int osp_wr_max_rpcs_in_flight(struct file *file, const char *buffer,
2100 +@@ -158,25 +152,25 @@ static int osp_wr_max_rpcs_in_flight(struct file *file, const char *buffer,
2101 osp->opd_syn_max_rpc_in_flight = val;
2102 return count;
2103 }
2104 @@ -171,11 +173,12 @@ index 75ebeb1..1ec40fc 100644
2105 + size_t count, loff_t *off)
2106 {
2107 - struct obd_device *dev = data;
2108 -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
2109 ++ struct seq_file *m = file->private_data;
2110 ++ struct obd_device *dev = m->private;
2111 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
2112 int val, rc;
2113
2114 -@@ -194,23 +185,24 @@ static int osp_wr_max_rpcs_in_prog(struct file *file, const char *buffer,
2115 +@@ -194,23 +188,25 @@ static int osp_wr_max_rpcs_in_prog(struct file *file, const char *buffer,
2116
2117 return count;
2118 }
2119 @@ -203,11 +206,12 @@ index 75ebeb1..1ec40fc 100644
2120 + size_t count, loff_t *off)
2121 {
2122 - struct obd_device *obd = data;
2123 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
2124 ++ struct seq_file *m = file->private_data;
2125 ++ struct obd_device *obd = m->private;
2126 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
2127 int val, rc, i;
2128
2129 -@@ -242,23 +234,24 @@ static int osp_wr_create_count(struct file *file, const char *buffer,
2130 +@@ -242,23 +238,25 @@ static int osp_wr_create_count(struct file *file, const char *buffer,
2131
2132 return count;
2133 }
2134 @@ -235,11 +239,12 @@ index 75ebeb1..1ec40fc 100644
2135 + size_t count, loff_t *off)
2136 {
2137 - struct obd_device *obd = data;
2138 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
2139 ++ struct seq_file *m = file->private_data;
2140 ++ struct obd_device *obd = m->private;
2141 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
2142 int val, rc;
2143
2144 -@@ -281,89 +274,85 @@ static int osp_wr_max_create_count(struct file *file, const char *buffer,
2145 +@@ -281,89 +279,86 @@ static int osp_wr_max_create_count(struct file *file, const char *buffer,
2146
2147 return count;
2148 }
2149 @@ -353,11 +358,12 @@ index 75ebeb1..1ec40fc 100644
2150 + size_t count, loff_t *off)
2151 {
2152 - struct obd_device *dev = data;
2153 -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
2154 ++ struct seq_file *m = file->private_data;
2155 ++ struct obd_device *dev = m->private;
2156 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
2157 int val, rc;
2158
2159 -@@ -381,25 +370,23 @@ static int osp_wr_maxage(struct file *file, const char *buffer,
2160 +@@ -381,25 +376,23 @@ static int osp_wr_maxage(struct file *file, const char *buffer,
2161
2162 return count;
2163 }
2164 @@ -390,7 +396,7 @@ index 75ebeb1..1ec40fc 100644
2165 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
2166
2167 if (osp == NULL)
2168 -@@ -411,87 +398,126 @@ static int osp_rd_destroys_in_flight(char *page, char **start, off_t off,
2169 +@@ -411,126 +404,161 @@ static int osp_rd_destroys_in_flight(char *page, char **start, off_t off,
2170 * - sync changes are zero - no llog records
2171 * - sync in progress are zero - no RPCs in flight
2172 */
2173 @@ -566,31 +572,49 @@ index 75ebeb1..1ec40fc 100644
2174 {
2175 struct obd_device *obd = osp->opd_obd;
2176 - struct proc_dir_entry *osc_proc_dir;
2177 -+ struct proc_dir_entry *symlink = NULL;
2178 ++ struct proc_dir_entry *osc_proc_dir = NULL;
2179 ++ struct obd_type *type;
2180 int rc;
2181
2182 - obd->obd_proc_entry = lprocfs_register(obd->obd_name,
2183 -+ obd->obd_proc_entry = lprocfs_seq_register(obd->obd_name,
2184 - obd->obd_type->typ_procroot,
2185 - lprocfs_osp_osd_vars,
2186 - &osp->opd_dt_dev);
2187 -@@ -502,34 +528,29 @@ void osp_lprocfs_init(struct osp_device *osp)
2188 +- obd->obd_type->typ_procroot,
2189 +- lprocfs_osp_osd_vars,
2190 +- &osp->opd_dt_dev);
2191 +- if (IS_ERR(obd->obd_proc_entry)) {
2192 +- CERROR("%s: can't register in lprocfs: %ld\n",
2193 +- obd->obd_name, PTR_ERR(obd->obd_proc_entry));
2194 +- obd->obd_proc_entry = NULL;
2195 ++ obd->obd_vars = lprocfs_osp_obd_vars;
2196 ++ if (lprocfs_seq_obd_setup(obd) != 0)
2197 return;
2198 - }
2199 +- }
2200
2201 - rc = lprocfs_add_vars(obd->obd_proc_entry, lprocfs_osp_obd_vars, obd);
2202 -+ rc = lprocfs_seq_add_vars(obd->obd_proc_entry, lprocfs_osp_obd_vars, obd);
2203 ++ rc = lprocfs_seq_add_vars(obd->obd_proc_entry, lprocfs_osp_osd_vars,
2204 ++ &osp->opd_dt_dev);
2205 if (rc) {
2206 - CERROR("%s: can't register in lprocfs: %ld\n",
2207 - obd->obd_name, PTR_ERR(obd->obd_proc_entry));
2208 +- CERROR("%s: can't register in lprocfs: %ld\n",
2209 +- obd->obd_name, PTR_ERR(obd->obd_proc_entry));
2210 ++ CERROR("%s: can't register in lprocfs, rc %d\n",
2211 ++ obd->obd_name, rc);
2212 return;
2213 }
2214 -+ obd->obd_vars = lprocfs_osp_obd_vars;
2215
2216 ptlrpc_lprocfs_register_obd(obd);
2217
2218 -+ if (osp->opd_connect_mdt || obd->obd_type->typ_procsym == NULL ||
2219 -+ !strstr(obd->obd_name, "osc"))
2220 ++ if (osp->opd_connect_mdt || !strstr(obd->obd_name, "osc"))
2221 ++ return;
2222 ++
2223 ++ /* If the real OSC is present which is the case for setups
2224 ++ * with both server and clients on the same node then use
2225 ++ * the OSC's proc root */
2226 ++ type = class_search_type(LUSTRE_OSC_NAME);
2227 ++ if (type != NULL && type->typ_procroot != NULL)
2228 ++ osc_proc_dir = type->typ_procroot;
2229 ++ else
2230 ++ osc_proc_dir = obd->obd_type->typ_procsym;
2231 ++
2232 ++ if (osc_proc_dir == NULL)
2233 + return;
2234 +
2235 /* for compatibility we link old procfs's OSC entries to osp ones */
2236 @@ -612,31 +636,28 @@ index 75ebeb1..1ec40fc 100644
2237 - OBD_FREE(name, strlen(obd->obd_name) + 1);
2238 - osp->opd_symlink = symlink;
2239 - }
2240 -+ symlink = lprocfs_add_symlink(obd->obd_name, obd->obd_type->typ_procsym,
2241 -+ "../osp/%s", obd->obd_name);
2242 -+ if (symlink == NULL) {
2243 +- }
2244 ++ osp->opd_symlink = lprocfs_add_symlink(obd->obd_name, osc_proc_dir,
2245 ++ "../osp/%s", obd->obd_name);
2246 ++ if (osp->opd_symlink == NULL)
2247 + CERROR("could not register OSC symlink for "
2248 + "/proc/fs/lustre/osp/%s.", obd->obd_name);
2249 -+ lprocfs_remove(&obd->obd_type->typ_procsym);
2250 -+ } else {
2251 -+ osp->opd_symlink = symlink;
2252 - }
2253 }
2254
2255 + #endif /* LPROCFS */
2256 diff --git a/lustre/osp/lwp_dev.c b/lustre/osp/lwp_dev.c
2257 -index dc4f978..b6e84e1 100644
2258 +index a73973a..c115ee6 100644
2259 --- a/lustre/osp/lwp_dev.c
2260 +++ b/lustre/osp/lwp_dev.c
2261 -@@ -184,25 +184,13 @@ const struct lu_device_operations lwp_lu_ops = {
2262 +@@ -184,25 +184,9 @@ const struct lu_device_operations lwp_lu_ops = {
2263 .ldo_process_config = lwp_process_config,
2264 };
2265
2266 -static struct lprocfs_vars lprocfs_lwp_module_vars[] = {
2267 - { "num_refs", lprocfs_rd_numrefs, 0, 0 },
2268 -+static struct lprocfs_seq_vars lprocfs_lwp_obd_vars[] = {
2269 - { 0 }
2270 - };
2271 -
2272 +- { 0 }
2273 +-};
2274 +-
2275 -static struct lprocfs_vars lprocfs_lwp_obd_vars[] = {
2276 - { 0 }
2277 -};
2278 @@ -654,19 +675,18 @@ index dc4f978..b6e84e1 100644
2279 int rc;
2280 ENTRY;
2281
2282 -@@ -231,8 +219,8 @@ int lwp_init0(const struct lu_env *env, struct lwp_device *lwp,
2283 +@@ -231,8 +215,7 @@ int lwp_init0(const struct lu_env *env, struct lwp_device *lwp,
2284 RETURN(rc);
2285 }
2286
2287 - lprocfs_lwp_init_vars(&lvars);
2288 - if (lprocfs_obd_setup(lwp->lpd_obd, lvars.obd_vars) == 0)
2289 -+ lwp->lpd_obd->obd_vars = lprocfs_lwp_obd_vars;
2290 + if (lprocfs_seq_obd_setup(lwp->lpd_obd) == 0)
2291 ptlrpc_lprocfs_register_obd(lwp->lpd_obd);
2292
2293 RETURN(0);
2294 diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c
2295 -index a8d75ea..336b9f0 100644
2296 +index 60bf8ef..b0c68ad 100644
2297 --- a/lustre/osp/osp_dev.c
2298 +++ b/lustre/osp/osp_dev.c
2299 @@ -366,7 +366,7 @@ static int osp_process_config(const struct lu_env *env,
2300 @@ -693,24 +713,13 @@ index a8d75ea..336b9f0 100644
2301 if (rc > 0)
2302 rc = 0;
2303 if (rc == -ENOSYS) {
2304 -@@ -844,6 +842,9 @@ static struct lu_device *osp_device_fini(const struct lu_env *env,
2305 - OBD_FREE_PTR(cli->cl_rpc_lock);
2306 - cli->cl_rpc_lock = NULL;
2307 - }
2308 -+ } else {
2309 -+ if (m->opd_obd->obd_type->typ_procsym != NULL)
2310 -+ lprocfs_remove(&m->opd_obd->obd_type->typ_procsym);
2311 - }
2312 -
2313 - rc = client_obd_cleanup(m->opd_obd);
2314 -@@ -1233,33 +1234,26 @@ struct llog_operations osp_mds_ost_orig_logops;
2315 +@@ -1238,33 +1236,27 @@ struct llog_operations osp_mds_ost_orig_logops;
2316
2317 static int __init osp_mod_init(void)
2318 {
2319 - struct lprocfs_static_vars lvars;
2320 -- cfs_proc_dir_entry_t *osc_proc_dir;
2321 + struct obd_type *type;
2322 - int rc;
2323 -+ struct obd_type *type;
2324 + int rc;
2325
2326 rc = lu_kmem_init(osp_caches);
2327 @@ -718,13 +727,13 @@ index a8d75ea..336b9f0 100644
2328 return rc;
2329
2330 - lprocfs_osp_init_vars(&lvars);
2331 --
2332 - rc = class_register_type(&osp_obd_device_ops, NULL, NULL,
2333 +
2334 + rc = class_register_type(&osp_obd_device_ops, NULL, true, NULL,
2335 #ifndef HAVE_ONLY_PROCFS_SEQ
2336 -- lvars.module_vars,
2337 -+ NULL,
2338 +- lvars.module_vars,
2339 ++ NULL,
2340 #endif
2341 - LUSTRE_OSP_NAME, &osp_device_type);
2342 + LUSTRE_OSP_NAME, &osp_device_type);
2343 -
2344 - /* create "osc" entry in procfs for compatibility purposes */
2345 if (rc != 0) {
2346 @@ -734,36 +743,27 @@ index a8d75ea..336b9f0 100644
2347
2348 - lprocfs_lwp_init_vars(&lvars);
2349 -
2350 - rc = class_register_type(&lwp_obd_device_ops, NULL, NULL,
2351 + rc = class_register_type(&lwp_obd_device_ops, NULL, true, NULL,
2352 #ifndef HAVE_ONLY_PROCFS_SEQ
2353 -- lvars.module_vars,
2354 -+ NULL,
2355 +- lvars.module_vars,
2356 ++ NULL,
2357 #endif
2358 - LUSTRE_LWP_NAME, &lwp_device_type);
2359 + LUSTRE_LWP_NAME, &lwp_device_type);
2360 if (rc != 0) {
2361 -@@ -1273,21 +1267,23 @@ static int __init osp_mod_init(void)
2362 - osp_mds_ost_orig_logops.lop_add = llog_cat_add_rec;
2363 - osp_mds_ost_orig_logops.lop_declare_add = llog_cat_declare_add_rec;
2364 -
2365 -- osc_proc_dir = lprocfs_srch(proc_lustre_root, "osc");
2366 -- if (osc_proc_dir == NULL) {
2367 -- osc_proc_dir = lprocfs_register("osc", proc_lustre_root, NULL,
2368 -- NULL);
2369 -- if (IS_ERR(osc_proc_dir))
2370 -- CERROR("osp: can't create compat entry \"osc\": %d\n",
2371 -- (int) PTR_ERR(osc_proc_dir));
2372 -+ type = class_search_type(LUSTRE_OSC_NAME);
2373 -+ if (type)
2374 -+ return rc;
2375 -+
2376 -+ type = class_search_type(LUSTRE_OSP_NAME);
2377 +@@ -1284,18 +1276,18 @@ static int __init osp_mod_init(void)
2378 + return rc;
2379 +
2380 + type = class_search_type(LUSTRE_OSP_NAME);
2381 +- type->typ_procsym = lprocfs_register("osc", proc_lustre_root,
2382 +- NULL, NULL);
2383 +- if (IS_ERR(type->typ_procsym))
2384 + type->typ_procsym = lprocfs_seq_register("osc", proc_lustre_root,
2385 + NULL, NULL);
2386 + if (IS_ERR(type->typ_procsym)) {
2387 -+ CERROR("osp: can't create compat entry \"osc\": %d\n",
2388 -+ (int) PTR_ERR(type->typ_procsym));
2389 + CERROR("osp: can't create compat entry \"osc\": %d\n",
2390 + (int) PTR_ERR(type->typ_procsym));
2391 + type->typ_procsym = NULL;
2392 - }
2393 ++ }
2394 return rc;
2395 }
2396
2397 @@ -775,10 +775,10 @@ index a8d75ea..336b9f0 100644
2398 class_unregister_type(LUSTRE_OSP_NAME);
2399 lu_kmem_fini(osp_caches);
2400 diff --git a/lustre/osp/osp_internal.h b/lustre/osp/osp_internal.h
2401 -index 2af16c0..84eca11 100644
2402 +index 1291374..66ad203 100644
2403 --- a/lustre/osp/osp_internal.h
2404 +++ b/lustre/osp/osp_internal.h
2405 -@@ -526,7 +526,6 @@ int osp_write_last_oid_seq_files(struct lu_env *env, struct osp_device *osp,
2406 +@@ -530,7 +530,6 @@ int osp_write_last_oid_seq_files(struct lu_env *env, struct osp_device *osp,
2407 int osp_init_pre_fid(struct osp_device *osp);
2408
2409 /* lproc_osp.c */
2410 @@ -786,7 +786,7 @@ index 2af16c0..84eca11 100644
2411 void osp_lprocfs_init(struct osp_device *osp);
2412
2413 /* osp_sync.c */
2414 -@@ -540,7 +539,6 @@ int osp_sync_fini(struct osp_device *d);
2415 +@@ -544,7 +543,6 @@ int osp_sync_fini(struct osp_device *d);
2416 void __osp_sync_check_for_work(struct osp_device *d);
2417
2418 /* lwp_dev.c */
2419 @@ -795,5 +795,5 @@ index 2af16c0..84eca11 100644
2420 extern struct lu_device_type lwp_device_type;
2421
2422 --
2423 -1.8.5.3
2424 +1.9.1
2425
2426
2427 diff --git a/sys-cluster/lustre/files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch
2428 index 06e3571..d9bcc89 100644
2429 --- a/sys-cluster/lustre/files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch
2430 +++ b/sys-cluster/lustre/files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch
2431 @@ -1,7 +1,7 @@
2432 -From 2670599090a754d9fa8c7d952b530bc8fb88d56e Mon Sep 17 00:00:00 2001
2433 +From 1394aacb441c3ba07b24a4b465f2496af8eb3c73 Mon Sep 17 00:00:00 2001
2434 From: James Simmons <uja.ornl@×××××.com>
2435 -Date: Sun, 9 Feb 2014 11:08:45 -0500
2436 -Subject: [PATCH 06/12] LU-3319 procfs: move lod proc handling to seq_files
2437 +Date: Wed, 26 Mar 2014 19:57:44 -0400
2438 +Subject: [PATCH 6/9] LU-3319 procfs: move lod proc handling to seq_files
2439
2440 With 3.10 linux kernel and above proc handling now only
2441 uses struct seq_files. This patch migrates the lod
2442 @@ -10,14 +10,14 @@ layer proc entries over to using seq_files.
2443 Signed-off-by: James Simmons <uja.ornl@×××××.com>
2444 Change-Id: Iaa0f617fcd430e91f12afbc0faf6906fd275a7a5
2445 ---
2446 - lustre/lod/lod_dev.c | 39 ++++---
2447 + lustre/lod/lod_dev.c | 23 ++--
2448 lustre/lod/lod_internal.h | 1 -
2449 lustre/lod/lod_pool.c | 7 +-
2450 - lustre/lod/lproc_lod.c | 251 ++++++++++++++++++++++++----------------------
2451 - 4 files changed, 152 insertions(+), 146 deletions(-)
2452 + lustre/lod/lproc_lod.c | 267 +++++++++++++++++++++++++---------------------
2453 + 4 files changed, 157 insertions(+), 141 deletions(-)
2454
2455 diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c
2456 -index a451462..8776aa3 100644
2457 +index a653d6a..1baeb37 100644
2458 --- a/lustre/lod/lod_dev.c
2459 +++ b/lustre/lod/lod_dev.c
2460 @@ -289,12 +289,10 @@ static int lod_process_config(const struct lu_env *env,
2461 @@ -36,70 +36,56 @@ index a451462..8776aa3 100644
2462 if (rc > 0)
2463 rc = 0;
2464 GOTO(out, rc);
2465 -@@ -890,19 +888,16 @@ static struct obd_ops lod_obd_device_ops = {
2466 +@@ -891,7 +889,6 @@ static struct obd_ops lod_obd_device_ops = {
2467
2468 static int __init lod_mod_init(void)
2469 {
2470 - struct lprocfs_static_vars lvars = { 0 };
2471 -- cfs_proc_dir_entry_t *lov_proc_dir;
2472 -- int rc;
2473 -+ struct obd_type *lod, *lov;
2474 -+ int rc;
2475 + struct obd_type *type;
2476 + int rc;
2477
2478 - rc = lu_kmem_init(lod_caches);
2479 +@@ -899,11 +896,9 @@ static int __init lod_mod_init(void)
2480 if (rc)
2481 return rc;
2482
2483 - lprocfs_lod_init_vars(&lvars);
2484 -
2485 - rc = class_register_type(&lod_obd_device_ops, NULL, NULL,
2486 + rc = class_register_type(&lod_obd_device_ops, NULL, true, NULL,
2487 #ifndef HAVE_ONLY_PROCFS_SEQ
2488 -- lvars.module_vars,
2489 -+ NULL,
2490 +- lvars.module_vars,
2491 ++ NULL,
2492 #endif
2493 - LUSTRE_LOD_NAME, &lod_device_type);
2494 + LUSTRE_LOD_NAME, &lod_device_type);
2495 if (rc) {
2496 -@@ -911,23 +906,25 @@ static int __init lod_mod_init(void)
2497 - }
2498 +@@ -917,18 +912,18 @@ static int __init lod_mod_init(void)
2499 + return rc;
2500
2501 - /* create "lov" entry in procfs for compatibility purposes */
2502 -- lov_proc_dir = lprocfs_srch(proc_lustre_root, "lov");
2503 -- if (lov_proc_dir == NULL) {
2504 -- lov_proc_dir = lprocfs_register("lov", proc_lustre_root,
2505 -- NULL, NULL);
2506 -- if (IS_ERR(lov_proc_dir))
2507 -+ lod = class_search_type(LUSTRE_LOD_NAME);
2508 -+ lov = class_search_type(LUSTRE_LOV_NAME);
2509 -+ if (lov == NULL) {
2510 -+ lod->typ_procsym = lprocfs_seq_register("lov", proc_lustre_root,
2511 -+ NULL, NULL);
2512 -+ if (IS_ERR(lod->typ_procsym)) {
2513 - CERROR("lod: can't create compat entry \"lov\": %d\n",
2514 -- (int)PTR_ERR(lov_proc_dir));
2515 -+ (int)PTR_ERR(lod->typ_procsym));
2516 -+ lod->typ_procsym = NULL;
2517 -+ }
2518 -+ } else {
2519 -+ /* Map lov proc root to lod symlink */
2520 -+ lod->typ_procsym = lov->typ_procroot;
2521 - }
2522 --
2523 + type = class_search_type(LUSTRE_LOD_NAME);
2524 +- type->typ_procsym = lprocfs_register("lov", proc_lustre_root,
2525 +- NULL, NULL);
2526 +- if (IS_ERR(type->typ_procsym))
2527 ++ type->typ_procsym = lprocfs_seq_register("lov", proc_lustre_root,
2528 ++ NULL, NULL);
2529 ++ if (IS_ERR(type->typ_procsym)) {
2530 + CERROR("lod: can't create compat entry \"lov\": %d\n",
2531 + (int)PTR_ERR(type->typ_procsym));
2532 ++ type->typ_procsym = NULL;
2533 ++ }
2534 return rc;
2535 }
2536
2537 static void __exit lod_mod_exit(void)
2538 {
2539 --
2540 - lprocfs_try_remove_proc_entry("lov", proc_lustre_root);
2541 -
2542 class_unregister_type(LUSTRE_LOD_NAME);
2543 lu_kmem_fini(lod_caches);
2544 }
2545 diff --git a/lustre/lod/lod_internal.h b/lustre/lod/lod_internal.h
2546 -index 2a00890..65ba47a 100644
2547 +index c3b1bc3..fc18f3d 100644
2548 --- a/lustre/lod/lod_internal.h
2549 +++ b/lustre/lod/lod_internal.h
2550 -@@ -431,7 +431,6 @@ int qos_add_tgt(struct lod_device*, struct lod_tgt_desc *);
2551 +@@ -432,7 +432,6 @@ int qos_add_tgt(struct lod_device*, struct lod_tgt_desc *);
2552 int qos_del_tgt(struct lod_device *, struct lod_tgt_desc *);
2553
2554 /* lproc_lod.c */
2555 @@ -133,10 +119,10 @@ index 98b2416..1849e5d 100644
2556 &pool_proc_operations);
2557 if (IS_ERR(new_pool->pool_proc_entry)) {
2558 diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c
2559 -index e976063..e420a5e 100644
2560 +index e976063..1598658 100644
2561 --- a/lustre/lod/lproc_lod.c
2562 +++ b/lustre/lod/lproc_lod.c
2563 -@@ -42,23 +42,22 @@
2564 +@@ -42,23 +42,23 @@
2565 #include <lustre_param.h>
2566
2567 #ifdef LPROCFS
2568 @@ -163,11 +149,12 @@ index e976063..e420a5e 100644
2569 + size_t count, loff_t *off)
2570 {
2571 - struct obd_device *dev = (struct obd_device *)data;
2572 -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
2573 ++ struct seq_file *m = file->private_data;
2574 ++ struct obd_device *dev = m->private;
2575 struct lod_device *lod;
2576 __u64 val;
2577 int rc;
2578 -@@ -73,24 +72,24 @@ static int lod_wr_stripesize(struct file *file, const char *buffer,
2579 +@@ -73,24 +73,25 @@ static int lod_wr_stripesize(struct file *file, const char *buffer,
2580 lod->lod_desc.ld_default_stripe_size = val;
2581 return count;
2582 }
2583 @@ -196,11 +183,12 @@ index e976063..e420a5e 100644
2584 + size_t count, loff_t *off)
2585 {
2586 - struct obd_device *dev = (struct obd_device *)data;
2587 -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
2588 ++ struct seq_file *m = file->private_data;
2589 ++ struct obd_device *dev = m->private;
2590 struct lod_device *lod;
2591 __u64 val;
2592 int rc;
2593 -@@ -104,23 +103,23 @@ static int lod_wr_stripeoffset(struct file *file, const char *buffer,
2594 +@@ -104,23 +105,24 @@ static int lod_wr_stripeoffset(struct file *file, const char *buffer,
2595 lod->lod_desc.ld_default_stripe_offset = val;
2596 return count;
2597 }
2598 @@ -228,11 +216,12 @@ index e976063..e420a5e 100644
2599 + size_t count, loff_t *off)
2600 {
2601 - struct obd_device *dev = (struct obd_device *)data;
2602 -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
2603 ++ struct seq_file *m = file->private_data;
2604 ++ struct obd_device *dev = m->private;
2605 struct lod_device *lod;
2606 int val, rc;
2607
2608 -@@ -134,24 +133,24 @@ static int lod_wr_stripetype(struct file *file, const char *buffer,
2609 +@@ -134,24 +136,25 @@ static int lod_wr_stripetype(struct file *file, const char *buffer,
2610 lod->lod_desc.ld_pattern = val;
2611 return count;
2612 }
2613 @@ -261,11 +250,12 @@ index e976063..e420a5e 100644
2614 + size_t count, loff_t *off)
2615 {
2616 - struct obd_device *dev = (struct obd_device *)data;
2617 -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
2618 ++ struct seq_file *m = file->private_data;
2619 ++ struct obd_device *dev = m->private;
2620 struct lod_device *lod;
2621 int val, rc;
2622
2623 -@@ -165,62 +164,57 @@ static int lod_wr_stripecount(struct file *file, const char *buffer,
2624 +@@ -165,62 +168,58 @@ static int lod_wr_stripecount(struct file *file, const char *buffer,
2625 lod->lod_desc.ld_default_stripe_count = val;
2626 return count;
2627 }
2628 @@ -293,7 +283,7 @@ index e976063..e420a5e 100644
2629 +static int lod_activeobd_seq_show(struct seq_file *m, void *v)
2630 {
2631 - struct obd_device* dev = (struct obd_device*)data;
2632 -+ struct obd_device* dev = m->private;
2633 ++ struct obd_device *dev = m->private;
2634 struct lod_device *lod;
2635
2636 LASSERT(dev != NULL);
2637 @@ -344,11 +334,12 @@ index e976063..e420a5e 100644
2638 + size_t count, loff_t *off)
2639 {
2640 - struct obd_device *dev = (struct obd_device *)data;
2641 -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
2642 ++ struct seq_file *m = file->private_data;
2643 ++ struct obd_device *dev = m->private;
2644 struct lod_device *lod;
2645 int val, rc;
2646
2647 -@@ -238,24 +232,24 @@ static int lod_wr_qos_priofree(struct file *file, const char *buffer,
2648 +@@ -238,24 +237,25 @@ static int lod_wr_qos_priofree(struct file *file, const char *buffer,
2649 lod->lod_qos.lq_reset = 1;
2650 return count;
2651 }
2652 @@ -377,11 +368,12 @@ index e976063..e420a5e 100644
2653 + size_t count, loff_t *off)
2654 {
2655 - struct obd_device *dev = (struct obd_device *)data;
2656 -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
2657 ++ struct seq_file *m = file->private_data;
2658 ++ struct obd_device *dev = m->private;
2659 struct lod_device *lod;
2660 int val, rc;
2661
2662 -@@ -273,23 +267,23 @@ static int lod_wr_qos_thresholdrr(struct file *file, const char *buffer,
2663 +@@ -273,23 +273,24 @@ static int lod_wr_qos_thresholdrr(struct file *file, const char *buffer,
2664 lod->lod_qos.lq_dirty = 1;
2665 return count;
2666 }
2667 @@ -409,11 +401,12 @@ index e976063..e420a5e 100644
2668 + size_t count, loff_t *off)
2669 {
2670 - struct obd_device *dev = (struct obd_device *)data;
2671 -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
2672 ++ struct seq_file *m = file->private_data;
2673 ++ struct obd_device *dev = m->private;
2674 struct lustre_cfg_bufs bufs;
2675 struct lod_device *lod;
2676 struct lu_device *next;
2677 -@@ -327,6 +321,7 @@ static int lod_wr_qos_maxage(struct file *file, const char *buffer,
2678 +@@ -327,6 +328,7 @@ static int lod_wr_qos_maxage(struct file *file, const char *buffer,
2679
2680 return count;
2681 }
2682 @@ -421,7 +414,7 @@ index e976063..e420a5e 100644
2683
2684 static void *lod_osts_seq_start(struct seq_file *p, loff_t *pos)
2685 {
2686 -@@ -414,56 +409,63 @@ static const struct seq_operations lod_osts_sops = {
2687 +@@ -414,56 +416,63 @@ static const struct seq_operations lod_osts_sops = {
2688
2689 static int lod_osts_seq_open(struct inode *inode, struct file *file)
2690 {
2691 @@ -452,6 +445,16 @@ index e976063..e420a5e 100644
2692 - { "qos_prio_free",lod_rd_qos_priofree, lod_wr_qos_priofree, 0 },
2693 - { "qos_threshold_rr", lod_rd_qos_thresholdrr, lod_wr_qos_thresholdrr, 0 },
2694 - { "qos_maxage", lod_rd_qos_maxage, lod_wr_qos_maxage, 0 },
2695 +- { 0 }
2696 +-};
2697 +-
2698 +-static struct lprocfs_vars lprocfs_lod_osd_vars[] = {
2699 +- { "blocksize", lprocfs_dt_rd_blksize, 0, 0 },
2700 +- { "kbytestotal", lprocfs_dt_rd_kbytestotal, 0, 0 },
2701 +- { "kbytesfree", lprocfs_dt_rd_kbytesfree, 0, 0 },
2702 +- { "kbytesavail", lprocfs_dt_rd_kbytesavail, 0, 0 },
2703 +- { "filestotal", lprocfs_dt_rd_filestotal, 0, 0 },
2704 +- { "filesfree", lprocfs_dt_rd_filesfree, 0, 0 },
2705 +LPROC_SEQ_FOPS_RO_TYPE(lod, uuid);
2706 +
2707 +LPROC_SEQ_FOPS_RO_TYPE(lod, dt_blksize);
2708 @@ -487,13 +490,8 @@ index e976063..e420a5e 100644
2709 { 0 }
2710 };
2711
2712 --static struct lprocfs_vars lprocfs_lod_osd_vars[] = {
2713 -- { "blocksize", lprocfs_dt_rd_blksize, 0, 0 },
2714 -- { "kbytestotal", lprocfs_dt_rd_kbytestotal, 0, 0 },
2715 -- { "kbytesfree", lprocfs_dt_rd_kbytesfree, 0, 0 },
2716 -- { "kbytesavail", lprocfs_dt_rd_kbytesavail, 0, 0 },
2717 -- { "filestotal", lprocfs_dt_rd_filestotal, 0, 0 },
2718 -- { "filesfree", lprocfs_dt_rd_filesfree, 0, 0 },
2719 +-static struct lprocfs_vars lprocfs_lod_module_vars[] = {
2720 +- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
2721 +static struct lprocfs_seq_vars lprocfs_lod_osd_vars[] = {
2722 + { "blocksize", &lod_dt_blksize_fops },
2723 + { "kbytestotal", &lod_dt_kbytestotal_fops },
2724 @@ -504,11 +502,6 @@ index e976063..e420a5e 100644
2725 { 0 }
2726 };
2727
2728 --static struct lprocfs_vars lprocfs_lod_module_vars[] = {
2729 -- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
2730 -- { 0 }
2731 --};
2732 --
2733 -void lprocfs_lod_init_vars(struct lprocfs_static_vars *lvars)
2734 -{
2735 - lvars->module_vars = lprocfs_lod_module_vars;
2736 @@ -518,13 +511,18 @@ index e976063..e420a5e 100644
2737 static const struct file_operations lod_proc_target_fops = {
2738 .owner = THIS_MODULE,
2739 .open = lod_osts_seq_open,
2740 -@@ -475,20 +477,18 @@ static const struct file_operations lod_proc_target_fops = {
2741 +@@ -474,21 +483,21 @@ static const struct file_operations lod_proc_target_fops = {
2742 +
2743 int lod_procfs_init(struct lod_device *lod)
2744 {
2745 - struct obd_device *obd = lod2obd(lod);
2746 +- struct obd_device *obd = lod2obd(lod);
2747 - struct lprocfs_static_vars lvars;
2748 - cfs_proc_dir_entry_t *lov_proc_dir;
2749 - int rc;
2750 +- int rc;
2751 ++ struct obd_device *obd = lod2obd(lod);
2752 ++ struct proc_dir_entry *lov_proc_dir = NULL;
2753 ++ struct obd_type *type;
2754 ++ int rc;
2755
2756 - lprocfs_lod_init_vars(&lvars);
2757 - rc = lprocfs_obd_setup(obd, lvars.obd_vars);
2758 @@ -543,7 +541,7 @@ index e976063..e420a5e 100644
2759 if (rc) {
2760 CERROR("%s: cannot setup procfs entry: %d\n",
2761 obd->obd_name, rc);
2762 -@@ -503,9 +503,9 @@ int lod_procfs_init(struct lod_device *lod)
2763 +@@ -503,9 +512,9 @@ int lod_procfs_init(struct lod_device *lod)
2764 GOTO(out, rc);
2765 }
2766
2767 @@ -556,42 +554,38 @@ index e976063..e420a5e 100644
2768 if (IS_ERR(lod->lod_pool_proc_entry)) {
2769 rc = PTR_ERR(lod->lod_pool_proc_entry);
2770 lod->lod_pool_proc_entry = NULL;
2771 -@@ -514,14 +514,18 @@ int lod_procfs_init(struct lod_device *lod)
2772 +@@ -514,14 +523,24 @@ int lod_procfs_init(struct lod_device *lod)
2773 GOTO(out, rc);
2774 }
2775
2776 - /* for compatibility we link old procfs's OSC entries to osp ones */
2777 - lov_proc_dir = lprocfs_srch(proc_lustre_root, "lov");
2778 - if (lov_proc_dir != NULL && strstr(obd->obd_name, "lov") != NULL)
2779 -+ /* for compatibility we link old procfs's LOV entries to lod ones */
2780 -+ if (obd->obd_type->typ_procsym != NULL) {
2781 - lod->lod_symlink = lprocfs_add_symlink(obd->obd_name,
2782 +- lod->lod_symlink = lprocfs_add_symlink(obd->obd_name,
2783 - lov_proc_dir,
2784 - "../lod/%s",
2785 - obd->obd_name);
2786 --
2787 -+ obd->obd_type->typ_procsym,
2788 -+ "../lod/%s",
2789 -+ obd->obd_name);
2790 -+ if (lod->lod_symlink == NULL) {
2791 -+ CERROR("could not register LOV symlink for "
2792 -+ "/proc/fs/lustre/lod/%s.", obd->obd_name);
2793 -+ lprocfs_remove(&obd->obd_type->typ_procsym);
2794 -+ }
2795 -+ }
2796 ++ /* If the real LOV is present which is the case for setups
2797 ++ * with both server and clients on the same node then use
2798 ++ * the LOV's proc root */
2799 ++ type = class_search_type(LUSTRE_LOV_NAME);
2800 ++ if (type != NULL && type->typ_procroot != NULL)
2801 ++ lov_proc_dir = type->typ_procroot;
2802 ++ else
2803 ++ lov_proc_dir = obd->obd_type->typ_procsym;
2804 ++
2805 ++ if (lov_proc_dir == NULL)
2806 ++ RETURN(0);
2807 +
2808 ++ /* for compatibility we link old procfs's LOV entries to lod ones */
2809 ++ lod->lod_symlink = lprocfs_add_symlink(obd->obd_name, lov_proc_dir,
2810 ++ "../lod/%s", obd->obd_name);
2811 ++ if (lod->lod_symlink == NULL)
2812 ++ CERROR("could not register LOV symlink for "
2813 ++ "/proc/fs/lustre/lod/%s.", obd->obd_name);
2814 RETURN(0);
2815
2816 out:
2817 -@@ -542,6 +546,9 @@ void lod_procfs_fini(struct lod_device *lod)
2818 - lod->lod_pool_proc_entry = NULL;
2819 - }
2820 -
2821 -+ if (obd->obd_type->typ_procsym != NULL)
2822 -+ lprocfs_remove(&obd->obd_type->typ_procsym);
2823 -+
2824 - lprocfs_obd_cleanup(obd);
2825 - }
2826 -
2827 --
2828 -1.8.5.3
2829 +1.9.1
2830
2831
2832 diff --git a/sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch b/sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
2833 similarity index 89%
2834 rename from sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
2835 rename to sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
2836 index c271eb7..5c1c9cd 100644
2837 --- a/sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
2838 +++ b/sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
2839 @@ -1,7 +1,7 @@
2840 -From 9ab620dbc6aae86b9d39d97ba50912dc93b6e4e2 Mon Sep 17 00:00:00 2001
2841 +From 039e3e44e07b59923d94bea976173d9e3cbd0ba9 Mon Sep 17 00:00:00 2001
2842 From: James Simmons <uja.ornl@×××××.com>
2843 -Date: Sun, 9 Feb 2014 11:04:31 -0500
2844 -Subject: [PATCH 08/12] LU-3319 procfs: move mdt/mds proc handling to seq_files
2845 +Date: Tue, 25 Mar 2014 11:10:33 -0400
2846 +Subject: [PATCH 7/9] LU-3319 procfs: move mdt/mds proc handling to seq_files
2847
2848 With 3.10 linux kernel and above proc handling now only
2849 uses struct seq_files. This patch migrates the mdt/mds
2850 @@ -10,21 +10,21 @@ layer proc entries over to using seq_files.
2851 Signed-off-by: James Simmons <uja.ornl@×××××.com>
2852 Change-Id: Icbafdcd2c2fe3959a51dda3f9c715b0ff8d95742
2853 ---
2854 - lustre/mdt/mdt_coordinator.c | 259 +++++++--------
2855 + lustre/mdt/mdt_coordinator.c | 269 +++++++---------
2856 lustre/mdt/mdt_handler.c | 16 +-
2857 lustre/mdt/mdt_hsm_cdt_actions.c | 5 +-
2858 lustre/mdt/mdt_hsm_cdt_agent.c | 5 +-
2859 lustre/mdt/mdt_hsm_cdt_requests.c | 5 +-
2860 lustre/mdt/mdt_internal.h | 14 +-
2861 - lustre/mdt/mdt_lproc.c | 639 ++++++++++++++++++--------------------
2862 + lustre/mdt/mdt_lproc.c | 659 +++++++++++++++++++-------------------
2863 lustre/mdt/mdt_mds.c | 12 +-
2864 - 8 files changed, 442 insertions(+), 513 deletions(-)
2865 + 8 files changed, 469 insertions(+), 516 deletions(-)
2866
2867 diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c
2868 -index 037bcbd..9bbcbd4 100644
2869 +index a9ee560..062f6cc 100644
2870 --- a/lustre/mdt/mdt_coordinator.c
2871 +++ b/lustre/mdt/mdt_coordinator.c
2872 -@@ -46,7 +46,7 @@
2873 +@@ -45,7 +45,7 @@
2874 #include <lustre_log.h>
2875 #include "mdt_internal.h"
2876
2877 @@ -33,7 +33,7 @@ index 037bcbd..9bbcbd4 100644
2878
2879 /**
2880 * get obj and HSM attributes on a fid
2881 -@@ -393,7 +393,7 @@ int hsm_cdt_procfs_init(struct mdt_device *mdt)
2882 +@@ -392,7 +392,7 @@ int hsm_cdt_procfs_init(struct mdt_device *mdt)
2883 ENTRY;
2884
2885 /* init /proc entries, failure is not critical */
2886 @@ -42,7 +42,7 @@ index 037bcbd..9bbcbd4 100644
2887 mdt2obd_dev(mdt)->obd_proc_entry,
2888 lprocfs_mdt_hsm_vars, mdt);
2889 if (IS_ERR(cdt->cdt_proc_dir)) {
2890 -@@ -425,7 +425,7 @@ void hsm_cdt_procfs_fini(struct mdt_device *mdt)
2891 +@@ -424,7 +424,7 @@ void hsm_cdt_procfs_fini(struct mdt_device *mdt)
2892 * \param none
2893 * \retval var vector
2894 */
2895 @@ -51,7 +51,7 @@ index 037bcbd..9bbcbd4 100644
2896 {
2897 return lprocfs_mdt_hsm_vars;
2898 }
2899 -@@ -1786,22 +1786,17 @@ static __u64 hsm_policy_str2bit(const char *name)
2900 +@@ -1785,22 +1785,17 @@ static __u64 hsm_policy_str2bit(const char *name)
2901 * \param hexa [IN] print mask before bit names
2902 * \param buffer [OUT] string
2903 * \param count [IN] size of buffer
2904 @@ -80,7 +80,7 @@ index 037bcbd..9bbcbd4 100644
2905 for (i = 0; i < CDT_POLICY_SHIFT_COUNT; i++) {
2906 bit = (1ULL << i);
2907
2908 -@@ -1810,48 +1805,34 @@ static int hsm_policy_bit2str(const __u64 mask, const bool hexa, char *buffer,
2909 +@@ -1809,48 +1804,37 @@ static int hsm_policy_bit2str(const __u64 mask, const bool hexa, char *buffer,
2910 break;
2911 }
2912 if (bit & mask)
2913 @@ -95,10 +95,12 @@ index 037bcbd..9bbcbd4 100644
2914 - count -= sz;
2915 + seq_printf(m, "%s ", hsm_policy_names[j].name);
2916 }
2917 -- /* remove last ' ' */
2918 + /* remove last ' ' */
2919 - *ptr = '\0';
2920 - ptr--;
2921 - RETURN(ptr - buffer);
2922 ++ m->count--;
2923 ++ seq_putc(m, '\0');
2924 }
2925
2926 /* methods to read/write HSM policy flags */
2927 @@ -140,7 +142,7 @@ index 037bcbd..9bbcbd4 100644
2928 int rc;
2929 ENTRY;
2930
2931 -@@ -1884,18 +1865,10 @@ static int lprocfs_wr_hsm_policy(struct file *file, const char *buffer,
2932 +@@ -1883,18 +1867,10 @@ static int lprocfs_wr_hsm_policy(struct file *file, const char *buffer,
2933
2934 policy = hsm_policy_str2bit(token);
2935 if (policy == 0) {
2936 @@ -156,13 +158,13 @@ index 037bcbd..9bbcbd4 100644
2937 - "supported policies are: %s\n", mdt_obd_name(mdt),
2938 - token, msg);
2939 - OBD_FREE(msg, sz);
2940 -+ "supported policies are: \n", mdt_obd_name(mdt),
2941 -+ token);
2942 ++ "supported policies are:\n", mdt_obd_name(mdt),
2943 ++ token);
2944 + hsm_policy_bit2str(m, 0, false);
2945 GOTO(out, rc = -EINVAL);
2946 }
2947 switch (sign) {
2948 -@@ -1934,25 +1907,24 @@ out:
2949 +@@ -1933,25 +1909,25 @@ out:
2950 OBD_FREE(buf, count + 1);
2951 RETURN(rc);
2952 }
2953 @@ -193,11 +195,12 @@ index 037bcbd..9bbcbd4 100644
2954 \
2955 { \
2956 - struct mdt_device *mdt = data; \
2957 -+ struct mdt_device *mdt = ((struct seq_file *)file->private_data)->private;\
2958 ++ struct seq_file *m = file->private_data; \
2959 ++ struct mdt_device *mdt = m->private; \
2960 struct coordinator *cdt = &mdt->mdt_coordinator; \
2961 int val; \
2962 int rc; \
2963 -@@ -1966,7 +1938,7 @@ static int lprocfs_wr_hsm_##VAR(struct file *file, const char *buffer, \
2964 +@@ -1965,7 +1941,7 @@ static int lprocfs_wr_hsm_##VAR(struct file *file, const char *buffer, \
2965 RETURN(count); \
2966 } \
2967 RETURN(-EINVAL); \
2968 @@ -206,7 +209,7 @@ index 037bcbd..9bbcbd4 100644
2969
2970 GENERATE_PROC_METHOD(cdt_loop_period)
2971 GENERATE_PROC_METHOD(cdt_grace_delay)
2972 -@@ -1984,10 +1956,11 @@ GENERATE_PROC_METHOD(cdt_default_archive_id)
2973 +@@ -1983,10 +1959,12 @@ GENERATE_PROC_METHOD(cdt_default_archive_id)
2974 #define CDT_PURGE_CMD "purge"
2975 #define CDT_HELP_CMD "help"
2976
2977 @@ -217,11 +220,12 @@ index 037bcbd..9bbcbd4 100644
2978 + size_t count, loff_t *off)
2979 {
2980 - struct obd_device *obd = data;
2981 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
2982 ++ struct seq_file *m = file->private_data;
2983 ++ struct obd_device *obd = m->private;
2984 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
2985 struct coordinator *cdt = &(mdt->mdt_coordinator);
2986 int rc, usage = 0;
2987 -@@ -2041,83 +2014,71 @@ int lprocfs_wr_hsm_cdt_control(struct file *file, const char *buffer,
2988 +@@ -2040,83 +2018,71 @@ int lprocfs_wr_hsm_cdt_control(struct file *file, const char *buffer,
2989 RETURN(count);
2990 }
2991
2992 @@ -327,7 +331,7 @@ index 037bcbd..9bbcbd4 100644
2993 }
2994
2995 static inline enum hsm_copytool_action
2996 -@@ -2137,9 +2098,9 @@ hsm_copytool_name2action(const char *name)
2997 +@@ -2136,9 +2102,9 @@ hsm_copytool_name2action(const char *name)
2998 return -1;
2999 }
3000
3001 @@ -340,7 +344,7 @@ index 037bcbd..9bbcbd4 100644
3002 {
3003 char *buf, *pos, *name;
3004 size_t buf_size;
3005 -@@ -2183,69 +2144,73 @@ out:
3006 +@@ -2182,69 +2148,76 @@ out:
3007 RETURN(rc);
3008 }
3009
3010 @@ -352,7 +356,8 @@ index 037bcbd..9bbcbd4 100644
3011 + size_t count, loff_t *off)
3012 {
3013 - struct mdt_device *mdt = data;
3014 -+ struct mdt_device *mdt = ((struct seq_file *)file->private_data)->private;
3015 ++ struct seq_file *m = file->private_data;
3016 ++ struct mdt_device *mdt = m->private;
3017 struct coordinator *cdt = &mdt->mdt_coordinator;
3018
3019 - return lprocfs_wr_hsm_request_mask(file, buf, count,
3020 @@ -368,8 +373,10 @@ index 037bcbd..9bbcbd4 100644
3021 + size_t count, loff_t *off)
3022 {
3023 - struct mdt_device *mdt = data;
3024 -+ struct mdt_device *mdt = ((struct seq_file *)file->private_data)->private;
3025 - struct coordinator *cdt = &mdt->mdt_coordinator;
3026 +- struct coordinator *cdt = &mdt->mdt_coordinator;
3027 ++ struct seq_file *m = file->private_data;
3028 ++ struct mdt_device *mdt = m->private;
3029 ++ struct coordinator *cdt = &mdt->mdt_coordinator;
3030
3031 - return lprocfs_wr_hsm_request_mask(file, buf, count,
3032 + return mdt_write_hsm_request_mask(file, buf, count,
3033 @@ -384,8 +391,10 @@ index 037bcbd..9bbcbd4 100644
3034 + size_t count, loff_t *off)
3035 {
3036 - struct mdt_device *mdt = data;
3037 -+ struct mdt_device *mdt = ((struct seq_file *)file->private_data)->private;
3038 - struct coordinator *cdt = &mdt->mdt_coordinator;
3039 +- struct coordinator *cdt = &mdt->mdt_coordinator;
3040 ++ struct seq_file *m = file->private_data;
3041 ++ struct mdt_device *mdt = m->private;
3042 ++ struct coordinator *cdt = &mdt->mdt_coordinator;
3043
3044 - return lprocfs_wr_hsm_request_mask(file, buf, count,
3045 + return mdt_write_hsm_request_mask(file, buf, count,
3046 @@ -461,10 +470,10 @@ index 037bcbd..9bbcbd4 100644
3047 { 0 }
3048 };
3049 diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c
3050 -index 17b7605..2b08be9 100644
3051 +index 69b1c30..8b4634f 100644
3052 --- a/lustre/mdt/mdt_handler.c
3053 +++ b/lustre/mdt/mdt_handler.c
3054 -@@ -4584,7 +4584,6 @@ static int mdt_process_config(const struct lu_env *env,
3055 +@@ -4644,7 +4644,6 @@ static int mdt_process_config(const struct lu_env *env,
3056
3057 switch (cfg->lcfg_command) {
3058 case LCFG_PARAM: {
3059 @@ -472,7 +481,7 @@ index 17b7605..2b08be9 100644
3060 struct obd_device *obd = d->ld_obd;
3061
3062 /* For interoperability */
3063 -@@ -4619,14 +4618,13 @@ static int mdt_process_config(const struct lu_env *env,
3064 +@@ -4679,14 +4678,13 @@ static int mdt_process_config(const struct lu_env *env,
3065 }
3066 }
3067
3068 @@ -492,7 +501,7 @@ index 17b7605..2b08be9 100644
3069 if (rc > 0 || rc == -ENOSYS)
3070 /* we don't understand; pass it on */
3071 rc = next->ld_ops->ldo_process_config(env, next,
3072 -@@ -5825,7 +5823,6 @@ static struct lu_device_type mdt_device_type = {
3073 +@@ -5885,7 +5883,6 @@ static struct lu_device_type mdt_device_type = {
3074
3075 static int __init mdt_mod_init(void)
3076 {
3077 @@ -500,17 +509,17 @@ index 17b7605..2b08be9 100644
3078 int rc;
3079
3080 CLASSERT(sizeof("0x0123456789ABCDEF:0x01234567:0x01234567") ==
3081 -@@ -5840,10 +5837,9 @@ static int __init mdt_mod_init(void)
3082 +@@ -5900,10 +5897,9 @@ static int __init mdt_mod_init(void)
3083 if (rc)
3084 GOTO(lu_fini, rc);
3085
3086 - lprocfs_mdt_init_vars(&lvars);
3087 - rc = class_register_type(&mdt_obd_device_ops, NULL, NULL,
3088 + rc = class_register_type(&mdt_obd_device_ops, NULL, true, NULL,
3089 #ifndef HAVE_ONLY_PROCFS_SEQ
3090 -- lvars.module_vars,
3091 -+ NULL,
3092 +- lvars.module_vars,
3093 ++ NULL,
3094 #endif
3095 - LUSTRE_MDT_NAME, &mdt_device_type);
3096 + LUSTRE_MDT_NAME, &mdt_device_type);
3097 if (rc)
3098 diff --git a/lustre/mdt/mdt_hsm_cdt_actions.c b/lustre/mdt/mdt_hsm_cdt_actions.c
3099 index da7f5a9..49c6b8b 100644
3100 @@ -578,10 +587,10 @@ index 1300861..3125dcc 100644
3101 RETURN(rc);
3102 }
3103 diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h
3104 -index c3d4f7f..7b0381a 100644
3105 +index 7970b86..8fb96c8 100644
3106 --- a/lustre/mdt/mdt_internal.h
3107 +++ b/lustre/mdt/mdt_internal.h
3108 -@@ -787,9 +787,6 @@ void mdt_thread_info_init(struct ptlrpc_request *req,
3109 +@@ -785,9 +785,6 @@ void mdt_thread_info_init(struct ptlrpc_request *req,
3110 void mdt_thread_info_fini(struct mdt_thread_info *mti);
3111 struct mdt_thread_info *tsi2mdt_info(struct tgt_session_info *tsi);
3112
3113 @@ -591,7 +600,7 @@ index c3d4f7f..7b0381a 100644
3114 int mdt_hsm_attr_set(struct mdt_thread_info *info, struct mdt_object *obj,
3115 const struct md_hsm *mh);
3116
3117 -@@ -924,13 +921,12 @@ int mdt_hsm_cdt_fini(struct mdt_device *mdt);
3118 +@@ -925,13 +922,12 @@ int mdt_hsm_cdt_fini(struct mdt_device *mdt);
3119 int mdt_hsm_cdt_wakeup(struct mdt_device *mdt);
3120
3121 /* coordinator control /proc interface */
3122 @@ -609,7 +618,7 @@ index c3d4f7f..7b0381a 100644
3123 /* md_hsm helpers */
3124 struct mdt_object *mdt_hsm_get_md_hsm(struct mdt_thread_info *mti,
3125 const struct lu_fid *fid,
3126 -@@ -1070,8 +1066,6 @@ enum {
3127 +@@ -1071,8 +1067,6 @@ enum {
3128 };
3129 void mdt_counter_incr(struct ptlrpc_request *req, int opcode);
3130 void mdt_stats_counter_init(struct lprocfs_stats *stats);
3131 @@ -619,7 +628,7 @@ index c3d4f7f..7b0381a 100644
3132 void mdt_procfs_fini(struct mdt_device *mdt);
3133
3134 diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c
3135 -index 0ee5148..658f00d 100644
3136 +index 0ee5148..a895d57 100644
3137 --- a/lustre/mdt/mdt_lproc.c
3138 +++ b/lustre/mdt/mdt_lproc.c
3139 @@ -156,7 +156,6 @@ static ssize_t mdt_rename_stats_seq_write(struct file *file, const char *buf,
3140 @@ -630,13 +639,12 @@ index 0ee5148..658f00d 100644
3141 LPROC_SEQ_FOPS(mdt_rename_stats);
3142
3143 static int lproc_mdt_attach_rename_seqstat(struct mdt_device *mdt)
3144 -@@ -213,143 +212,73 @@ void mdt_rename_counter_tally(struct mdt_thread_info *info,
3145 +@@ -213,143 +212,76 @@ void mdt_rename_counter_tally(struct mdt_thread_info *info,
3146 (unsigned int)ma->ma_attr.la_size);
3147 }
3148
3149 -int mdt_procfs_init(struct mdt_device *mdt, const char *name)
3150 -+static int mdt_identity_expire_seq_show(struct seq_file *m, void *data)
3151 - {
3152 +-{
3153 - struct obd_device *obd = mdt2obd_dev(mdt);
3154 - struct lprocfs_static_vars lvars;
3155 - int rc;
3156 @@ -682,7 +690,8 @@ index 0ee5148..658f00d 100644
3157 -}
3158 -
3159 -void mdt_procfs_fini(struct mdt_device *mdt)
3160 --{
3161 ++static int mdt_identity_expire_seq_show(struct seq_file *m, void *data)
3162 + {
3163 - struct obd_device *obd = mdt2obd_dev(mdt);
3164 -
3165 - if (obd->obd_proc_exports_entry != NULL) {
3166 @@ -721,7 +730,8 @@ index 0ee5148..658f00d 100644
3167 - struct obd_device *obd = data;
3168 - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3169 - int rc, val;
3170 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3171 ++ struct seq_file *m = file->private_data;
3172 ++ struct obd_device *obd = m->private;
3173 + struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3174 + int rc, val;
3175
3176 @@ -752,7 +762,7 @@ index 0ee5148..658f00d 100644
3177 - *eof = 1;
3178 - return snprintf(page, count, "%u\n",
3179 - mdt->mdt_identity_cache->uc_acquire_expire);
3180 -+ return seq_printf(m,"%u\n", mdt->mdt_identity_cache->uc_acquire_expire);
3181 ++ return seq_printf(m, "%u\n", mdt->mdt_identity_cache->uc_acquire_expire);
3182 }
3183
3184 -static int lprocfs_wr_identity_acquire_expire(struct file *file,
3185 @@ -766,7 +776,8 @@ index 0ee5148..658f00d 100644
3186 - struct obd_device *obd = data;
3187 - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3188 - int rc, val;
3189 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3190 ++ struct seq_file *m = file->private_data;
3191 ++ struct obd_device *obd = m->private;
3192 + struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3193 + int rc, val;
3194
3195 @@ -812,11 +823,12 @@ index 0ee5148..658f00d 100644
3196 + size_t count, loff_t *off)
3197 {
3198 - struct obd_device *obd = data;
3199 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3200 ++ struct seq_file *m = file->private_data;
3201 ++ struct obd_device *obd = m->private;
3202 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3203 struct upcall_cache *hash = mdt->mdt_identity_cache;
3204 int rc;
3205 -@@ -388,11 +317,13 @@ static int lprocfs_wr_identity_upcall(struct file *file, const char *buffer,
3206 +@@ -388,11 +320,14 @@ static int lprocfs_wr_identity_upcall(struct file *file, const char *buffer,
3207 OBD_FREE(kernbuf, count + 1);
3208 RETURN(rc);
3209 }
3210 @@ -829,11 +841,12 @@ index 0ee5148..658f00d 100644
3211 + size_t count, void *data)
3212 {
3213 - struct obd_device *obd = data;
3214 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3215 ++ struct seq_file *m = file->private_data;
3216 ++ struct obd_device *obd = m->private;
3217 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3218 int rc, uid;
3219
3220 -@@ -403,11 +334,13 @@ static int lprocfs_wr_identity_flush(struct file *file, const char *buffer,
3221 +@@ -403,11 +338,14 @@ static int lprocfs_wr_identity_flush(struct file *file, const char *buffer,
3222 mdt_flush_identity(mdt->mdt_identity_cache, uid);
3223 return count;
3224 }
3225 @@ -846,11 +859,12 @@ index 0ee5148..658f00d 100644
3226 + size_t count, void *data)
3227 {
3228 - struct obd_device *obd = data;
3229 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3230 ++ struct seq_file *m = file->private_data;
3231 ++ struct obd_device *obd = m->private;
3232 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3233 struct identity_downcall_data *param;
3234 int size = sizeof(*param), rc, checked = 0;
3235 -@@ -415,7 +348,7 @@ static int lprocfs_wr_identity_info(struct file *file, const char *buffer,
3236 +@@ -415,7 +353,7 @@ static int lprocfs_wr_identity_info(struct file *file, const char *buffer,
3237 again:
3238 if (count < size) {
3239 CERROR("%s: invalid data count = %lu, size = %d\n",
3240 @@ -859,7 +873,7 @@ index 0ee5148..658f00d 100644
3241 return -EINVAL;
3242 }
3243
3244 -@@ -468,23 +401,24 @@ out:
3245 +@@ -468,23 +406,25 @@ out:
3246
3247 return rc ? rc : count;
3248 }
3249 @@ -887,11 +901,12 @@ index 0ee5148..658f00d 100644
3250 + size_t count, loff_t *off)
3251 {
3252 - struct obd_device *obd = data;
3253 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3254 ++ struct seq_file *m = file->private_data;
3255 ++ struct obd_device *obd = m->private;
3256 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3257 int val, rc;
3258
3259 -@@ -521,64 +455,65 @@ static int lprocfs_wr_capa(struct file *file, const char *buffer,
3260 +@@ -521,64 +461,67 @@ static int lprocfs_wr_capa(struct file *file, const char *buffer,
3261 mdt->mdt_lut.lut_oss_capa ? "enabled" : "disabled");
3262 return count;
3263 }
3264 @@ -945,7 +960,8 @@ index 0ee5148..658f00d 100644
3265 - struct obd_device *obd = data;
3266 - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3267 - int val, rc;
3268 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3269 ++ struct seq_file *m = file->private_data;
3270 ++ struct obd_device *obd = m->private;
3271 + struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3272 + int val, rc;
3273
3274 @@ -987,13 +1003,14 @@ index 0ee5148..658f00d 100644
3275 - struct obd_device *obd = data;
3276 - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3277 - int val, rc;
3278 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3279 -+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3280 ++ struct seq_file *m = file->private_data;
3281 ++ struct obd_device *obd = m->private;
3282 ++ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3283 + int val, rc;
3284
3285 rc = lprocfs_write_helper(buffer, count, &val);
3286 if (rc)
3287 -@@ -588,11 +523,13 @@ static int lprocfs_wr_ck_timeout(struct file *file, const char *buffer,
3288 +@@ -588,11 +531,13 @@ static int lprocfs_wr_ck_timeout(struct file *file, const char *buffer,
3289 mdt->mdt_capa_conf = 1;
3290 return count;
3291 }
3292 @@ -1009,16 +1026,17 @@ index 0ee5148..658f00d 100644
3293 {
3294 char *kbuf;
3295 char *tmpbuf;
3296 -@@ -614,7 +551,7 @@ static int lprocfs_mdt_wr_evict_client(struct file *file, const char *buffer,
3297 +@@ -614,7 +559,8 @@ static int lprocfs_mdt_wr_evict_client(struct file *file, const char *buffer,
3298 tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count));
3299
3300 if (strncmp(tmpbuf, "nid:", 4) != 0) {
3301 - count = lprocfs_wr_evict_client(file, buffer, count, data);
3302 -+ count = lprocfs_evict_client_seq_write(file, buffer, count, off);
3303 ++ count = lprocfs_evict_client_seq_write(file, buffer, count,
3304 ++ off);
3305 goto out;
3306 }
3307
3308 -@@ -627,21 +564,21 @@ out:
3309 +@@ -627,21 +573,22 @@ out:
3310
3311 #undef BUFLEN
3312
3313 @@ -1044,13 +1062,14 @@ index 0ee5148..658f00d 100644
3314 - struct obd_device *obd = data;
3315 - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3316 - int val, rc;
3317 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3318 -+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3319 ++ struct seq_file *m = file->private_data;
3320 ++ struct obd_device *obd = m->private;
3321 ++ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3322 + int val, rc;
3323
3324 rc = lprocfs_write_helper(buffer, count, &val);
3325 if (rc)
3326 -@@ -659,22 +596,23 @@ static int lprocfs_wr_sec_level(struct file *file, const char *buffer,
3327 +@@ -659,22 +606,24 @@ static int lprocfs_wr_sec_level(struct file *file, const char *buffer,
3328 mdt->mdt_lut.lut_sec_level = val;
3329 return count;
3330 }
3331 @@ -1078,13 +1097,14 @@ index 0ee5148..658f00d 100644
3332 - struct obd_device *obd = data;
3333 - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3334 - int val, rc;
3335 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3336 -+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3337 ++ struct seq_file *m = file->private_data;
3338 ++ struct obd_device *obd = m->private;
3339 ++ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3340 + int val, rc;
3341
3342 rc = lprocfs_write_helper(buffer, count, &val);
3343 if (rc)
3344 -@@ -682,15 +620,15 @@ static int lprocfs_wr_cos(struct file *file, const char *buffer,
3345 +@@ -682,15 +631,15 @@ static int lprocfs_wr_cos(struct file *file, const char *buffer,
3346 mdt_enable_cos(mdt, val);
3347 return count;
3348 }
3349 @@ -1106,7 +1126,7 @@ index 0ee5148..658f00d 100644
3350 }
3351
3352 static int safe_strtoul(const char *str, char **endp, unsigned long *res)
3353 -@@ -708,10 +646,11 @@ static int safe_strtoul(const char *str, char **endp, unsigned long *res)
3354 +@@ -708,11 +657,13 @@ static int safe_strtoul(const char *str, char **endp, unsigned long *res)
3355 return 0;
3356 }
3357
3358 @@ -1117,11 +1137,14 @@ index 0ee5148..658f00d 100644
3359 + size_t count, loff_t *off)
3360 {
3361 - struct obd_device *obd = data;
3362 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3363 - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3364 +- struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3365 ++ struct seq_file *m = file->private_data;
3366 ++ struct obd_device *obd = m->private;
3367 ++ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3368 int rc;
3369 char kernbuf[50], *tmp, *end, *errmsg;
3370 -@@ -765,22 +704,23 @@ failed:
3371 + unsigned long uid, gid;
3372 +@@ -765,23 +716,25 @@ failed:
3373 mdt_obd_name(mdt), buffer, errmsg, rc);
3374 RETURN(rc);
3375 }
3376 @@ -1151,11 +1174,14 @@ index 0ee5148..658f00d 100644
3377 + size_t count, loff_t *off)
3378 {
3379 - struct obd_device *obd = data;
3380 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3381 - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3382 +- struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3383 ++ struct seq_file *m = file->private_data;
3384 ++ struct obd_device *obd = m->private;
3385 ++ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3386 int rc;
3387 char *kernbuf, *errmsg;
3388 -@@ -842,25 +782,26 @@ failed:
3389 + cfs_list_t tmp;
3390 +@@ -842,25 +795,27 @@ failed:
3391 OBD_FREE(kernbuf, count + 1);
3392 RETURN(rc);
3393 }
3394 @@ -1187,7 +1213,8 @@ index 0ee5148..658f00d 100644
3395 - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3396 - char kernbuf[16];
3397 - unsigned long val = 0;
3398 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3399 ++ struct seq_file *m = file->private_data;
3400 ++ struct obd_device *obd = m->private;
3401 + struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3402 + struct obd_export *exp;
3403 + char kernbuf[16];
3404 @@ -1195,7 +1222,7 @@ index 0ee5148..658f00d 100644
3405
3406 if (count > (sizeof(kernbuf) - 1))
3407 return -EINVAL;
3408 -@@ -902,20 +843,21 @@ static int lprocfs_wr_mdt_som(struct file *file, const char *buffer,
3409 +@@ -902,20 +857,22 @@ static int lprocfs_wr_mdt_som(struct file *file, const char *buffer,
3410
3411 return count;
3412 }
3413 @@ -1220,11 +1247,12 @@ index 0ee5148..658f00d 100644
3414 + size_t count, loff_t *off)
3415 {
3416 - struct obd_device *obd = data;
3417 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3418 ++ struct seq_file *m = file->private_data;
3419 ++ struct obd_device *obd = m->private;
3420 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3421 __u32 val;
3422 int rc;
3423 -@@ -930,22 +872,22 @@ static int lprocfs_wr_enable_remote_dir(struct file *file, const char *buffer,
3424 +@@ -930,22 +887,23 @@ static int lprocfs_wr_enable_remote_dir(struct file *file, const char *buffer,
3425 mdt->mdt_enable_remote_dir = val;
3426 return count;
3427 }
3428 @@ -1252,11 +1280,12 @@ index 0ee5148..658f00d 100644
3429 + size_t count, loff_t *off)
3430 {
3431 - struct obd_device *obd = data;
3432 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
3433 ++ struct seq_file *m = file->private_data;
3434 ++ struct obd_device *obd = m->private;
3435 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
3436 __u32 val;
3437 int rc;
3438 -@@ -957,97 +899,72 @@ static int lprocfs_wr_enable_remote_dir_gid(struct file *file,
3439 +@@ -957,97 +915,72 @@ static int lprocfs_wr_enable_remote_dir_gid(struct file *file,
3440 mdt->mdt_enable_remote_dir_gid = val;
3441 return count;
3442 }
3443 @@ -1420,7 +1449,7 @@ index 0ee5148..658f00d 100644
3444 { 0 }
3445 };
3446
3447 -@@ -1085,21 +1002,15 @@ int lprocfs_mdt_open_files_seq_show(struct seq_file *seq, void *v)
3448 +@@ -1085,21 +1018,15 @@ int lprocfs_mdt_open_files_seq_show(struct seq_file *seq, void *v)
3449
3450 int lprocfs_mdt_open_files_seq_open(struct inode *inode, struct file *file)
3451 {
3452 @@ -1443,7 +1472,7 @@ index 0ee5148..658f00d 100644
3453
3454 return 0;
3455 }
3456 -@@ -1140,3 +1051,67 @@ void mdt_stats_counter_init(struct lprocfs_stats *stats)
3457 +@@ -1140,3 +1067,67 @@ void mdt_stats_counter_init(struct lprocfs_stats *stats)
3458 lprocfs_counter_init(stats, LPROC_MDT_CROSSDIR_RENAME, 0,
3459 "crossdir_rename", "reqs");
3460 }
3461 @@ -1512,7 +1541,7 @@ index 0ee5148..658f00d 100644
3462 + lprocfs_job_stats_fini(obd);
3463 +}
3464 diff --git a/lustre/mdt/mdt_mds.c b/lustre/mdt/mdt_mds.c
3465 -index 367f659..4fa66c3 100644
3466 +index 390164f..424ddf5 100644
3467 --- a/lustre/mdt/mdt_mds.c
3468 +++ b/lustre/mdt/mdt_mds.c
3469 @@ -464,6 +464,13 @@ static struct lu_device *mds_device_free(const struct lu_env *env,
3470 @@ -1541,13 +1570,13 @@ index 367f659..4fa66c3 100644
3471 l = ERR_PTR(rc);
3472 @@ -541,7 +549,7 @@ int mds_mod_init(void)
3473
3474 - return class_register_type(&mds_obd_device_ops, NULL, NULL,
3475 + return class_register_type(&mds_obd_device_ops, NULL, true, NULL,
3476 #ifndef HAVE_ONLY_PROCFS_SEQ
3477 -- lprocfs_mds_module_vars,
3478 -+ NULL,
3479 +- lprocfs_mds_module_vars,
3480 ++ NULL,
3481 #endif
3482 - LUSTRE_MDS_NAME, &mds_device_type);
3483 + LUSTRE_MDS_NAME, &mds_device_type);
3484 }
3485 --
3486 -1.8.5.3
3487 +1.9.1
3488
3489
3490 diff --git a/sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch b/sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch
3491 similarity index 87%
3492 rename from sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch
3493 rename to sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch
3494 index b2921fc..6c6106b 100644
3495 --- a/sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch
3496 +++ b/sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch
3497 @@ -1,41 +1,36 @@
3498 -From 6af3bd54359520829a6199e81171fd849a6656f4 Mon Sep 17 00:00:00 2001
3499 -From: Alexey Shvetsov <alexxy@g.o>
3500 -Date: Thu, 27 Feb 2014 16:06:08 +0400
3501 -Subject: [PATCH 07/12] LU-3319 procfs: move mdd/ofd proc handling to seq_files
3502 +From c6c3f4063e244cea365940adc0fd1a1c35d0b525 Mon Sep 17 00:00:00 2001
3503 +From: James Simmons <uja.ornl@×××××.com>
3504 +Date: Wed, 26 Mar 2014 20:01:52 -0400
3505 +Subject: [PATCH 8/9] LU-3319 procfs: move mdd/ofd proc handling to seq_files
3506
3507 With 3.10 linux kernel and above proc handling now only
3508 uses struct seq_files. This patch migrates the mdd/ofd
3509 layer proc entries over to using seq_files.
3510
3511 -Conflicts:
3512 - lustre/mdd/mdd_lproc.c
3513 - lustre/lfsck/lfsck_layout.c
3514 -
3515 Signed-off-by: James Simmons <uja.ornl@×××××.com>
3516 -Signed-off-by: Alexey Shvetsov <alexxy@g.o>
3517 Change-Id: I61b7df6bfd5efd0f12e3ca1a1813b7b62d493168
3518 ---
3519 lustre/include/lustre_lfsck.h | 6 +-
3520 lustre/lfsck/lfsck_internal.h | 9 +-
3521 - lustre/lfsck/lfsck_layout.c | 101 ++-------
3522 - lustre/lfsck/lfsck_lib.c | 77 +++----
3523 + lustre/lfsck/lfsck_layout.c | 104 +++------
3524 + lustre/lfsck/lfsck_lib.c | 88 +++-----
3525 lustre/lfsck/lfsck_namespace.c | 75 ++-----
3526 lustre/mdd/mdd_device.c | 25 +--
3527 lustre/mdd/mdd_internal.h | 1 -
3528 - lustre/mdd/mdd_lproc.c | 300 ++++++++++++---------------
3529 + lustre/mdd/mdd_lproc.c | 302 +++++++++++--------------
3530 lustre/obdclass/lprocfs_status.c | 9 +-
3531 - lustre/ofd/lproc_ofd.c | 436 ++++++++++++++++++++-------------------
3532 - lustre/ofd/ofd_dev.c | 48 ++---
3533 + lustre/ofd/lproc_ofd.c | 467 ++++++++++++++++++++-------------------
3534 + lustre/ofd/ofd_dev.c | 80 +++----
3535 lustre/ofd/ofd_internal.h | 6 +-
3536 lustre/osd-ldiskfs/osd_handler.c | 1 +
3537 lustre/osd-zfs/osd_handler.c | 1 +
3538 - 14 files changed, 462 insertions(+), 633 deletions(-)
3539 + 14 files changed, 517 insertions(+), 657 deletions(-)
3540
3541 diff --git a/lustre/include/lustre_lfsck.h b/lustre/include/lustre_lfsck.h
3542 -index 1209bc2..bdb0955 100644
3543 +index 0d6f666..5adbffe 100644
3544 --- a/lustre/include/lustre_lfsck.h
3545 +++ b/lustre/include/lustre_lfsck.h
3546 -@@ -158,12 +158,12 @@ int lfsck_in_notify(const struct lu_env *env, struct dt_device *key,
3547 +@@ -148,12 +148,12 @@ int lfsck_in_notify(const struct lu_env *env, struct dt_device *key,
3548 int lfsck_query(const struct lu_env *env, struct dt_device *key,
3549 struct lfsck_request *lr);
3550
3551 @@ -52,10 +47,10 @@ index 1209bc2..bdb0955 100644
3552 static inline void lfsck_pack_rfa(struct lfsck_request *lr,
3553 const struct lu_fid *fid)
3554 diff --git a/lustre/lfsck/lfsck_internal.h b/lustre/lfsck/lfsck_internal.h
3555 -index 9f20729..48d3d82 100644
3556 +index 4f84c3b..c4e6430 100644
3557 --- a/lustre/lfsck/lfsck_internal.h
3558 +++ b/lustre/lfsck/lfsck_internal.h
3559 -@@ -293,8 +293,7 @@ struct lfsck_operations {
3560 +@@ -299,8 +299,7 @@ struct lfsck_operations {
3561
3562 int (*lfsck_dump)(const struct lu_env *env,
3563 struct lfsck_component *com,
3564 @@ -65,7 +60,7 @@ index 9f20729..48d3d82 100644
3565
3566 int (*lfsck_double_scan)(const struct lu_env *env,
3567 struct lfsck_component *com);
3568 -@@ -571,10 +570,10 @@ void lfsck_component_cleanup(const struct lu_env *env,
3569 +@@ -586,10 +585,10 @@ void lfsck_component_cleanup(const struct lu_env *env,
3570 struct lfsck_component *com);
3571 void lfsck_instance_cleanup(const struct lu_env *env,
3572 struct lfsck_instance *lfsck);
3573 @@ -80,10 +75,19 @@ index 9f20729..48d3d82 100644
3574 void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck,
3575 struct lfsck_position *pos, bool init);
3576 diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c
3577 -index f77ee87..27394e2 100644
3578 +index de96726..c3b4458 100644
3579 --- a/lustre/lfsck/lfsck_layout.c
3580 +++ b/lustre/lfsck/lfsck_layout.c
3581 -@@ -3657,69 +3657,53 @@ static int lfsck_layout_slave_post(const struct lu_env *env,
3582 +@@ -471,7 +471,7 @@ static struct lfsck_rbtree_node *lfsck_rbtree_new(const struct lu_env *env,
3583 + return ERR_PTR(-ENOMEM);
3584 + }
3585 +
3586 +- rb_init_node(&lrn->lrn_node);
3587 ++ RB_CLEAR_NODE(&lrn->lrn_node);
3588 + lrn->lrn_seq = fid_seq(fid);
3589 + lrn->lrn_first_oid = fid_oid(fid) & ~LFSCK_RBTREE_BITMAP_MASK;
3590 + atomic_set(&lrn->lrn_known_count, 0);
3591 +@@ -4798,69 +4798,53 @@ static int lfsck_layout_slave_post(const struct lu_env *env,
3592 }
3593
3594 static int lfsck_layout_dump(const struct lu_env *env,
3595 @@ -152,17 +156,17 @@ index f77ee87..27394e2 100644
3596 lo->ll_pos_first_inconsistent);
3597 - if (rc <= 0)
3598 - goto out;
3599 --
3600 +
3601 - buf += rc;
3602 - len -= rc;
3603 -
3604 +-
3605 - rc = snprintf(buf, len,
3606 - "success_count: %u\n"
3607 + seq_printf(m, "success_count: %u\n"
3608 "repaired_dangling: "LPU64"\n"
3609 "repaired_unmatched_pair: "LPU64"\n"
3610 "repaired_multiple_referenced: "LPU64"\n"
3611 -@@ -3739,11 +3723,6 @@ static int lfsck_layout_dump(const struct lu_env *env,
3612 +@@ -4880,11 +4864,6 @@ static int lfsck_layout_dump(const struct lu_env *env,
3613 lo->ll_objs_skipped,
3614 lo->ll_objs_failed_phase1,
3615 lo->ll_objs_failed_phase2);
3616 @@ -174,7 +178,7 @@ index f77ee87..27394e2 100644
3617
3618 if (lo->ll_status == LS_SCANNING_PHASE1) {
3619 __u64 pos;
3620 -@@ -3760,8 +3739,7 @@ static int lfsck_layout_dump(const struct lu_env *env,
3621 +@@ -4901,8 +4880,7 @@ static int lfsck_layout_dump(const struct lu_env *env,
3622 do_div(new_checked, duration);
3623 if (rtime != 0)
3624 do_div(speed, rtime);
3625 @@ -184,7 +188,7 @@ index f77ee87..27394e2 100644
3626 "checked_phase2: "LPU64"\n"
3627 "run_time_phase1: %u seconds\n"
3628 "run_time_phase2: %u seconds\n"
3629 -@@ -3775,11 +3753,6 @@ static int lfsck_layout_dump(const struct lu_env *env,
3630 +@@ -4916,11 +4894,6 @@ static int lfsck_layout_dump(const struct lu_env *env,
3631 lo->ll_run_time_phase2,
3632 speed,
3633 new_checked);
3634 @@ -196,29 +200,24 @@ index f77ee87..27394e2 100644
3635
3636 LASSERT(lfsck->li_di_oit != NULL);
3637
3638 -@@ -3792,47 +3765,7 @@ static int lfsck_layout_dump(const struct lu_env *env,
3639 +@@ -4933,12 +4906,8 @@ static int lfsck_layout_dump(const struct lu_env *env,
3640 pos = iops->store(env, lfsck->li_di_oit);
3641 if (!lfsck->li_current_oit_processed)
3642 pos--;
3643 - rc = snprintf(buf, len, "current_position: "LPU64"\n", pos);
3644 - if (rc <= 0)
3645 - goto out;
3646 --
3647 ++ seq_printf(m, "current_position: "LPU64"\n", pos);
3648 +
3649 - buf += rc;
3650 - len -= rc;
3651 -- } else if (lo->ll_status == LS_SCANNING_PHASE2) {
3652 -- cfs_duration_t duration = cfs_time_current() -
3653 -- lfsck->li_time_last_checkpoint;
3654 -- __u64 checked = lo->ll_objs_checked_phase1 + com->lc_new_checked;
3655 -- __u64 speed = checked;
3656 -- __u64 new_checked = com->lc_new_checked * HZ;
3657 -- __u32 rtime = lo->ll_run_time_phase1 +
3658 -- cfs_duration_sec(duration + HALF_SEC);
3659 --
3660 -- if (duration != 0)
3661 -- do_div(new_checked, duration);
3662 -- if (rtime != 0)
3663 -- do_div(speed, rtime);
3664 + } else if (lo->ll_status == LS_SCANNING_PHASE2) {
3665 + cfs_duration_t duration = cfs_time_current() -
3666 + lfsck->li_time_last_checkpoint;
3667 +@@ -4952,28 +4921,25 @@ static int lfsck_layout_dump(const struct lu_env *env,
3668 + do_div(new_checked, duration);
3669 + if (rtime != 0)
3670 + do_div(speed, rtime);
3671 - rc = snprintf(buf, len,
3672 - "checked_phase1: "LPU64"\n"
3673 - "checked_phase2: "LPU64"\n"
3674 @@ -237,15 +236,31 @@ index f77ee87..27394e2 100644
3675 - new_checked,
3676 - PFID(&com->lc_fid_latest_scanned_phase2));
3677 - if (rc <= 0)
3678 -- goto out;
3679 --
3680 ++ rc = seq_printf(m, "checked_phase1: "LPU64"\n"
3681 ++ "checked_phase2: "LPU64"\n"
3682 ++ "run_time_phase1: %u seconds\n"
3683 ++ "run_time_phase2: %u seconds\n"
3684 ++ "average_speed_phase1: "LPU64" items/sec\n"
3685 ++ "average_speed_phase2: N/A\n"
3686 ++ "real-time_speed_phase1: "LPU64" items/sec\n"
3687 ++ "real-time_speed_phase2: N/A\n"
3688 ++ "current_position: "DFID"\n",
3689 ++ checked,
3690 ++ lo->ll_objs_checked_phase2,
3691 ++ rtime,
3692 ++ lo->ll_run_time_phase2,
3693 ++ speed,
3694 ++ new_checked,
3695 ++ PFID(&com->lc_fid_latest_scanned_phase2));
3696 ++ if (rc < 0)
3697 + goto out;
3698 +
3699 - buf += rc;
3700 - len -= rc;
3701 -+ seq_printf(m, "current_position: "LPU64"\n", pos);
3702 } else {
3703 __u64 speed1 = lo->ll_objs_checked_phase1;
3704 __u64 speed2 = lo->ll_objs_checked_phase2;
3705 -@@ -3841,8 +3774,7 @@ static int lfsck_layout_dump(const struct lu_env *env,
3706 +@@ -4982,8 +4948,7 @@ static int lfsck_layout_dump(const struct lu_env *env,
3707 do_div(speed1, lo->ll_run_time_phase1);
3708 if (lo->ll_run_time_phase2 != 0)
3709 do_div(speed2, lo->ll_run_time_phase2);
3710 @@ -255,7 +270,7 @@ index f77ee87..27394e2 100644
3711 "checked_phase2: "LPU64"\n"
3712 "run_time_phase1: %u seconds\n"
3713 "run_time_phase2: %u seconds\n"
3714 -@@ -3857,18 +3789,11 @@ static int lfsck_layout_dump(const struct lu_env *env,
3715 +@@ -4998,18 +4963,11 @@ static int lfsck_layout_dump(const struct lu_env *env,
3716 lo->ll_run_time_phase2,
3717 speed1,
3718 speed2);
3719 @@ -276,10 +291,10 @@ index f77ee87..27394e2 100644
3720
3721 static int lfsck_layout_master_double_scan(const struct lu_env *env,
3722 diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c
3723 -index de7b849..d358ca1 100644
3724 +index 3b1fe0c..84ffc08 100644
3725 --- a/lustre/lfsck/lfsck_lib.c
3726 +++ b/lustre/lfsck/lfsck_lib.c
3727 -@@ -426,77 +426,52 @@ static inline int lfsck_instance_add(struct lfsck_instance *lfsck)
3728 +@@ -899,21 +899,15 @@ static inline int lfsck_instance_add(struct lfsck_instance *lfsck)
3729 return 0;
3730 }
3731
3732 @@ -291,8 +306,9 @@ index de7b849..d358ca1 100644
3733 int flag;
3734 - int rc;
3735 int i;
3736 + bool newline = (bits != 0 ? false : true);
3737
3738 -- rc = snprintf(*buf, *len, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
3739 +- rc = snprintf(*buf, *len, "%s:%c", prefix, newline ? '\n' : ' ');
3740 - if (rc <= 0)
3741 - return -ENOSPC;
3742 + seq_printf(m, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
3743 @@ -302,20 +318,35 @@ index de7b849..d358ca1 100644
3744 for (i = 0, flag = 1; bits != 0; i++, flag = 1 << i) {
3745 if (flag & bits) {
3746 bits &= ~flag;
3747 - if (names[i] != NULL) {
3748 +@@ -921,69 +915,43 @@ int lfsck_bits_dump(char **buf, int *len, int bits, const char *names[],
3749 + if (bits == 0)
3750 + newline = true;
3751 +
3752 - rc = snprintf(*buf, *len, "%s%c", names[i],
3753 -- bits != 0 ? ',' : '\n');
3754 +- newline ? '\n' : ',');
3755 - if (rc <= 0)
3756 - return -ENOSPC;
3757 -
3758 - *buf += rc;
3759 - *len -= rc;
3760 + seq_printf(m, "%s%c", names[i],
3761 -+ bits != 0 ? ',' : '\n');
3762 ++ newline ? '\n' : ',');
3763 }
3764 }
3765 }
3766 +
3767 +- if (!newline) {
3768 +- rc = snprintf(*buf, *len, "\n");
3769 +- if (rc <= 0)
3770 +- return -ENOSPC;
3771 +-
3772 +- *buf += rc;
3773 +- *len -= rc;
3774 +- }
3775 +-
3776 - return save - *len;
3777 ++ if (!newline)
3778 ++ seq_printf(m, "\n");
3779 + return 0;
3780 }
3781
3782 @@ -328,7 +359,7 @@ index de7b849..d358ca1 100644
3783 - rc = snprintf(*buf, *len, "%s: "LPU64" seconds\n", prefix,
3784 - cfs_time_current_sec() - time);
3785 + seq_printf(m, "%s: "LPU64" seconds\n", prefix,
3786 -+ cfs_time_current_sec() - time);
3787 ++ cfs_time_current_sec() - time);
3788 else
3789 - rc = snprintf(*buf, *len, "%s: N/A\n", prefix);
3790 - if (rc <= 0)
3791 @@ -376,7 +407,7 @@ index de7b849..d358ca1 100644
3792 }
3793
3794 void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck,
3795 -@@ -1149,7 +1124,7 @@ int lfsck_async_request(const struct lu_env *env, struct obd_export *exp,
3796 +@@ -1658,7 +1626,7 @@ int lfsck_async_request(const struct lu_env *env, struct obd_export *exp,
3797
3798 /* external interfaces */
3799
3800 @@ -385,7 +416,7 @@ index de7b849..d358ca1 100644
3801 {
3802 struct lu_env env;
3803 struct lfsck_instance *lfsck;
3804 -@@ -1162,8 +1137,7 @@ int lfsck_get_speed(struct dt_device *key, void *buf, int len)
3805 +@@ -1671,8 +1639,7 @@ int lfsck_get_speed(struct dt_device *key, void *buf, int len)
3806
3807 lfsck = lfsck_instance_find(key, true, false);
3808 if (likely(lfsck != NULL)) {
3809 @@ -394,8 +425,8 @@ index de7b849..d358ca1 100644
3810 + seq_printf(m, "%u\n", lfsck->li_bookmark_ram.lb_speed_limit);
3811 lfsck_instance_put(&env, lfsck);
3812 } else {
3813 - rc = -ENODEV;
3814 -@@ -1203,7 +1177,7 @@ int lfsck_set_speed(struct dt_device *key, int val)
3815 + rc = -ENXIO;
3816 +@@ -1712,7 +1679,7 @@ int lfsck_set_speed(struct dt_device *key, int val)
3817 }
3818 EXPORT_SYMBOL(lfsck_set_speed);
3819
3820 @@ -404,7 +435,7 @@ index de7b849..d358ca1 100644
3821 {
3822 struct lu_env env;
3823 struct lfsck_instance *lfsck;
3824 -@@ -1216,8 +1190,7 @@ int lfsck_get_windows(struct dt_device *key, void *buf, int len)
3825 +@@ -1725,8 +1692,7 @@ int lfsck_get_windows(struct dt_device *key, void *buf, int len)
3826
3827 lfsck = lfsck_instance_find(key, true, false);
3828 if (likely(lfsck != NULL)) {
3829 @@ -413,8 +444,8 @@ index de7b849..d358ca1 100644
3830 + seq_printf(m, "%u\n", lfsck->li_bookmark_ram.lb_async_windows);
3831 lfsck_instance_put(&env, lfsck);
3832 } else {
3833 - rc = -ENODEV;
3834 -@@ -1267,7 +1240,7 @@ int lfsck_set_windows(struct dt_device *key, int val)
3835 + rc = -ENXIO;
3836 +@@ -1776,7 +1742,7 @@ int lfsck_set_windows(struct dt_device *key, int val)
3837 }
3838 EXPORT_SYMBOL(lfsck_set_windows);
3839
3840 @@ -423,7 +454,7 @@ index de7b849..d358ca1 100644
3841 {
3842 struct lu_env env;
3843 struct lfsck_instance *lfsck;
3844 -@@ -1283,7 +1256,7 @@ int lfsck_dump(struct dt_device *key, void *buf, int len, enum lfsck_type type)
3845 +@@ -1792,7 +1758,7 @@ int lfsck_dump(struct dt_device *key, void *buf, int len, enum lfsck_type type)
3846 if (likely(lfsck != NULL)) {
3847 com = lfsck_component_find(lfsck, type);
3848 if (likely(com != NULL)) {
3849 @@ -433,7 +464,7 @@ index de7b849..d358ca1 100644
3850 } else {
3851 rc = -ENOTSUPP;
3852 diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c
3853 -index 6fc08fb..2abad67 100644
3854 +index c80fb48..bcbfb8e 100644
3855 --- a/lustre/lfsck/lfsck_namespace.c
3856 +++ b/lustre/lfsck/lfsck_namespace.c
3857 @@ -1088,65 +1088,56 @@ static int lfsck_namespace_post(const struct lu_env *env,
3858 @@ -604,10 +635,10 @@ index 6fc08fb..2abad67 100644
3859
3860 static int lfsck_namespace_double_scan_main(void *args)
3861 diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c
3862 -index 40a4ee3..b0acecb 100644
3863 +index 0fe590e..f1c76d6 100644
3864 --- a/lustre/mdd/mdd_device.c
3865 +++ b/lustre/mdd/mdd_device.c
3866 -@@ -812,16 +812,16 @@ static int mdd_process_config(const struct lu_env *env,
3867 +@@ -884,16 +884,16 @@ static int mdd_process_config(const struct lu_env *env,
3868 ENTRY;
3869
3870 switch (cfg->lcfg_command) {
3871 @@ -634,7 +665,7 @@ index 40a4ee3..b0acecb 100644
3872 case LCFG_SETUP:
3873 rc = next->ld_ops->ldo_process_config(env, next, cfg);
3874 if (rc)
3875 -@@ -1497,11 +1497,8 @@ LU_CONTEXT_KEY_DEFINE(mdd, LCT_MD_THREAD);
3876 +@@ -1564,11 +1564,8 @@ LU_CONTEXT_KEY_DEFINE(mdd, LCT_MD_THREAD);
3877
3878 static int __init mdd_mod_init(void)
3879 {
3880 @@ -646,20 +677,20 @@ index 40a4ee3..b0acecb 100644
3881 rc = lu_kmem_init(mdd_caches);
3882 if (rc)
3883 return rc;
3884 -@@ -1517,7 +1514,7 @@ static int __init mdd_mod_init(void)
3885 +@@ -1584,7 +1581,7 @@ static int __init mdd_mod_init(void)
3886
3887 - rc = class_register_type(&mdd_obd_device_ops, NULL, NULL,
3888 + rc = class_register_type(&mdd_obd_device_ops, NULL, true, NULL,
3889 #ifndef HAVE_ONLY_PROCFS_SEQ
3890 -- lvars.module_vars,
3891 -+ NULL,
3892 +- lvars.module_vars,
3893 ++ NULL,
3894 #endif
3895 - LUSTRE_MDD_NAME, &mdd_device_type);
3896 + LUSTRE_MDD_NAME, &mdd_device_type);
3897 if (rc)
3898 diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h
3899 -index 0bfb2a2..bccef77 100644
3900 +index b536821..8e67fa1 100644
3901 --- a/lustre/mdd/mdd_internal.h
3902 +++ b/lustre/mdd/mdd_internal.h
3903 -@@ -342,7 +342,6 @@ int orph_declare_index_delete(const struct lu_env *, struct mdd_object *,
3904 +@@ -346,7 +346,6 @@ int orph_declare_index_delete(const struct lu_env *, struct mdd_object *,
3905 struct thandle *);
3906
3907 /* mdd_lproc.c */
3908 @@ -668,7 +699,7 @@ index 0bfb2a2..bccef77 100644
3909 int mdd_procfs_fini(struct mdd_device *mdd);
3910
3911 diff --git a/lustre/mdd/mdd_lproc.c b/lustre/mdd/mdd_lproc.c
3912 -index de379b3..5714ee6 100644
3913 +index de379b3..7ac4afa 100644
3914 --- a/lustre/mdd/mdd_lproc.c
3915 +++ b/lustre/mdd/mdd_lproc.c
3916 @@ -49,56 +49,14 @@
3917 @@ -711,10 +742,7 @@ index de379b3..5714ee6 100644
3918 -}
3919 -
3920 -int mdd_procfs_fini(struct mdd_device *mdd)
3921 -+static ssize_t
3922 -+mdd_atime_diff_seq_write(struct file *file, const char *buffer,
3923 -+ size_t count, loff_t *off)
3924 - {
3925 +-{
3926 - if (mdd->mdd_proc_entry) {
3927 - lprocfs_remove(&mdd->mdd_proc_entry);
3928 - mdd->mdd_proc_entry = NULL;
3929 @@ -724,7 +752,10 @@ index de379b3..5714ee6 100644
3930 -
3931 -static int lprocfs_wr_atime_diff(struct file *file, const char *buffer,
3932 - unsigned long count, void *data)
3933 --{
3934 ++static ssize_t
3935 ++mdd_atime_diff_seq_write(struct file *file, const char *buffer,
3936 ++ size_t count, loff_t *off)
3937 + {
3938 - struct mdd_device *mdd = data;
3939 - char kernbuf[20], *end;
3940 - unsigned long diff = 0;
3941 @@ -867,7 +898,7 @@ index de379b3..5714ee6 100644
3942
3943 llog_cat_process(&env, ctxt->loc_handle, lprocfs_changelog_users_cb,
3944 - &cucb, 0, 0);
3945 -+ &m, 0, 0);
3946 ++ m, 0, 0);
3947
3948 lu_env_fini(&env);
3949 llog_ctxt_put(ctxt);
3950 @@ -968,7 +999,7 @@ index de379b3..5714ee6 100644
3951 __u32 val;
3952 int rc;
3953
3954 -@@ -320,54 +255,77 @@ static int lprocfs_wr_lfsck_async_windows(struct file *file, const char *buffer,
3955 +@@ -320,54 +255,87 @@ static int lprocfs_wr_lfsck_async_windows(struct file *file, const char *buffer,
3956
3957 return rc != 0 ? rc : count;
3958 }
3959 @@ -989,12 +1020,35 @@ index de379b3..5714ee6 100644
3960 - return rc;
3961 + return lfsck_dump(m, mdd->mdd_bottom, LT_NAMESPACE);
3962 }
3963 ++LPROC_SEQ_FOPS_RO(mdd_lfsck_namespace);
3964
3965 -static int lprocfs_rd_lfsck_layout(char *page, char **start, off_t off,
3966 - int count, int *eof, void *data)
3967 --{
3968 ++static int mdd_lfsck_layout_seq_show(struct seq_file *m, void *data)
3969 + {
3970 - struct mdd_device *mdd = data;
3971 -+LPROC_SEQ_FOPS_RO(mdd_lfsck_namespace);
3972 ++ struct mdd_device *mdd = m->private;
3973 +
3974 + LASSERT(mdd != NULL);
3975 +- *eof = 1;
3976 +
3977 +- return lfsck_dump(mdd->mdd_bottom, page, count, LT_LAYOUT);
3978 ++ return lfsck_dump(m, mdd->mdd_bottom, LT_LAYOUT);
3979 + }
3980 +-
3981 +-static struct lprocfs_vars lprocfs_mdd_obd_vars[] = {
3982 +- { "atime_diff", lprocfs_rd_atime_diff, lprocfs_wr_atime_diff, 0 },
3983 +- { "changelog_mask", lprocfs_rd_changelog_mask,
3984 +- lprocfs_wr_changelog_mask, 0 },
3985 +- { "changelog_users", lprocfs_rd_changelog_users, 0, 0},
3986 +- { "sync_permission", lprocfs_rd_sync_perm, lprocfs_wr_sync_perm, 0 },
3987 +- { "lfsck_speed_limit", lprocfs_rd_lfsck_speed_limit,
3988 +- lprocfs_wr_lfsck_speed_limit, 0 },
3989 +- { "lfsck_async_windows", lprocfs_rd_lfsck_async_windows,
3990 +- lprocfs_wr_lfsck_async_windows, 0 },
3991 +- { "lfsck_namespace", lprocfs_rd_lfsck_namespace, 0, 0 },
3992 +- { "lfsck_layout", lprocfs_rd_lfsck_layout, 0, 0 },
3993 ++LPROC_SEQ_FOPS_RO(mdd_lfsck_layout);
3994 +
3995 +static struct lprocfs_seq_vars lprocfs_mdd_obd_vars[] = {
3996 + { .name = "atime_diff",
3997 @@ -1007,42 +1061,34 @@ index de379b3..5714ee6 100644
3998 + .fops = &mdd_sync_perm_fops },
3999 + { .name = "lfsck_speed_limit",
4000 + .fops = &mdd_lfsck_speed_limit_fops },
4001 -+ { .name = "lfsck_async_windows",
4002 -+ .fops = &mdd_lfsck_async_windows_fops },
4003 -+ { .name = "lfsck_namespace",
4004 -+ .fops = &mdd_lfsck_namespace_fops },
4005 -+ { 0 }
4006 -+};
4007 -
4008 -- LASSERT(mdd != NULL);
4009 -- *eof = 1;
4010 ++ { .name = "lfsck_async_windows",
4011 ++ .fops = &mdd_lfsck_async_windows_fops },
4012 ++ { .name = "lfsck_namespace",
4013 ++ .fops = &mdd_lfsck_namespace_fops },
4014 ++ { .name = "lfsck_layout",
4015 ++ .fops = &mdd_lfsck_layout_fops },
4016 + { 0 }
4017 + };
4018 +
4019 +-static struct lprocfs_vars lprocfs_mdd_module_vars[] = {
4020 +- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
4021 +- { 0 }
4022 +-};
4023 +-
4024 +-void lprocfs_mdd_init_vars(struct lprocfs_static_vars *lvars)
4025 +int mdd_procfs_init(struct mdd_device *mdd, const char *name)
4026 -+{
4027 + {
4028 +- lvars->module_vars = lprocfs_mdd_module_vars;
4029 +- lvars->obd_vars = lprocfs_mdd_obd_vars;
4030 + struct obd_device *obd = class_name2obd(name);
4031 + struct obd_type *type;
4032 + int rc;
4033 + ENTRY;
4034 -
4035 -- return lfsck_dump(mdd->mdd_bottom, page, count, LT_LAYOUT);
4036 --}
4037 ++
4038 + /* at the moment there is no linkage between lu_type
4039 + * and obd_type, so we lookup obd_type this way */
4040 + type = class_search_type(LUSTRE_MDD_NAME);
4041 -
4042 --static struct lprocfs_vars lprocfs_mdd_obd_vars[] = {
4043 -- { "atime_diff", lprocfs_rd_atime_diff, lprocfs_wr_atime_diff, 0 },
4044 -- { "changelog_mask", lprocfs_rd_changelog_mask,
4045 -- lprocfs_wr_changelog_mask, 0 },
4046 -- { "changelog_users", lprocfs_rd_changelog_users, 0, 0},
4047 -- { "sync_permission", lprocfs_rd_sync_perm, lprocfs_wr_sync_perm, 0 },
4048 -- { "lfsck_speed_limit", lprocfs_rd_lfsck_speed_limit,
4049 -- lprocfs_wr_lfsck_speed_limit, 0 },
4050 -- { "lfsck_async_windows", lprocfs_rd_lfsck_async_windows,
4051 -- lprocfs_wr_lfsck_async_windows, 0 },
4052 -- { "lfsck_namespace", lprocfs_rd_lfsck_namespace, 0, 0 },
4053 -- { "lfsck_layout", lprocfs_rd_lfsck_layout, 0, 0 },
4054 -- { 0 }
4055 --};
4056 ++
4057 + LASSERT(name != NULL);
4058 + LASSERT(type != NULL);
4059 + LASSERT(obd != NULL);
4060 @@ -1059,32 +1105,23 @@ index de379b3..5714ee6 100644
4061 + GOTO(out, rc);
4062 + }
4063 + rc = 0;
4064 -
4065 --static struct lprocfs_vars lprocfs_mdd_module_vars[] = {
4066 -- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
4067 -- { 0 }
4068 --};
4069 + EXIT;
4070 +out:
4071 + if (rc)
4072 + mdd_procfs_fini(mdd);
4073 + return rc;
4074 -+}
4075 + }
4076
4077 --void lprocfs_mdd_init_vars(struct lprocfs_static_vars *lvars)
4078 +int mdd_procfs_fini(struct mdd_device *mdd)
4079 - {
4080 -- lvars->module_vars = lprocfs_mdd_module_vars;
4081 -- lvars->obd_vars = lprocfs_mdd_obd_vars;
4082 ++{
4083 + if (mdd->mdd_proc_entry) {
4084 + lprocfs_remove(&mdd->mdd_proc_entry);
4085 + mdd->mdd_proc_entry = NULL;
4086 + }
4087 + RETURN(0);
4088 - }
4089 --
4090 ++}
4091 diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c
4092 -index 0ca58c5..5b72a5a 100644
4093 +index 30d9f59..5e479c8 100644
4094 --- a/lustre/obdclass/lprocfs_status.c
4095 +++ b/lustre/obdclass/lprocfs_status.c
4096 @@ -388,11 +388,10 @@ EXPORT_SYMBOL(lprocfs_evict_client_seq_write);
4097 @@ -1104,7 +1141,7 @@ index 0ca58c5..5b72a5a 100644
4098 EXPORT_SYMBOL(lprocfs_evict_client_fops);
4099 #endif
4100 diff --git a/lustre/ofd/lproc_ofd.c b/lustre/ofd/lproc_ofd.c
4101 -index e303fd6..1759a7d 100644
4102 +index 000d4ae..eb6bef0 100644
4103 --- a/lustre/ofd/lproc_ofd.c
4104 +++ b/lustre/ofd/lproc_ofd.c
4105 @@ -47,80 +47,75 @@
4106 @@ -1600,7 +1637,7 @@ index e303fd6..1759a7d 100644
4107 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
4108 __u32 val;
4109 int rc;
4110 -@@ -516,84 +512,108 @@ static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer,
4111 +@@ -516,37 +512,34 @@ static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer,
4112
4113 return rc != 0 ? rc : count;
4114 }
4115 @@ -1611,13 +1648,55 @@ index e303fd6..1759a7d 100644
4116 +static int ofd_lfsck_layout_seq_show(struct seq_file *m, void *data)
4117 {
4118 - struct obd_device *obd = data;
4119 +- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
4120 +-
4121 +- *eof = 1;
4122 ++ struct obd_device *obd = m->private;
4123 ++ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
4124 +
4125 +- return lfsck_dump(ofd->ofd_osd, page, count, LT_LAYOUT);
4126 ++ return lfsck_dump(m, ofd->ofd_osd, LT_LAYOUT);
4127 + }
4128 ++LPROC_SEQ_FOPS_RO(ofd_lfsck_layout);
4129 +
4130 +-static int lprocfs_rd_lfsck_verify_pfid(char *page, char **start, off_t off,
4131 +- int count, int *eof, void *data)
4132 ++static int ofd_lfsck_verify_pfid_seq_show(struct seq_file *m, void *data)
4133 + {
4134 +- struct obd_device *obd = data;
4135 +- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
4136 +-
4137 +- *eof = 1;
4138 ++ struct obd_device *obd = m->private;
4139 ++ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
4140 +
4141 +- return snprintf(page, count,
4142 +- "switch: %s\ndetected: "LPU64"\nrepaired: "LPU64"\n",
4143 +- ofd->ofd_lfsck_verify_pfid ? "on" : "off",
4144 +- ofd->ofd_inconsistency_self_detected,
4145 +- ofd->ofd_inconsistency_self_repaired);
4146 ++ return seq_printf(m, "switch: %s\ndetected: "LPU64"\nrepaired: "LPU64"\n",
4147 ++ ofd->ofd_lfsck_verify_pfid ? "on" : "off",
4148 ++ ofd->ofd_inconsistency_self_detected,
4149 ++ ofd->ofd_inconsistency_self_repaired);
4150 + }
4151 +
4152 +-static int lprocfs_wr_lfsck_verify_pfid(struct file *file, const char *buffer,
4153 +- unsigned long count, void *data)
4154 ++static ssize_t
4155 ++ofd_lfsck_verify_pfid_seq_write(struct file *file, const char *buffer,
4156 ++ size_t count, loff_t *off)
4157 + {
4158 +- struct obd_device *obd = data;
4159 ++ struct seq_file *m = file->private_data;
4160 + struct obd_device *obd = m->private;
4161 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
4162 + __u32 val;
4163 + int rc;
4164 +@@ -559,75 +552,101 @@ static int lprocfs_wr_lfsck_verify_pfid(struct file *file, const char *buffer,
4165
4166 -- *eof = 1;
4167 --
4168 -- return lfsck_dump(ofd->ofd_osd, page, count, LT_LAYOUT);
4169 --}
4170 + return count;
4171 + }
4172 -
4173 -static struct lprocfs_vars lprocfs_ofd_obd_vars[] = {
4174 - { "uuid", lprocfs_rd_uuid, 0, 0 },
4175 @@ -1671,14 +1750,14 @@ index e303fd6..1759a7d 100644
4176 - { "lfsck_speed_limit", lprocfs_rd_lfsck_speed_limit,
4177 - lprocfs_wr_lfsck_speed_limit, 0 },
4178 - { "lfsck_layout", lprocfs_rd_lfsck_layout, 0, 0 },
4179 +- { "lfsck_verify_pfid", lprocfs_rd_lfsck_verify_pfid,
4180 +- lprocfs_wr_lfsck_verify_pfid, 0 },
4181 - { 0 }
4182 -};
4183 -
4184 -static struct lprocfs_vars lprocfs_ofd_module_vars[] = {
4185 - { "num_refs", lprocfs_rd_numrefs, 0, 0 },
4186 -+ return lfsck_dump(m, ofd->ofd_osd, LT_LAYOUT);
4187 -+}
4188 -+LPROC_SEQ_FOPS_RO(ofd_lfsck_layout);
4189 ++LPROC_SEQ_FOPS(ofd_lfsck_verify_pfid);
4190 +
4191 +LPROC_SEQ_FOPS_RO_TYPE(ofd, uuid);
4192 +LPROC_SEQ_FOPS_RO_TYPE(ofd, blksize);
4193 @@ -1764,10 +1843,12 @@ index e303fd6..1759a7d 100644
4194 + .fops = &ofd_job_interval_fops },
4195 + { .name = "soft_sync_limit",
4196 + .fops = &ofd_soft_sync_limit_fops },
4197 -+ { .name = "lfsck_speed_limit",
4198 -+ .fops = &ofd_lfsck_speed_limit_fops },
4199 -+ { .name = "lfsck_layout",
4200 -+ .fops = &ofd_lfsck_layout_fops },
4201 ++ { .name = "lfsck_speed_limit",
4202 ++ .fops = &ofd_lfsck_speed_limit_fops },
4203 ++ { .name = "lfsck_layout",
4204 ++ .fops = &ofd_lfsck_layout_fops },
4205 ++ { .name = "lfsck_verify_pfid",
4206 ++ .fops = &ofd_lfsck_verify_pfid_fops },
4207 { 0 }
4208 };
4209
4210 @@ -1781,7 +1862,7 @@ index e303fd6..1759a7d 100644
4211 {
4212 LASSERT(stats && stats->ls_num >= LPROC_OFD_STATS_LAST);
4213 diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c
4214 -index 9900bed..a9cc81f 100644
4215 +index 5d7f0b4..f75ffe1 100644
4216 --- a/lustre/ofd/ofd_dev.c
4217 +++ b/lustre/ofd/ofd_dev.c
4218 @@ -240,8 +240,7 @@ static int ofd_process_config(const struct lu_env *env, struct lu_device *d,
4219 @@ -1827,16 +1908,17 @@ index 9900bed..a9cc81f 100644
4220 if (rc) {
4221 CERROR("%s: lprocfs_obd_setup failed: %d.\n",
4222 obd->obd_name, rc);
4223 -@@ -524,7 +523,7 @@ static int ofd_procfs_init(struct ofd_device *ofd)
4224 +@@ -524,7 +523,8 @@ static int ofd_procfs_init(struct ofd_device *ofd)
4225
4226 obd->obd_uses_nid_stats = 1;
4227
4228 - entry = lprocfs_register("exports", obd->obd_proc_entry, NULL, NULL);
4229 -+ entry = lprocfs_seq_register("exports", obd->obd_proc_entry, NULL, NULL);
4230 ++ entry = lprocfs_seq_register("exports", obd->obd_proc_entry, NULL,
4231 ++ NULL);
4232 if (IS_ERR(entry)) {
4233 rc = PTR_ERR(entry);
4234 CERROR("%s: error %d setting up lprocfs for %s\n",
4235 -@@ -534,8 +533,10 @@ static int ofd_procfs_init(struct ofd_device *ofd)
4236 +@@ -534,8 +534,10 @@ static int ofd_procfs_init(struct ofd_device *ofd)
4237 obd->obd_proc_exports_entry = entry;
4238
4239 entry = lprocfs_add_simple(obd->obd_proc_exports_entry, "clear",
4240 @@ -1849,7 +1931,7 @@ index 9900bed..a9cc81f 100644
4241 if (IS_ERR(entry)) {
4242 rc = PTR_ERR(entry);
4243 CERROR("%s: add proc entry 'clear' failed: %d.\n",
4244 -@@ -551,7 +552,7 @@ static int ofd_procfs_init(struct ofd_device *ofd)
4245 +@@ -551,7 +553,7 @@ static int ofd_procfs_init(struct ofd_device *ofd)
4246 GOTO(remove_entry_clear, rc);
4247 RETURN(0);
4248 remove_entry_clear:
4249 @@ -1858,42 +1940,59 @@ index 9900bed..a9cc81f 100644
4250 obd_cleanup:
4251 lprocfs_obd_cleanup(obd);
4252 lprocfs_free_obd_stats(obd);
4253 -@@ -564,29 +565,28 @@ static void ofd_procfs_add_brw_stats_symlink(struct ofd_device *ofd)
4254 +@@ -563,47 +565,36 @@ static void ofd_procfs_add_brw_stats_symlink(struct ofd_device *ofd)
4255 + {
4256 struct obd_device *obd = ofd_obd(ofd);
4257 struct obd_device *osd_obd = ofd->ofd_osd_exp->exp_obd;
4258 - cfs_proc_dir_entry_t *osd_root = osd_obd->obd_type->typ_procroot;
4259 +- cfs_proc_dir_entry_t *osd_root = osd_obd->obd_type->typ_procroot;
4260 - cfs_proc_dir_entry_t *osd_dir;
4261 -+ cfs_proc_dir_entry_t *osd_dir = osd_obd->obd_type->typ_procsym;
4262 ++ struct proc_dir_entry *osd_dir = osd_obd->obd_type->typ_procsym;
4263
4264 - osd_dir = lprocfs_srch(osd_root, obd->obd_name);
4265 if (osd_dir == NULL)
4266 return;
4267
4268 - if (lprocfs_srch(osd_dir, "brw_stats") != NULL)
4269 -+ //if (lprocfs_srch(osd_dir, "brw_stats") != NULL)
4270 - lprocfs_add_symlink("brw_stats", obd->obd_proc_entry,
4271 - "../../%s/%s/brw_stats",
4272 - osd_root->name, osd_dir->name);
4273 -
4274 +- lprocfs_add_symlink("brw_stats", obd->obd_proc_entry,
4275 +- "../../%s/%s/brw_stats",
4276 +- osd_root->name, osd_dir->name);
4277 +-
4278 - if (lprocfs_srch(osd_dir, "read_cache_enable") != NULL)
4279 -+ //if (lprocfs_srch(osd_dir, "read_cache_enable") != NULL)
4280 - lprocfs_add_symlink("read_cache_enable", obd->obd_proc_entry,
4281 - "../../%s/%s/read_cache_enable",
4282 - osd_root->name, osd_dir->name);
4283 -
4284 +- lprocfs_add_symlink("read_cache_enable", obd->obd_proc_entry,
4285 +- "../../%s/%s/read_cache_enable",
4286 +- osd_root->name, osd_dir->name);
4287 +-
4288 - if (lprocfs_srch(osd_dir, "readcache_max_filesize") != NULL)
4289 -+ //if (lprocfs_srch(osd_dir, "readcache_max_filesize") != NULL)
4290 - lprocfs_add_symlink("readcache_max_filesize",
4291 - obd->obd_proc_entry,
4292 - "../../%s/%s/readcache_max_filesize",
4293 - osd_root->name, osd_dir->name);
4294 -
4295 +- lprocfs_add_symlink("readcache_max_filesize",
4296 +- obd->obd_proc_entry,
4297 +- "../../%s/%s/readcache_max_filesize",
4298 +- osd_root->name, osd_dir->name);
4299 +-
4300 - if (lprocfs_srch(osd_dir, "writethrough_cache_enable") != NULL)
4301 -+ //if (lprocfs_srch(osd_dir, "writethrough_cache_enable") != NULL)
4302 - lprocfs_add_symlink("writethrough_cache_enable",
4303 - obd->obd_proc_entry,
4304 - "../../%s/%s/writethrough_cache_enable",
4305 -@@ -597,13 +597,8 @@ static void ofd_procfs_fini(struct ofd_device *ofd)
4306 +- lprocfs_add_symlink("writethrough_cache_enable",
4307 +- obd->obd_proc_entry,
4308 +- "../../%s/%s/writethrough_cache_enable",
4309 +- osd_root->name, osd_dir->name);
4310 ++ lprocfs_add_symlink("brw_stats", obd->obd_proc_entry,
4311 ++ "../../%s/%s/brw_stats",
4312 ++ osd_obd->obd_type->typ_name, obd->obd_name);
4313 ++
4314 ++ lprocfs_add_symlink("read_cache_enable", obd->obd_proc_entry,
4315 ++ "../../%s/%s/read_cache_enable",
4316 ++ osd_obd->obd_type->typ_name, obd->obd_name);
4317 ++
4318 ++ lprocfs_add_symlink("readcache_max_filesize",
4319 ++ obd->obd_proc_entry,
4320 ++ "../../%s/%s/readcache_max_filesize",
4321 ++ osd_obd->obd_type->typ_name, obd->obd_name);
4322 ++
4323 ++ lprocfs_add_symlink("writethrough_cache_enable",
4324 ++ obd->obd_proc_entry,
4325 ++ "../../%s/%s/writethrough_cache_enable",
4326 ++ osd_obd->obd_type->typ_name, obd->obd_name);
4327 + }
4328 +
4329 + static void ofd_procfs_fini(struct ofd_device *ofd)
4330 {
4331 struct obd_device *obd = ofd_obd(ofd);
4332
4333 @@ -1909,7 +2008,7 @@ index 9900bed..a9cc81f 100644
4334 lprocfs_free_per_client_stats(obd);
4335 lprocfs_obd_cleanup(obd);
4336 lprocfs_free_obd_stats(obd);
4337 -@@ -2368,7 +2363,6 @@ static struct lu_device_type ofd_device_type = {
4338 +@@ -2379,7 +2370,6 @@ static struct lu_device_type ofd_device_type = {
4339
4340 int __init ofd_init(void)
4341 {
4342 @@ -1917,24 +2016,24 @@ index 9900bed..a9cc81f 100644
4343 int rc;
4344
4345 rc = lu_kmem_init(ofd_caches);
4346 -@@ -2381,11 +2375,9 @@ int __init ofd_init(void)
4347 +@@ -2392,11 +2382,9 @@ int __init ofd_init(void)
4348 return(rc);
4349 }
4350
4351 - lprocfs_ofd_init_vars(&lvars);
4352 -
4353 - rc = class_register_type(&ofd_obd_ops, NULL, NULL,
4354 + rc = class_register_type(&ofd_obd_ops, NULL, true, NULL,
4355 #ifndef HAVE_ONLY_PROCFS_SEQ
4356 -- lvars.module_vars,
4357 -+ NULL,
4358 +- lvars.module_vars,
4359 ++ NULL,
4360 #endif
4361 - LUSTRE_OST_NAME, &ofd_device_type);
4362 + LUSTRE_OST_NAME, &ofd_device_type);
4363 return rc;
4364 diff --git a/lustre/ofd/ofd_internal.h b/lustre/ofd/ofd_internal.h
4365 -index ab041ce..60cfb50 100644
4366 +index 3aae6dd..1bdcb80 100644
4367 --- a/lustre/ofd/ofd_internal.h
4368 +++ b/lustre/ofd/ofd_internal.h
4369 -@@ -392,13 +392,9 @@ int ofd_txn_stop_cb(const struct lu_env *env, struct thandle *txn,
4370 +@@ -403,13 +403,9 @@ int ofd_txn_stop_cb(const struct lu_env *env, struct thandle *txn,
4371
4372 /* lproc_ofd.c */
4373 #ifdef LPROCFS
4374 @@ -1950,10 +2049,10 @@ index ab041ce..60cfb50 100644
4375 #endif
4376
4377 diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c
4378 -index a8022f0..4e1ec4a 100644
4379 +index e0da7e6..14808ee 100644
4380 --- a/lustre/osd-ldiskfs/osd_handler.c
4381 +++ b/lustre/osd-ldiskfs/osd_handler.c
4382 -@@ -5892,6 +5892,7 @@ static int osd_obd_connect(const struct lu_env *env, struct obd_export **exp,
4383 +@@ -5921,6 +5921,7 @@ static int osd_obd_connect(const struct lu_env *env, struct obd_export **exp,
4384 osd->od_connects++;
4385 spin_unlock(&osd->od_osfs_lock);
4386
4387 @@ -1962,7 +2061,7 @@ index a8022f0..4e1ec4a 100644
4388 }
4389
4390 diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c
4391 -index c9bf49a..bd2463a 100644
4392 +index 05820e0..e711727 100644
4393 --- a/lustre/osd-zfs/osd_handler.c
4394 +++ b/lustre/osd-zfs/osd_handler.c
4395 @@ -816,6 +816,7 @@ static int osd_obd_connect(const struct lu_env *env, struct obd_export **exp,
4396 @@ -1974,5 +2073,5 @@ index c9bf49a..bd2463a 100644
4397 }
4398
4399 --
4400 -1.8.5.3
4401 +1.9.1
4402
4403
4404 diff --git a/sys-cluster/lustre/files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch b/sys-cluster/lustre/files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch
4405 index 7f9d4d7..cc93d19 100644
4406 --- a/sys-cluster/lustre/files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch
4407 +++ b/sys-cluster/lustre/files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch
4408 @@ -1,12 +1,11 @@
4409 -From 98a6eee60a100d445d7533eeba907e4e75c36f18 Mon Sep 17 00:00:00 2001
4410 +From 671de4e9a7ec811db225a763b88e48379d5a4daf Mon Sep 17 00:00:00 2001
4411 From: James Simmons <uja.ornl@×××××.com>
4412 -Date: Sun, 9 Feb 2014 10:45:37 -0500
4413 -Subject: [PATCH 09/12] LU-3319 procfs: update ldiskfs proc handling to
4414 - seq_files
4415 +Date: Tue, 25 Mar 2014 12:37:41 -0400
4416 +Subject: [PATCH 9/9] LU-3319 procfs: update ldiskfs proc handling to seq_files
4417
4418 Migrate all ldiskfs proc handling to using strictly
4419 seq_files. Also include a fix with newer gcc complaining
4420 -certain variables are initialized.
4421 +certain variables are uninitialized.
4422
4423 Signed-off-by: James Simmons <uja.ornl@×××××.com>
4424 Change-Id: Ia296a4682e2feda02bcfbe0100de8a89404cd731
4425 @@ -14,12 +13,12 @@ Change-Id: Ia296a4682e2feda02bcfbe0100de8a89404cd731
4426 lustre/osd-ldiskfs/osd_compat.c | 6 +-
4427 lustre/osd-ldiskfs/osd_handler.c | 16 +-
4428 lustre/osd-ldiskfs/osd_internal.h | 6 +-
4429 - lustre/osd-ldiskfs/osd_lproc.c | 336 ++++++++++++++++++++------------------
4430 - lustre/osd-ldiskfs/osd_scrub.c | 73 +++------
4431 - 5 files changed, 220 insertions(+), 217 deletions(-)
4432 + lustre/osd-ldiskfs/osd_lproc.c | 343 ++++++++++++++++++++------------------
4433 + lustre/osd-ldiskfs/osd_scrub.c | 104 ++++--------
4434 + 5 files changed, 235 insertions(+), 240 deletions(-)
4435
4436 diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c
4437 -index e693e8d..3fb6783 100644
4438 +index 8b91b64..6330066 100644
4439 --- a/lustre/osd-ldiskfs/osd_compat.c
4440 +++ b/lustre/osd-ldiskfs/osd_compat.c
4441 @@ -1164,7 +1164,7 @@ int osd_obj_spec_update(struct osd_thread_info *info, struct osd_device *osd,
4442 @@ -50,53 +49,46 @@ index e693e8d..3fb6783 100644
4443 ENTRY;
4444
4445 diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c
4446 -index 4e1ec4a..1d9a2ba 100644
4447 +index 14808ee..2cb9af5 100644
4448 --- a/lustre/osd-ldiskfs/osd_handler.c
4449 +++ b/lustre/osd-ldiskfs/osd_handler.c
4450 -@@ -5824,6 +5824,7 @@ static struct lu_device *osd_device_free(const struct lu_env *env,
4451 - static int osd_process_config(const struct lu_env *env,
4452 - struct lu_device *d, struct lustre_cfg *cfg)
4453 - {
4454 -+ struct obd_device *obd = d->ld_obd;
4455 - struct osd_device *o = osd_dev(d);
4456 - int rc;
4457 - ENTRY;
4458 -@@ -5838,12 +5839,12 @@ static int osd_process_config(const struct lu_env *env,
4459 +@@ -5867,12 +5867,13 @@ static int osd_process_config(const struct lu_env *env,
4460 break;
4461 case LCFG_PARAM:
4462 LASSERT(&o->od_dt_dev);
4463 - rc = class_process_proc_param(PARAM_OSD, lprocfs_osd_obd_vars,
4464 - cfg, &o->od_dt_dev);
4465 -+ rc = class_process_proc_seq_param(PARAM_OSD, obd->obd_vars,
4466 ++ rc = class_process_proc_seq_param(PARAM_OSD,
4467 ++ lprocfs_osd_obd_vars,
4468 + cfg, &o->od_dt_dev);
4469 if (rc > 0 || rc == -ENOSYS)
4470 - rc = class_process_proc_param(PARAM_OST,
4471 - lprocfs_osd_obd_vars,
4472 - cfg, &o->od_dt_dev);
4473 + rc = class_process_proc_seq_param(PARAM_OST,
4474 -+ obd->obd_vars, cfg,
4475 -+ &o->od_dt_dev);
4476 ++ lprocfs_osd_obd_vars,
4477 ++ cfg, &o->od_dt_dev);
4478 break;
4479 default:
4480 rc = -ENOSYS;
4481 -@@ -5991,9 +5992,10 @@ static int __init osd_mod_init(void)
4482 +@@ -6020,9 +6021,10 @@ static int __init osd_mod_init(void)
4483 if (rc)
4484 return rc;
4485
4486 -- rc = class_register_type(&osd_obd_device_ops, NULL, NULL,
4487 +- rc = class_register_type(&osd_obd_device_ops, NULL, true, NULL,
4488 -#ifndef HAVE_ONLY_PROCFS_SEQ
4489 -+ rc = class_register_type(&osd_obd_device_ops, NULL,
4490 - lprocfs_osd_module_vars,
4491 ++ rc = class_register_type(&osd_obd_device_ops, NULL, true,
4492 + lprocfs_osd_module_vars,
4493 +#ifndef HAVE_ONLY_PROCFS_SEQ
4494 -+ NULL,
4495 ++ NULL,
4496 #endif
4497 - LUSTRE_OSD_LDISKFS_NAME, &osd_device_type);
4498 + LUSTRE_OSD_LDISKFS_NAME, &osd_device_type);
4499 if (rc)
4500 diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h
4501 -index dc52885..7d54162 100644
4502 +index 185d63d..e1bde19 100644
4503 --- a/lustre/osd-ldiskfs/osd_internal.h
4504 +++ b/lustre/osd-ldiskfs/osd_internal.h
4505 -@@ -616,8 +616,8 @@ static inline int __osd_xattr_set(struct osd_thread_info *info,
4506 +@@ -617,8 +617,8 @@ static inline int __osd_xattr_set(struct osd_thread_info *info,
4507
4508 #ifdef LPROCFS
4509 /* osd_lproc.c */
4510 @@ -107,7 +99,7 @@ index dc52885..7d54162 100644
4511 int osd_procfs_init(struct osd_device *osd, const char *name);
4512 int osd_procfs_fini(struct osd_device *osd);
4513 void osd_brw_stats_update(struct osd_device *osd, struct osd_iobuf *iobuf);
4514 -@@ -672,7 +672,7 @@ int osd_oii_insert(struct osd_device *dev, struct osd_idmap_cache *oic,
4515 +@@ -673,7 +673,7 @@ int osd_oii_insert(struct osd_device *dev, struct osd_idmap_cache *oic,
4516 int insert);
4517 int osd_oii_lookup(struct osd_device *dev, const struct lu_fid *fid,
4518 struct osd_inode_id *id);
4519 @@ -117,7 +109,7 @@ index dc52885..7d54162 100644
4520 int osd_fld_lookup(const struct lu_env *env, struct osd_device *osd,
4521 obd_seq seq, struct lu_seq_range *range);
4522 diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c
4523 -index b9b4e3d..947a4b9 100644
4524 +index b9b4e3d..ddaa169 100644
4525 --- a/lustre/osd-ldiskfs/osd_lproc.c
4526 +++ b/lustre/osd-ldiskfs/osd_lproc.c
4527 @@ -237,92 +237,46 @@ out:
4528 @@ -125,7 +117,8 @@ index b9b4e3d..947a4b9 100644
4529 }
4530
4531 -int osd_procfs_init(struct osd_device *osd, const char *name)
4532 --{
4533 ++static int ldiskfs_osd_fstype_seq_show(struct seq_file *m, void *data)
4534 + {
4535 - struct obd_type *type;
4536 - int rc;
4537 - ENTRY;
4538 @@ -148,7 +141,8 @@ index b9b4e3d..947a4b9 100644
4539 - osd->od_proc_entry = NULL;
4540 - GOTO(out, rc);
4541 - }
4542 --
4543 ++ struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
4544 +
4545 - rc = osd_stats_init(osd);
4546 -
4547 - EXIT;
4548 @@ -172,11 +166,9 @@ index b9b4e3d..947a4b9 100644
4549 -
4550 -static int lprocfs_osd_rd_fstype(char *page, char **start, off_t off, int count,
4551 - int *eof, void *data)
4552 -+static int ldiskfs_osd_fstype_seq_show(struct seq_file *m, void *data)
4553 - {
4554 +-{
4555 - struct osd_device *osd = osd_dt_dev(data);
4556 -+ struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
4557 -
4558 +-
4559 - LASSERT(osd != NULL);
4560 - return snprintf(page, count, "ldiskfs\n");
4561 + LASSERT(osd != NULL);
4562 @@ -200,7 +192,7 @@ index b9b4e3d..947a4b9 100644
4563 + return -EINPROGRESS;
4564
4565 - return snprintf(page, count, "%s\n", osd->od_mntdev);
4566 -+ return seq_printf(m, "%u\n", osd->od_read_cache);
4567 ++ return seq_printf(m, "%s\n", osd->od_mntdev);
4568 }
4569 +LPROC_SEQ_FOPS_RO(ldiskfs_osd_mntdev);
4570
4571 @@ -227,14 +219,14 @@ index b9b4e3d..947a4b9 100644
4572 {
4573 - struct osd_device *osd = osd_dt_dev(data);
4574 - int val, rc;
4575 -+ struct seq_file *m = file->private_data;
4576 ++ struct seq_file *m = file->private_data;
4577 + struct dt_device *dt = m->private;
4578 + struct osd_device *osd = osd_dt_dev(dt);
4579 + int val, rc;
4580
4581 LASSERT(osd != NULL);
4582 if (unlikely(osd->od_mnt == NULL))
4583 -@@ -335,24 +289,26 @@ static int lprocfs_osd_wr_cache(struct file *file, const char *buffer,
4584 +@@ -335,24 +289,27 @@ static int lprocfs_osd_wr_cache(struct file *file, const char *buffer,
4585 osd->od_read_cache = !!val;
4586 return count;
4587 }
4588 @@ -263,13 +255,14 @@ index b9b4e3d..947a4b9 100644
4589 {
4590 - struct osd_device *osd = osd_dt_dev(data);
4591 - int val, rc;
4592 -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private;
4593 ++ struct seq_file *m = file->private_data;
4594 ++ struct dt_device *dt = m->private;
4595 + struct osd_device *osd = osd_dt_dev(dt);
4596 + int val, rc;
4597
4598 LASSERT(osd != NULL);
4599 if (unlikely(osd->od_mnt == NULL))
4600 -@@ -365,14 +321,16 @@ static int lprocfs_osd_wr_wcache(struct file *file, const char *buffer,
4601 +@@ -365,14 +322,17 @@ static int lprocfs_osd_wr_wcache(struct file *file, const char *buffer,
4602 osd->od_writethrough_cache = !!val;
4603 return count;
4604 }
4605 @@ -285,14 +278,15 @@ index b9b4e3d..947a4b9 100644
4606 - struct dt_device *dt = data;
4607 - struct lu_env env;
4608 - int rc;
4609 -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private;
4610 ++ struct seq_file *m = file->private_data;
4611 ++ struct dt_device *dt = m->private;
4612 + struct osd_device *osd = osd_dt_dev(dt);
4613 + struct lu_env env;
4614 + int rc;
4615
4616 LASSERT(osd != NULL);
4617 if (unlikely(osd->od_mnt == NULL))
4618 -@@ -386,20 +344,18 @@ static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer,
4619 +@@ -386,20 +346,18 @@ static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer,
4620
4621 return rc == 0 ? count : rc;
4622 }
4623 @@ -320,7 +314,7 @@ index b9b4e3d..947a4b9 100644
4624
4625 rc = lprocfs_write_helper(buffer, count, &pdo);
4626 if (rc != 0)
4627 -@@ -409,24 +365,25 @@ static int lprocfs_osd_wr_pdo(struct file *file, const char *buffer,
4628 +@@ -409,24 +367,26 @@ static int lprocfs_osd_wr_pdo(struct file *file, const char *buffer,
4629
4630 return count;
4631 }
4632 @@ -349,12 +343,13 @@ index b9b4e3d..947a4b9 100644
4633 + size_t count, loff_t *off)
4634 {
4635 - struct osd_device *dev = osd_dt_dev(data);
4636 -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private;
4637 ++ struct seq_file *m = file->private_data;
4638 ++ struct dt_device *dt = m->private;
4639 + struct osd_device *dev = osd_dt_dev(dt);
4640 int val, rc;
4641
4642 LASSERT(dev != NULL);
4643 -@@ -440,19 +397,18 @@ static int lprocfs_osd_wr_auto_scrub(struct file *file, const char *buffer,
4644 +@@ -440,19 +400,18 @@ static int lprocfs_osd_wr_auto_scrub(struct file *file, const char *buffer,
4645 dev->od_noscrub = !val;
4646 return count;
4647 }
4648 @@ -381,13 +376,11 @@ index b9b4e3d..947a4b9 100644
4649 {
4650 int track_declares_assert;
4651 int rc;
4652 -@@ -465,38 +421,39 @@ static int lprocfs_osd_wr_track_declares_assert(struct file *file,
4653 +@@ -465,40 +424,40 @@ static int lprocfs_osd_wr_track_declares_assert(struct file *file,
4654
4655 return count;
4656 }
4657 +LPROC_SEQ_FOPS(ldiskfs_osd_track_declares_assert);
4658 -+
4659 -+extern int osd_scrub_dump(struct seq_file *m, struct osd_device *dev);
4660
4661 -static int lprocfs_osd_rd_oi_scrub(char *page, char **start, off_t off,
4662 - int count, int *eof, void *data)
4663 @@ -430,12 +423,17 @@ index b9b4e3d..947a4b9 100644
4664 + size_t count, loff_t *off)
4665 {
4666 - struct osd_device *osd = osd_dt_dev(data);
4667 -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private;
4668 -+ struct osd_device *osd = osd_dt_dev(dt);
4669 - __u64 val;
4670 - int rc;
4671 +- __u64 val;
4672 +- int rc;
4673 ++ struct seq_file *m = file->private_data;
4674 ++ struct dt_device *dt = m->private;
4675 ++ struct osd_device *osd = osd_dt_dev(dt);
4676 ++ __u64 val;
4677 ++ int rc;
4678
4679 -@@ -512,24 +469,25 @@ int lprocfs_osd_wr_readcache(struct file *file, const char *buffer,
4680 + LASSERT(osd != NULL);
4681 + if (unlikely(osd->od_mnt == NULL))
4682 +@@ -512,24 +471,26 @@ int lprocfs_osd_wr_readcache(struct file *file, const char *buffer,
4683 OSD_MAX_CACHE_SIZE : val;
4684 return count;
4685 }
4686 @@ -464,12 +462,13 @@ index b9b4e3d..947a4b9 100644
4687 + size_t count, loff_t *off)
4688 {
4689 - struct osd_device *dev = osd_dt_dev(data);
4690 -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private;
4691 ++ struct seq_file *m = file->private_data;
4692 ++ struct dt_device *dt = m->private;
4693 + struct osd_device *dev = osd_dt_dev(dt);
4694 int val;
4695 int rc;
4696
4697 -@@ -544,38 +502,102 @@ static int lprocfs_osd_wr_lma_self_repair(struct file *file, const char *buffer,
4698 +@@ -544,38 +505,102 @@ static int lprocfs_osd_wr_lma_self_repair(struct file *file, const char *buffer,
4699 dev->od_lma_self_repair = !!val;
4700 return count;
4701 }
4702 @@ -602,10 +601,10 @@ index b9b4e3d..947a4b9 100644
4703 +}
4704 #endif
4705 diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c
4706 -index e558163..b5b91c8 100644
4707 +index 7d6c011..05e9f25 100644
4708 --- a/lustre/osd-ldiskfs/osd_scrub.c
4709 +++ b/lustre/osd-ldiskfs/osd_scrub.c
4710 -@@ -2551,80 +2551,69 @@ static const char *scrub_param_names[] = {
4711 +@@ -2571,134 +2571,112 @@ static const char *scrub_param_names[] = {
4712 NULL
4713 };
4714
4715 @@ -619,9 +618,11 @@ index e558163..b5b91c8 100644
4716 int i;
4717
4718 - rc = snprintf(*buf, *len, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
4719 +- if (rc <= 0)
4720 +- return -ENOSPC;
4721 + rc = seq_printf(m, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
4722 - if (rc <= 0)
4723 - return -ENOSPC;
4724 ++ if (rc < 0)
4725 ++ return rc;
4726
4727 - *buf += rc;
4728 - *len -= rc;
4729 @@ -630,13 +631,15 @@ index e558163..b5b91c8 100644
4730 bits &= ~flag;
4731 - rc = snprintf(*buf, *len, "%s%c", names[i],
4732 - bits != 0 ? ',' : '\n');
4733 -+ rc = seq_printf(m, "%s%c", names[i],
4734 -+ bits != 0 ? ',' : '\n');
4735 - if (rc <= 0)
4736 - return -ENOSPC;
4737 +- if (rc <= 0)
4738 +- return -ENOSPC;
4739 -
4740 - *buf += rc;
4741 - *len -= rc;
4742 ++ rc = seq_printf(m, "%s%c", names[i],
4743 ++ bits != 0 ? ',' : '\n');
4744 ++ if (rc < 0)
4745 ++ return rc;
4746 }
4747 }
4748 - return save - *len;
4749 @@ -654,14 +657,13 @@ index e558163..b5b91c8 100644
4750 cfs_time_current_sec() - time);
4751 else
4752 - rc = snprintf(*buf, *len, "%s: N/A\n", prefix);
4753 -+ rc = seq_printf(m, "%s: N/A\n", prefix);
4754 - if (rc <= 0)
4755 - return -ENOSPC;
4756 -
4757 +- if (rc <= 0)
4758 +- return -ENOSPC;
4759 +-
4760 - *buf += rc;
4761 - *len -= rc;
4762 -- return rc;
4763 -+ return 0;
4764 ++ rc = seq_printf(m, "%s: N/A\n", prefix);
4765 + return rc;
4766 }
4767
4768 -static int scrub_pos_dump(char **buf, int *len, __u64 pos, const char *prefix)
4769 @@ -674,34 +676,42 @@ index e558163..b5b91c8 100644
4770 + rc = seq_printf(m, "%s: "LPU64"\n", prefix, pos);
4771 else
4772 - rc = snprintf(*buf, *len, "%s: N/A\n", prefix);
4773 -+ rc = seq_printf(m, "%s: N/A\n", prefix);
4774 - if (rc <= 0)
4775 - return -ENOSPC;
4776 -
4777 +- if (rc <= 0)
4778 +- return -ENOSPC;
4779 +-
4780 - *buf += rc;
4781 - *len -= rc;
4782 ++ rc = seq_printf(m, "%s: N/A\n", prefix);
4783 return rc;
4784 }
4785
4786 -int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
4787 -+int osd_scrub_dump(struct seq_file *m,struct osd_device *dev)
4788 ++int osd_scrub_dump(struct seq_file *m, struct osd_device *dev)
4789 {
4790 struct osd_scrub *scrub = &dev->od_scrub;
4791 struct scrub_file *sf = &scrub->os_file;
4792 __u64 checked;
4793 __u64 speed;
4794 - int save = len;
4795 - int ret = -ENOSPC;
4796 +- int ret = -ENOSPC;
4797 int rc;
4798
4799 down_read(&scrub->os_rwsem);
4800 - rc = snprintf(buf, len,
4801 -+ rc = seq_printf(m,
4802 - "name: OI_scrub\n"
4803 - "magic: 0x%x\n"
4804 - "oi_files: %d\n"
4805 -@@ -2634,51 +2623,48 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
4806 - if (rc <= 0)
4807 +- "name: OI_scrub\n"
4808 +- "magic: 0x%x\n"
4809 +- "oi_files: %d\n"
4810 +- "status: %s\n",
4811 +- sf->sf_magic, (int)sf->sf_oi_count,
4812 +- scrub_status_names[sf->sf_status]);
4813 +- if (rc <= 0)
4814 ++ rc = seq_printf(m, "name: OI_scrub\n"
4815 ++ "magic: 0x%x\n"
4816 ++ "oi_files: %d\n"
4817 ++ "status: %s\n",
4818 ++ sf->sf_magic, (int)sf->sf_oi_count,
4819 ++ scrub_status_names[sf->sf_status]);
4820 ++ if (rc < 0)
4821 goto out;
4822
4823 - buf += rc;
4824 @@ -761,8 +771,12 @@ index e558163..b5b91c8 100644
4825 "updated: "LPU64"\n"
4826 "failed: "LPU64"\n"
4827 "prior_updated: "LPU64"\n"
4828 -@@ -2691,8 +2677,6 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
4829 - if (rc <= 0)
4830 +@@ -2708,11 +2686,9 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
4831 + checked, sf->sf_items_updated, sf->sf_items_failed,
4832 + sf->sf_items_updated_prior, sf->sf_items_noscrub,
4833 + sf->sf_items_igif, sf->sf_success_count);
4834 +- if (rc <= 0)
4835 ++ if (rc < 0)
4836 goto out;
4837
4838 - buf += rc;
4839 @@ -770,7 +784,7 @@ index e558163..b5b91c8 100644
4840 speed = checked;
4841 if (thread_is_running(&scrub->os_thread)) {
4842 cfs_duration_t duration = cfs_time_current() -
4843 -@@ -2705,8 +2689,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
4844 +@@ -2725,8 +2701,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
4845 do_div(new_checked, duration);
4846 if (rtime != 0)
4847 do_div(speed, rtime);
4848 @@ -780,7 +794,7 @@ index e558163..b5b91c8 100644
4849 "average_speed: "LPU64" objects/sec\n"
4850 "real-time_speed: "LPU64" objects/sec\n"
4851 "current_position: %u\n"
4852 -@@ -2719,8 +2702,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
4853 +@@ -2739,8 +2714,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
4854 } else {
4855 if (sf->sf_run_time != 0)
4856 do_div(speed, sf->sf_run_time);
4857 @@ -790,18 +804,22 @@ index e558163..b5b91c8 100644
4858 "average_speed: "LPU64" objects/sec\n"
4859 "real-time_speed: N/A\n"
4860 "current_position: N/A\n"
4861 -@@ -2732,10 +2714,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
4862 +@@ -2750,14 +2724,8 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
4863 + sf->sf_run_time, speed, scrub->os_lf_scanned,
4864 + scrub->os_lf_repaired, scrub->os_lf_failed);
4865 }
4866 - if (rc <= 0)
4867 - goto out;
4868 +- if (rc <= 0)
4869 +- goto out;
4870 -
4871 - buf += rc;
4872 - len -= rc;
4873 - ret = save - len;
4874 -+ ret = 0;
4875
4876 out:
4877 up_read(&scrub->os_rwsem);
4878 +- return ret;
4879 ++ return (rc < 0 ? -ENOSPC : 0);
4880 + }
4881 --
4882 -1.8.5.3
4883 +1.9.1
4884
4885
4886 diff --git a/sys-cluster/lustre/files/0010-LU-3319-lprocfs-client-side-cleanups.patch b/sys-cluster/lustre/files/0010-LU-3319-lprocfs-client-side-cleanups.patch
4887 deleted file mode 100644
4888 index b076a3a..0000000
4889 --- a/sys-cluster/lustre/files/0010-LU-3319-lprocfs-client-side-cleanups.patch
4890 +++ /dev/null
4891 @@ -1,463 +0,0 @@
4892 -From 48d1258335516d5335567f11f5be91ceafbbac4e Mon Sep 17 00:00:00 2001
4893 -From: James Simmons <uja.ornl@×××××.com>
4894 -Date: Tue, 21 Jan 2014 12:06:59 -0500
4895 -Subject: [PATCH 10/12] LU-3319 lprocfs: client side cleanups
4896 -
4897 -Now that all the client side seq_file patches it is
4898 -time to handle the issue that people pointed out but
4899 -were not severe enough to prevent landing. This patch
4900 -addresses all the concerns as well and move all struct
4901 -lprocfs_seq_var to be initialized C99 style.
4902 -
4903 -Change-Id: I89e8b719bd067ecf4e3cab481a2d4c62d5052af0
4904 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
4905 ----
4906 - lustre/fid/lproc_fid.c | 21 ++++++---
4907 - lustre/lmv/lproc_lmv.c | 15 ++++---
4908 - lustre/lov/lproc_lov.c | 42 ++++++++++++------
4909 - lustre/mdc/lproc_mdc.c | 52 ++++++++++++++--------
4910 - lustre/mgc/lproc_mgc.c | 25 +++++++----
4911 - lustre/obdclass/lprocfs_status.c | 1 -
4912 - lustre/obdecho/echo.c | 3 +-
4913 - lustre/osc/lproc_osc.c | 94 +++++++++++++++++++++++++++-------------
4914 - lustre/osc/osc_request.c | 2 +-
4915 - lustre/ost/ost_handler.c | 3 +-
4916 - lustre/ptlrpc/lproc_ptlrpc.c | 2 +-
4917 - lustre/quota/qmt_pool.c | 3 +-
4918 - lustre/quota/qsd_lib.c | 12 +++--
4919 - 13 files changed, 183 insertions(+), 92 deletions(-)
4920 -
4921 -diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c
4922 -index d89c4f6..3b9d170 100644
4923 ---- a/lustre/fid/lproc_fid.c
4924 -+++ b/lustre/fid/lproc_fid.c
4925 -@@ -203,9 +203,12 @@ LPROC_SEQ_FOPS(lprocfs_server_fid_width);
4926 - LPROC_SEQ_FOPS_RO(lprocfs_server_fid_server);
4927 -
4928 - struct lprocfs_seq_vars seq_server_proc_list[] = {
4929 -- { "space", &lprocfs_server_fid_space_fops },
4930 -- { "width", &lprocfs_server_fid_width_fops },
4931 -- { "server", &lprocfs_server_fid_server_fops },
4932 -+ { .name = "space",
4933 -+ .fops = &lprocfs_server_fid_space_fops },
4934 -+ { .name = "width",
4935 -+ .fops = &lprocfs_server_fid_width_fops },
4936 -+ { .name = "server",
4937 -+ .fops = &lprocfs_server_fid_server_fops },
4938 - { NULL }
4939 - };
4940 -
4941 -@@ -623,10 +626,14 @@ LPROC_SEQ_FOPS_RO(lprocfs_client_fid_server);
4942 - LPROC_SEQ_FOPS_RO(lprocfs_client_fid_fid);
4943 -
4944 - struct lprocfs_seq_vars seq_client_proc_list[] = {
4945 -- { "space", &lprocfs_client_fid_space_fops },
4946 -- { "width", &lprocfs_client_fid_width_fops },
4947 -- { "server", &lprocfs_client_fid_server_fops },
4948 -- { "fid", &lprocfs_client_fid_fid_fops },
4949 -+ { .name = "space",
4950 -+ .fops = &lprocfs_client_fid_space_fops },
4951 -+ { .name = "width",
4952 -+ .fops = &lprocfs_client_fid_width_fops },
4953 -+ { .name = "server",
4954 -+ .fops = &lprocfs_client_fid_server_fops },
4955 -+ { .name = "fid",
4956 -+ .fops = &lprocfs_client_fid_fid_fops },
4957 - { NULL }
4958 - };
4959 - #endif
4960 -diff --git a/lustre/lmv/lproc_lmv.c b/lustre/lmv/lproc_lmv.c
4961 -index eea5927..5a7271a 100644
4962 ---- a/lustre/lmv/lproc_lmv.c
4963 -+++ b/lustre/lmv/lproc_lmv.c
4964 -@@ -203,11 +203,16 @@ static int lmv_target_seq_open(struct inode *inode, struct file *file)
4965 - LPROC_SEQ_FOPS_RO_TYPE(lmv, uuid);
4966 -
4967 - struct lprocfs_seq_vars lprocfs_lmv_obd_vars[] = {
4968 -- { "numobd", &lmv_numobd_fops },
4969 -- { "placement", &lmv_placement_fops },
4970 -- { "activeobd", &lmv_activeobd_fops },
4971 -- { "uuid", &lmv_uuid_fops },
4972 -- { "desc_uuid", &lmv_desc_uuid_fops },
4973 -+ { .name = "numobd",
4974 -+ .fops = &lmv_numobd_fops },
4975 -+ { .name = "placement",
4976 -+ .fops = &lmv_placement_fops },
4977 -+ { .name = "activeobd",
4978 -+ .fops = &lmv_activeobd_fops },
4979 -+ { .name = "uuid",
4980 -+ .fops = &lmv_uuid_fops },
4981 -+ { .name = "desc_uuid",
4982 -+ .fops = &lmv_desc_uuid_fops },
4983 - { 0 }
4984 - };
4985 -
4986 -diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c
4987 -index e400faf..7786513 100644
4988 ---- a/lustre/lov/lproc_lov.c
4989 -+++ b/lustre/lov/lproc_lov.c
4990 -@@ -263,20 +263,34 @@ LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesfree);
4991 - LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesavail);
4992 -
4993 - struct lprocfs_seq_vars lprocfs_lov_obd_vars[] = {
4994 -- { "uuid", &lov_uuid_fops },
4995 -- { "stripesize", &lov_stripesize_fops },
4996 -- { "stripeoffset", &lov_stripeoffset_fops },
4997 -- { "stripecount", &lov_stripecount_fops },
4998 -- { "stripetype", &lov_stripetype_fops },
4999 -- { "numobd", &lov_numobd_fops },
5000 -- { "activeobd", &lov_activeobd_fops },
5001 -- { "filestotal", &lov_filestotal_fops },
5002 -- { "filesfree", &lov_filesfree_fops },
5003 -- { "blocksize", &lov_blksize_fops },
5004 -- { "kbytestotal", &lov_kbytestotal_fops },
5005 -- { "kbytesfree", &lov_kbytesfree_fops },
5006 -- { "kbytesavail", &lov_kbytesavail_fops },
5007 -- { "desc_uuid", &lov_desc_uuid_fops },
5008 -+ { .name = "uuid",
5009 -+ .fops = &lov_uuid_fops },
5010 -+ { .name = "stripesize",
5011 -+ .fops = &lov_stripesize_fops },
5012 -+ { .name = "stripeoffset",
5013 -+ .fops = &lov_stripeoffset_fops },
5014 -+ { .name = "stripecount",
5015 -+ .fops = &lov_stripecount_fops },
5016 -+ { .name = "stripetype",
5017 -+ .fops = &lov_stripetype_fops },
5018 -+ { .name = "numobd",
5019 -+ .fops = &lov_numobd_fops },
5020 -+ { .name = "activeobd",
5021 -+ .fops = &lov_activeobd_fops },
5022 -+ { .name = "filestotal",
5023 -+ .fops = &lov_filestotal_fops },
5024 -+ { .name = "filesfree",
5025 -+ .fops = &lov_filesfree_fops },
5026 -+ { .name = "blocksize",
5027 -+ .fops = &lov_blksize_fops },
5028 -+ { .name = "kbytestotal",
5029 -+ .fops = &lov_kbytestotal_fops },
5030 -+ { .name = "kbytesfree",
5031 -+ .fops = &lov_kbytesfree_fops },
5032 -+ { .name = "kbytesavail",
5033 -+ .fops = &lov_kbytesavail_fops },
5034 -+ { .name = "desc_uuid",
5035 -+ .fops = &lov_desc_uuid_fops },
5036 - { 0 }
5037 - };
5038 -
5039 -diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c
5040 -index cba4f61..69e377f 100644
5041 ---- a/lustre/mdc/lproc_mdc.c
5042 -+++ b/lustre/mdc/lproc_mdc.c
5043 -@@ -103,29 +103,47 @@ LPROC_SEQ_FOPS_RW_TYPE(mdc, import);
5044 - LPROC_SEQ_FOPS_RW_TYPE(mdc, pinger_recov);
5045 -
5046 - struct lprocfs_seq_vars lprocfs_mdc_obd_vars[] = {
5047 -- { "uuid", &mdc_uuid_fops, 0, 0 },
5048 -- { "ping", &mdc_ping_fops, 0, 0222 },
5049 -- { "connect_flags", &mdc_connect_flags_fops,0, 0 },
5050 -- { "blocksize", &mdc_blksize_fops, 0, 0 },
5051 -- { "kbytestotal", &mdc_kbytestotal_fops, 0, 0 },
5052 -- { "kbytesfree", &mdc_kbytesfree_fops, 0, 0 },
5053 -- { "kbytesavail", &mdc_kbytesavail_fops, 0, 0 },
5054 -- { "filestotal", &mdc_filestotal_fops, 0, 0 },
5055 -- { "filesfree", &mdc_filesfree_fops, 0, 0 },
5056 -- { "mds_server_uuid", &mdc_server_uuid_fops, 0, 0 },
5057 -- { "mds_conn_uuid", &mdc_conn_uuid_fops, 0, 0 },
5058 -+ { .name = "uuid",
5059 -+ .fops = &mdc_uuid_fops },
5060 -+ { .name = "ping",
5061 -+ .fops = &mdc_ping_fops,
5062 -+ .proc_mode = 0222 },
5063 -+ { .name = "connect_flags",
5064 -+ .fops = &mdc_connect_flags_fops },
5065 -+ { .name = "blocksize",
5066 -+ .fops = &mdc_blksize_fops },
5067 -+ { .name = "kbytestotal",
5068 -+ .fops = &mdc_kbytestotal_fops },
5069 -+ { .name = "kbytesfree",
5070 -+ .fops = &mdc_kbytesfree_fops },
5071 -+ { .name = "kbytesavail",
5072 -+ .fops = &mdc_kbytesavail_fops },
5073 -+ { .name = "filestotal",
5074 -+ .fops = &mdc_filestotal_fops },
5075 -+ { .name = "filesfree",
5076 -+ .fops = &mdc_filesfree_fops },
5077 -+ { .name = "mds_server_uuid",
5078 -+ .fops = &mdc_server_uuid_fops },
5079 -+ { .name = "mds_conn_uuid",
5080 -+ .fops = &mdc_conn_uuid_fops },
5081 - /*
5082 - * FIXME: below proc entry is provided, but not in used, instead
5083 - * sbi->sb_md_brw_size is used, the per obd variable should be used
5084 - * when CMD is enabled, and dir pages are managed in MDC layer.
5085 - * Remember to enable proc write function.
5086 - */
5087 -- { "max_pages_per_rpc", &mdc_obd_max_pages_per_rpc_fops },
5088 -- { "max_rpcs_in_flight", &mdc_max_rpcs_in_flight_fops },
5089 -- { "timeouts", &mdc_timeouts_fops },
5090 -- { "import", &mdc_import_fops },
5091 -- { "state", &mdc_state_fops },
5092 -- { "pinger_recov", &mdc_pinger_recov_fops },
5093 -+ { .name = "max_pages_per_rpc",
5094 -+ .fops = &mdc_obd_max_pages_per_rpc_fops },
5095 -+ { .name = "max_rpcs_in_flight",
5096 -+ .fops = &mdc_max_rpcs_in_flight_fops },
5097 -+ { .name = "timeouts",
5098 -+ .fops = &mdc_timeouts_fops },
5099 -+ { .name = "import",
5100 -+ .fops = &mdc_import_fops },
5101 -+ { .name = "state",
5102 -+ .fops = &mdc_state_fops },
5103 -+ { .name = "pinger_recov",
5104 -+ .fops = &mdc_pinger_recov_fops },
5105 - { 0 }
5106 - };
5107 - #endif /* LPROCFS */
5108 -diff --git a/lustre/mgc/lproc_mgc.c b/lustre/mgc/lproc_mgc.c
5109 -index 648b6e5..f818def 100644
5110 ---- a/lustre/mgc/lproc_mgc.c
5111 -+++ b/lustre/mgc/lproc_mgc.c
5112 -@@ -59,14 +59,23 @@ static int mgc_ir_state_seq_show(struct seq_file *m, void *v)
5113 - LPROC_SEQ_FOPS_RO(mgc_ir_state);
5114 -
5115 - struct lprocfs_seq_vars lprocfs_mgc_obd_vars[] = {
5116 -- { "uuid", &mgc_uuid_fops, 0, 0 },
5117 -- { "ping", &mgc_ping_fops, 0, 0222 },
5118 -- { "connect_flags", &mgc_connect_flags_fops,0, 0 },
5119 -- { "mgs_server_uuid", &mgc_server_uuid_fops, 0, 0 },
5120 -- { "mgs_conn_uuid", &mgc_conn_uuid_fops, 0, 0 },
5121 -- { "import", &mgc_import_fops, 0, 0 },
5122 -- { "state", &mgc_state_fops, 0, 0 },
5123 -- { "ir_state", &mgc_ir_state_fops, 0, 0 },
5124 -+ { .name = "uuid",
5125 -+ .fops = &mgc_uuid_fops },
5126 -+ { .name = "ping",
5127 -+ .fops = &mgc_ping_fops,
5128 -+ .proc_mode = 0222 },
5129 -+ { .name = "connect_flags",
5130 -+ .fops = &mgc_connect_flags_fops },
5131 -+ { .name = "mgs_server_uuid",
5132 -+ .fops = &mgc_server_uuid_fops },
5133 -+ { .name = "mgs_conn_uuid",
5134 -+ .fops = &mgc_conn_uuid_fops },
5135 -+ { .name = "import",
5136 -+ .fops = &mgc_import_fops },
5137 -+ { .name = "state",
5138 -+ .fops = &mgc_state_fops },
5139 -+ { .name = "ir_state",
5140 -+ .fops = &mgc_ir_state_fops },
5141 - { 0 }
5142 - };
5143 - #endif /* LPROCFS */
5144 -diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c
5145 -index 5b72a5a..551f629 100644
5146 ---- a/lustre/obdclass/lprocfs_status.c
5147 -+++ b/lustre/obdclass/lprocfs_status.c
5148 -@@ -2583,7 +2583,6 @@ void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
5149 - EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
5150 -
5151 - #ifdef HAVE_SERVER_SUPPORT
5152 --/* No one appears to be using this ?? */
5153 - int lprocfs_exp_nid_seq_show(struct seq_file *m, void *data)
5154 - {
5155 - struct obd_export *exp = m->private;
5156 -diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c
5157 -index 6d63aff..8563e68 100644
5158 ---- a/lustre/obdecho/echo.c
5159 -+++ b/lustre/obdecho/echo.c
5160 -@@ -561,7 +561,8 @@ commitrw_cleanup:
5161 -
5162 - LPROC_SEQ_FOPS_RO_TYPE(echo, uuid);
5163 - static struct lprocfs_seq_vars lprocfs_echo_obd_vars[] = {
5164 -- { "uuid", &echo_uuid_fops },
5165 -+ { .name = "uuid",
5166 -+ .fops = &echo_uuid_fops },
5167 - { 0 }
5168 - };
5169 -
5170 -diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c
5171 -index d6e3703..ccfc212 100644
5172 ---- a/lustre/osc/lproc_osc.c
5173 -+++ b/lustre/osc/lproc_osc.c
5174 -@@ -543,37 +543,69 @@ LPROC_SEQ_FOPS_RW_TYPE(osc, import);
5175 - LPROC_SEQ_FOPS_RW_TYPE(osc, pinger_recov);
5176 -
5177 - struct lprocfs_seq_vars lprocfs_osc_obd_vars[] = {
5178 -- { "uuid", &osc_uuid_fops },
5179 -- { "ping", &osc_ping_fops, 0, 0222 },
5180 -- { "connect_flags", &osc_connect_flags_fops },
5181 -- { "blocksize", &osc_blksize_fops },
5182 -- { "kbytestotal", &osc_kbytestotal_fops },
5183 -- { "kbytesfree", &osc_kbytesfree_fops },
5184 -- { "kbytesavail", &osc_kbytesavail_fops },
5185 -- { "filestotal", &osc_filestotal_fops },
5186 -- { "filesfree", &osc_filesfree_fops },
5187 -- { "ost_server_uuid", &osc_server_uuid_fops },
5188 -- { "ost_conn_uuid", &osc_conn_uuid_fops },
5189 -- { "active", &osc_active_fops },
5190 -- { "max_pages_per_rpc", &osc_obd_max_pages_per_rpc_fops },
5191 -- { "max_rpcs_in_flight", &osc_max_rpcs_in_flight_fops },
5192 -- { "destroys_in_flight", &osc_destroys_in_flight_fops },
5193 -- { "max_dirty_mb", &osc_max_dirty_mb_fops },
5194 -- { "osc_cached_mb", &osc_cached_mb_fops },
5195 -- { "cur_dirty_bytes", &osc_cur_dirty_bytes_fops },
5196 -- { "cur_grant_bytes", &osc_cur_grant_bytes_fops },
5197 -- { "cur_lost_grant_bytes", &osc_cur_lost_grant_bytes_fops },
5198 -- { "grant_shrink_interval", &osc_grant_shrink_interval_fops },
5199 -- { "checksums", &osc_checksum_fops },
5200 -- { "checksum_type", &osc_checksum_type_fops },
5201 -- { "resend_count", &osc_resend_count_fops },
5202 -- { "timeouts", &osc_timeouts_fops },
5203 -- { "contention_seconds", &osc_contention_seconds_fops },
5204 -- { "lockless_truncate", &osc_lockless_truncate_fops },
5205 -- { "import", &osc_import_fops },
5206 -- { "state", &osc_state_fops },
5207 -- { "pinger_recov", &osc_pinger_recov_fops },
5208 -- { "unstable_stats", &osc_unstable_stats_fops },
5209 -+ { .name = "uuid",
5210 -+ .fops = &osc_uuid_fops },
5211 -+ { .name = "ping",
5212 -+ .fops = &osc_ping_fops,
5213 -+ .proc_mode = 0222 },
5214 -+ { .name = "connect_flags",
5215 -+ .fops = &osc_connect_flags_fops },
5216 -+ { .name = "blocksize",
5217 -+ .fops = &osc_blksize_fops },
5218 -+ { .name = "kbytestotal",
5219 -+ .fops = &osc_kbytestotal_fops },
5220 -+ { .name = "kbytesfree",
5221 -+ .fops = &osc_kbytesfree_fops },
5222 -+ { .name = "kbytesavail",
5223 -+ .fops = &osc_kbytesavail_fops },
5224 -+ { .name = "filestotal",
5225 -+ .fops = &osc_filestotal_fops },
5226 -+ { .name = "filesfree",
5227 -+ .fops = &osc_filesfree_fops },
5228 -+ { .name = "ost_server_uuid",
5229 -+ .fops = &osc_server_uuid_fops },
5230 -+ { .name = "ost_conn_uuid",
5231 -+ .fops = &osc_conn_uuid_fops },
5232 -+ { .name = "active",
5233 -+ .fops = &osc_active_fops },
5234 -+ { .name = "max_pages_per_rpc",
5235 -+ .fops = &osc_obd_max_pages_per_rpc_fops },
5236 -+ { .name = "max_rpcs_in_flight",
5237 -+ .fops = &osc_max_rpcs_in_flight_fops },
5238 -+ { .name = "destroys_in_flight",
5239 -+ .fops = &osc_destroys_in_flight_fops },
5240 -+ { .name = "max_dirty_mb",
5241 -+ .fops = &osc_max_dirty_mb_fops },
5242 -+ { .name = "osc_cached_mb",
5243 -+ .fops = &osc_cached_mb_fops },
5244 -+ { .name = "cur_dirty_bytes",
5245 -+ .fops = &osc_cur_dirty_bytes_fops },
5246 -+ { .name = "cur_grant_bytes",
5247 -+ .fops = &osc_cur_grant_bytes_fops },
5248 -+ { .name = "cur_lost_grant_bytes",
5249 -+ .fops = &osc_cur_lost_grant_bytes_fops },
5250 -+ { .name = "grant_shrink_interval",
5251 -+ .fops = &osc_grant_shrink_interval_fops },
5252 -+ { .name = "checksums",
5253 -+ .fops = &osc_checksum_fops },
5254 -+ { .name = "checksum_type",
5255 -+ .fops = &osc_checksum_type_fops },
5256 -+ { .name = "resend_count",
5257 -+ .fops = &osc_resend_count_fops },
5258 -+ { .name = "timeouts",
5259 -+ .fops = &osc_timeouts_fops },
5260 -+ { .name = "contention_seconds",
5261 -+ .fops = &osc_contention_seconds_fops },
5262 -+ { .name = "lockless_truncate",
5263 -+ .fops = &osc_lockless_truncate_fops },
5264 -+ { .name = "import",
5265 -+ .fops = &osc_import_fops },
5266 -+ { .name = "state",
5267 -+ .fops = &osc_state_fops },
5268 -+ { .name = "pinger_recov",
5269 -+ .fops = &osc_pinger_recov_fops },
5270 -+ { .name = "unstable_stats",
5271 -+ .fops = &osc_unstable_stats_fops },
5272 - { 0 }
5273 - };
5274 -
5275 -diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c
5276 -index b9d1b71..f95fb55 100644
5277 ---- a/lustre/osc/osc_request.c
5278 -+++ b/lustre/osc/osc_request.c
5279 -@@ -3669,7 +3669,7 @@ int osc_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg)
5280 - {
5281 - int rc = class_process_proc_seq_param(PARAM_OSC, obd->obd_vars,
5282 - lcfg, obd);
5283 -- return(rc > 0 ? 0: rc);
5284 -+ return rc > 0 ? 0: rc;
5285 - }
5286 -
5287 - static int osc_process_config(struct obd_device *obd, obd_count len, void *buf)
5288 -diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c
5289 -index a39381f..d5458b2 100644
5290 ---- a/lustre/ost/ost_handler.c
5291 -+++ b/lustre/ost/ost_handler.c
5292 -@@ -75,7 +75,8 @@ static struct cfs_cpt_table *ost_io_cptable;
5293 - LPROC_SEQ_FOPS_RO_TYPE(ost, uuid);
5294 -
5295 - static struct lprocfs_seq_vars lprocfs_ost_obd_vars[] = {
5296 -- { "uuid", &ost_uuid_fops },
5297 -+ { .name = "uuid",
5298 -+ .fops = &ost_uuid_fops },
5299 - { 0 }
5300 - };
5301 - #endif /* LPROCFS */
5302 -diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c
5303 -index 8e5a397..bf21958 100644
5304 ---- a/lustre/ptlrpc/lproc_ptlrpc.c
5305 -+++ b/lustre/ptlrpc/lproc_ptlrpc.c
5306 -@@ -1382,7 +1382,7 @@ lprocfs_import_seq_write(struct file *file, const char *buffer, size_t count,
5307 -
5308 - *ptr = 0;
5309 - do_reconn = 0;
5310 -- ptr += strlen("::");
5311 -+ ptr += 2; /* Skip :: */
5312 - inst = simple_strtol(ptr, &endptr, 10);
5313 - if (*endptr) {
5314 - CERROR("config: wrong instance # %s\n", ptr);
5315 -diff --git a/lustre/quota/qmt_pool.c b/lustre/quota/qmt_pool.c
5316 -index afd450c..df6d6fc 100644
5317 ---- a/lustre/quota/qmt_pool.c
5318 -+++ b/lustre/quota/qmt_pool.c
5319 -@@ -171,7 +171,8 @@ static int qpi_state_seq_show(struct seq_file *m, void *data)
5320 - LPROC_SEQ_FOPS_RO(qpi_state);
5321 -
5322 - static struct lprocfs_seq_vars lprocfs_quota_qpi_vars[] = {
5323 -- { "info", &qpi_state_fops },
5324 -+ { .name = "info",
5325 -+ .fops = &qpi_state_fops },
5326 - { NULL }
5327 - };
5328 -
5329 -diff --git a/lustre/quota/qsd_lib.c b/lustre/quota/qsd_lib.c
5330 -index 990cfee..573473c 100644
5331 ---- a/lustre/quota/qsd_lib.c
5332 -+++ b/lustre/quota/qsd_lib.c
5333 -@@ -208,10 +208,14 @@ qsd_timeout_seq_write(struct file *file, const char *buffer,
5334 - LPROC_SEQ_FOPS(qsd_timeout);
5335 -
5336 - static struct lprocfs_seq_vars lprocfs_quota_qsd_vars[] = {
5337 -- { "info", &qsd_state_fops },
5338 -- { "enabled", &qsd_enabled_fops },
5339 -- { "force_reint", &qsd_force_reint_fops },
5340 -- { "timeout", &qsd_timeout_fops },
5341 -+ { .name = "info",
5342 -+ .fops = &qsd_state_fops },
5343 -+ { .name = "enabled",
5344 -+ .fops = &qsd_enabled_fops },
5345 -+ { .name = "force_reint",
5346 -+ .fops = &qsd_force_reint_fops },
5347 -+ { .name = "timeout",
5348 -+ .fops = &qsd_timeout_fops },
5349 - { NULL }
5350 - };
5351 -
5352 ---
5353 -1.8.5.3
5354 -
5355
5356 diff --git a/sys-cluster/lustre/files/0011-LU-3974-llite-use-new-struct-dir_context.patch b/sys-cluster/lustre/files/0011-LU-3974-llite-use-new-struct-dir_context.patch
5357 deleted file mode 100644
5358 index 5b3983d..0000000
5359 --- a/sys-cluster/lustre/files/0011-LU-3974-llite-use-new-struct-dir_context.patch
5360 +++ /dev/null
5361 @@ -1,254 +0,0 @@
5362 -From b3af9f9fde020df881b52b059a9e0d5d2c6ccfb9 Mon Sep 17 00:00:00 2001
5363 -From: James Simmons <uja.ornl@×××××.com>
5364 -Date: Mon, 20 Jan 2014 21:23:00 -0500
5365 -Subject: [PATCH 11/12] LU-3974 llite: use new struct dir_context
5366 -
5367 -The readdir and nfs code over time has added more
5368 -parameters to be passed to be processed. For the 3.11
5369 -kernel a new struct dir_context was introduced to
5370 -minimize the impact of future expansion. This patch
5371 -addresses this change.
5372 -
5373 -Conflicts:
5374 - lustre/llite/dir.c
5375 -
5376 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
5377 -Change-Id: Ib42bf8cb06635a2a64e63b294d79e66ac82a1a5b
5378 -Signed-off-by: Alexey Shvetsov <alexxy@g.o>
5379 ----
5380 - lustre/autoconf/lustre-core.m4 | 20 ++++++++++++++++
5381 - lustre/llite/dir.c | 54 ++++++++++++++++++++++++++++++++----------
5382 - lustre/llite/llite_internal.h | 14 ++++++++---
5383 - lustre/llite/llite_nfs.c | 17 +++++++++----
5384 - 4 files changed, 85 insertions(+), 20 deletions(-)
5385 -
5386 -diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
5387 -index e6207c9..f44a277 100644
5388 ---- a/lustre/autoconf/lustre-core.m4
5389 -+++ b/lustre/autoconf/lustre-core.m4
5390 -@@ -1349,6 +1349,25 @@ LB_LINUX_TRY_COMPILE([
5391 - ])
5392 -
5393 - #
5394 -+# 3.11 readdir now takes the new struct dir_context
5395 -+#
5396 -+AC_DEFUN([LC_HAVE_DIR_CONTEXT],
5397 -+[AC_MSG_CHECKING([if dir_context exist])
5398 -+LB_LINUX_TRY_COMPILE([
5399 -+ #include <linux/fs.h>
5400 -+],[
5401 -+ struct dir_context ctx;
5402 -+
5403 -+ ctx.pos = 0;
5404 -+],[
5405 -+ AC_DEFINE(HAVE_DIR_CONTEXT, 1, [dir_context exist])
5406 -+ AC_MSG_RESULT([yes])
5407 -+],[
5408 -+ AC_MSG_RESULT([no])
5409 -+])
5410 -+])
5411 -+
5412 -+#
5413 - # 3.11 dentry_operations.d_compare() taken 5 arguments.
5414 - #
5415 - AC_DEFUN([LC_D_COMPARE_5ARGS],
5416 -@@ -1523,6 +1542,7 @@ AC_DEFUN([LC_PROG_LINUX],
5417 - LC_BLKDEV_RELEASE_RETURN_INT
5418 -
5419 - # 3.11
5420 -+ LC_HAVE_DIR_CONTEXT
5421 - LC_D_COMPARE_5ARGS
5422 - LC_HAVE_DCOUNT
5423 -
5424 -diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c
5425 -index 6a1e3c5..05639f0 100644
5426 ---- a/lustre/llite/dir.c
5427 -+++ b/lustre/llite/dir.c
5428 -@@ -195,9 +195,16 @@ struct lu_dirent *ll_dir_entry_next(struct inode *dir,
5429 - return entry;
5430 - }
5431 -
5432 -+
5433 -+#ifdef HAVE_DIR_CONTEXT
5434 -+int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
5435 -+ struct dir_context *ctx)
5436 -+{
5437 -+#else
5438 - int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
5439 - void *cookie, filldir_t filldir)
5440 - {
5441 -+#endif
5442 - struct ll_sb_info *sbi = ll_i2sbi(inode);
5443 - struct ll_dir_chain chain;
5444 - struct lu_dirent *ent;
5445 -@@ -241,12 +248,17 @@ int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
5446 - fid_le_to_cpu(&fid, &ent->lde_fid);
5447 - ino = cl_fid_build_ino(&fid, api32);
5448 - type = ll_dirent_type_get(ent);
5449 -+
5450 -+#ifdef HAVE_DIR_CONTEXT
5451 - /* For 'll_nfs_get_name_filldir()', it will try
5452 - * to access the 'ent' through its 'lde_name',
5453 - * so the parameter 'name' for 'filldir()' must
5454 - * be part of the 'ent'. */
5455 -+ done = !dir_emit(ctx, ent->lde_name, namelen, ino, type);
5456 -+#else
5457 - done = filldir(cookie, ent->lde_name, namelen, lhash,
5458 - ino, type);
5459 -+#endif
5460 - if (done) {
5461 - if (op_data->op_hash_offset != MDS_DIR_END_OFF)
5462 - op_data->op_hash_offset = last_hash;
5463 -@@ -268,7 +280,11 @@ int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
5464 - RETURN(rc);
5465 - }
5466 -
5467 -+#ifdef HAVE_DIR_CONTEXT
5468 -+static int ll_iterate(struct file *filp, struct dir_context *ctx)
5469 -+#else
5470 - static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
5471 -+#endif
5472 - {
5473 - struct inode *inode = filp->f_dentry->d_inode;
5474 - struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp);
5475 -@@ -305,22 +321,32 @@ static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
5476 -
5477 - op_data->op_hash_offset = pos;
5478 - op_data->op_max_pages = sbi->ll_md_brw_size >> PAGE_CACHE_SHIFT;
5479 -+#ifdef HAVE_DIR_CONTEXT
5480 -+ ctx->pos = pos;
5481 -+ rc = ll_dir_read(inode, op_data, ctx);
5482 -+ pos = ctx->pos;
5483 -+#else
5484 - rc = ll_dir_read(inode, op_data, cookie, filldir);
5485 -+#endif
5486 - if (lfd != NULL)
5487 - lfd->lfd_pos = op_data->op_hash_offset;
5488 -
5489 - if (pos == MDS_DIR_END_OFF) {
5490 - if (api32)
5491 -- filp->f_pos = LL_DIR_END_OFF_32BIT;
5492 -+ pos = LL_DIR_END_OFF_32BIT;
5493 - else
5494 -- filp->f_pos = LL_DIR_END_OFF;
5495 -+ pos = LL_DIR_END_OFF;
5496 - } else {
5497 - if (api32 && hash64)
5498 -- filp->f_pos = op_data->op_hash_offset >> 32;
5499 -+ pos = op_data->op_hash_offset >> 32;
5500 - else
5501 -- filp->f_pos = op_data->op_hash_offset;
5502 -+ pos = op_data->op_hash_offset;
5503 - }
5504 --
5505 -+#ifdef HAVE_DIR_CONTEXT
5506 -+ ctx->pos = pos;
5507 -+#else
5508 -+ filp->f_pos = pos;
5509 -+#endif
5510 - ll_finish_md_op_data(op_data);
5511 - filp->f_version = inode->i_version;
5512 - #ifdef HAVE_TOUCH_ATIME_1ARG
5513 -@@ -1809,11 +1835,15 @@ int ll_dir_release(struct inode *inode, struct file *file)
5514 - }
5515 -
5516 - struct file_operations ll_dir_operations = {
5517 -- .llseek = ll_dir_seek,
5518 -- .open = ll_dir_open,
5519 -- .release = ll_dir_release,
5520 -- .read = generic_read_dir,
5521 -- .readdir = ll_readdir,
5522 -- .unlocked_ioctl = ll_dir_ioctl,
5523 -- .fsync = ll_fsync,
5524 -+ .llseek = ll_dir_seek,
5525 -+ .open = ll_dir_open,
5526 -+ .release = ll_dir_release,
5527 -+ .read = generic_read_dir,
5528 -+#ifdef HAVE_DIR_CONTEXT
5529 -+ .iterate = ll_iterate,
5530 -+#else
5531 -+ .readdir = ll_readdir,
5532 -+#endif
5533 -+ .unlocked_ioctl = ll_dir_ioctl,
5534 -+ .fsync = ll_fsync,
5535 - };
5536 -diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
5537 -index 59ecdfb..148f6fa 100644
5538 ---- a/lustre/llite/llite_internal.h
5539 -+++ b/lustre/llite/llite_internal.h
5540 -@@ -92,9 +92,12 @@ extern struct file_operations ll_pgcache_seq_fops;
5541 - #define REMOTE_PERM_HASHSIZE 16
5542 -
5543 - struct ll_getname_data {
5544 -- char *lgd_name; /* points to a buffer with NAME_MAX+1 size */
5545 -- struct lu_fid lgd_fid; /* target fid we are looking for */
5546 -- int lgd_found; /* inode matched? */
5547 -+#ifdef HAVE_DIR_CONTEXT
5548 -+ struct dir_context ctx;
5549 -+#endif
5550 -+ char *lgd_name; /* points to a buffer with NAME_MAX+1 size */
5551 -+ struct lu_fid lgd_fid; /* target fid we are looking for */
5552 -+ int lgd_found; /* inode matched? */
5553 - };
5554 -
5555 - /* llite setxid/access permission for user on remote client */
5556 -@@ -726,8 +729,13 @@ static void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count) {}
5557 - /* llite/dir.c */
5558 - extern struct file_operations ll_dir_operations;
5559 - extern struct inode_operations ll_dir_inode_operations;
5560 -+#ifdef HAVE_DIR_CONTEXT
5561 -+int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
5562 -+ struct dir_context *ctx);
5563 -+#else
5564 - int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
5565 - void *cookie, filldir_t filldir);
5566 -+#endif
5567 - int ll_get_mdt_idx(struct inode *inode);
5568 -
5569 - struct lu_dirent *ll_dir_entry_start(struct inode *dir,
5570 -diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c
5571 -index f96d17e..713e846 100644
5572 ---- a/lustre/llite/llite_nfs.c
5573 -+++ b/lustre/llite/llite_nfs.c
5574 -@@ -230,7 +230,14 @@ static int ll_get_name(struct dentry *dentry, char *name,
5575 - struct dentry *child)
5576 - {
5577 - struct inode *dir = dentry->d_inode;
5578 -- struct ll_getname_data lgd;
5579 -+ struct ll_getname_data lgd = {
5580 -+ .lgd_name = name,
5581 -+ .lgd_fid = ll_i2info(child->d_inode)->lli_fid,
5582 -+#ifdef HAVE_DIR_CONTEXT
5583 -+ .ctx.actor = ll_nfs_get_name_filldir,
5584 -+#endif
5585 -+ .lgd_found = 0,
5586 -+ };
5587 - struct md_op_data *op_data;
5588 - int rc;
5589 - ENTRY;
5590 -@@ -241,10 +248,6 @@ static int ll_get_name(struct dentry *dentry, char *name,
5591 - if (!dir->i_fop)
5592 - GOTO(out, rc = -EINVAL);
5593 -
5594 -- lgd.lgd_name = name;
5595 -- lgd.lgd_fid = ll_i2info(child->d_inode)->lli_fid;
5596 -- lgd.lgd_found = 0;
5597 --
5598 - op_data = ll_prep_md_op_data(NULL, dir, dir, NULL, 0, 0,
5599 - LUSTRE_OPC_ANY, dir);
5600 - if (IS_ERR(op_data))
5601 -@@ -254,7 +257,11 @@ static int ll_get_name(struct dentry *dentry, char *name,
5602 - op_data->op_max_pages =
5603 - ll_i2sbi(dir)->ll_md_brw_size >> PAGE_CACHE_SHIFT;
5604 - mutex_lock(&dir->i_mutex);
5605 -+#ifdef HAVE_DIR_CONTEXT
5606 -+ rc = ll_dir_read(dir, op_data, &lgd.ctx);
5607 -+#else
5608 - rc = ll_dir_read(dir, op_data, &lgd, ll_nfs_get_name_filldir);
5609 -+#endif
5610 - mutex_unlock(&dir->i_mutex);
5611 - ll_finish_md_op_data(op_data);
5612 - if (!rc && !lgd.lgd_found)
5613 ---
5614 -1.8.5.3
5615 -
5616
5617 diff --git a/sys-cluster/lustre/files/0012-LU-3974-llite-invalidatepage-api-changed.patch b/sys-cluster/lustre/files/0012-LU-3974-llite-invalidatepage-api-changed.patch
5618 deleted file mode 100644
5619 index 90e558e..0000000
5620 --- a/sys-cluster/lustre/files/0012-LU-3974-llite-invalidatepage-api-changed.patch
5621 +++ /dev/null
5622 @@ -1,134 +0,0 @@
5623 -From 95cacafafbc5bc0ec28bbf7898df28bb0f0295e6 Mon Sep 17 00:00:00 2001
5624 -From: James Simmons <uja.ornl@×××××.com>
5625 -Date: Tue, 24 Sep 2013 12:29:47 -0400
5626 -Subject: [PATCH 12/12] LU-3974 llite: invalidatepage api changed
5627 -
5628 -Until recently invalidating pages from the buffer cache
5629 -was dependent only on the page passed in and the start
5630 -in the page to invalidate. Starting with the 3.11 kernel
5631 -you can also specify the length of the data in the page
5632 -to invalidate. This patch enables us to handle the new
5633 -case.
5634 -
5635 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
5636 -Change-Id: Iedf458b20b2604bc3099d5ae38bf0ad07df83bd3
5637 ----
5638 - lustre/autoconf/lustre-core.m4 | 20 ++++++++++++++++++++
5639 - lustre/include/linux/lustre_patchless_compat.h | 19 +++++++++++--------
5640 - lustre/llite/rw26.c | 24 +++++++++++++++++-------
5641 - 3 files changed, 48 insertions(+), 15 deletions(-)
5642 -
5643 -diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
5644 -index f44a277..5409fde 100644
5645 ---- a/lustre/autoconf/lustre-core.m4
5646 -+++ b/lustre/autoconf/lustre-core.m4
5647 -@@ -1349,6 +1349,25 @@ LB_LINUX_TRY_COMPILE([
5648 - ])
5649 -
5650 - #
5651 -+# 3.11 invalidatepage requires the length of the range to invalidate
5652 -+#
5653 -+AC_DEFUN([LC_INVALIDATE_RANGE],
5654 -+[AC_MSG_CHECKING([if address_space_operations.invalidatepage requires 3 arguments])
5655 -+LB_LINUX_TRY_COMPILE([
5656 -+ #include <linux/fs.h>
5657 -+],[
5658 -+ struct address_space_operations a_ops;
5659 -+
5660 -+ a_ops.invalidatepage(NULL,0,0);
5661 -+],[
5662 -+ AC_DEFINE(HAVE_INVALIDATE_RANGE, 1, [address_space_operations.invalidatepage needs 3 arguments])
5663 -+ AC_MSG_RESULT([yes])
5664 -+],[
5665 -+ AC_MSG_RESULT([no])
5666 -+])
5667 -+])
5668 -+
5669 -+#
5670 - # 3.11 readdir now takes the new struct dir_context
5671 - #
5672 - AC_DEFUN([LC_HAVE_DIR_CONTEXT],
5673 -@@ -1542,6 +1561,7 @@ AC_DEFUN([LC_PROG_LINUX],
5674 - LC_BLKDEV_RELEASE_RETURN_INT
5675 -
5676 - # 3.11
5677 -+ LC_INVALIDATE_RANGE
5678 - LC_HAVE_DIR_CONTEXT
5679 - LC_D_COMPARE_5ARGS
5680 - LC_HAVE_DCOUNT
5681 -diff --git a/lustre/include/linux/lustre_patchless_compat.h b/lustre/include/linux/lustre_patchless_compat.h
5682 -index 747bd4d..5b7bab6 100644
5683 ---- a/lustre/include/linux/lustre_patchless_compat.h
5684 -+++ b/lustre/include/linux/lustre_patchless_compat.h
5685 -@@ -78,15 +78,18 @@ static inline void ll_delete_from_page_cache(struct page *page)
5686 - static inline void
5687 - truncate_complete_page(struct address_space *mapping, struct page *page)
5688 - {
5689 -- if (page->mapping != mapping)
5690 -- return;
5691 -+ if (page->mapping != mapping)
5692 -+ return;
5693 -
5694 -- if (PagePrivate(page))
5695 -- page->mapping->a_ops->invalidatepage(page, 0);
5696 --
5697 -- cancel_dirty_page(page, PAGE_SIZE);
5698 -- ClearPageMappedToDisk(page);
5699 -- ll_delete_from_page_cache(page);
5700 -+ if (PagePrivate(page))
5701 -+#ifdef HAVE_INVALIDATE_RANGE
5702 -+ page->mapping->a_ops->invalidatepage(page, 0, PAGE_CACHE_SIZE);
5703 -+#else
5704 -+ page->mapping->a_ops->invalidatepage(page, 0);
5705 -+#endif
5706 -+ cancel_dirty_page(page, PAGE_SIZE);
5707 -+ ClearPageMappedToDisk(page);
5708 -+ ll_delete_from_page_cache(page);
5709 - }
5710 - #endif /* !HAVE_TRUNCATE_COMPLETE_PAGE */
5711 -
5712 -diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c
5713 -index 447dc43..77151de 100644
5714 ---- a/lustre/llite/rw26.c
5715 -+++ b/lustre/llite/rw26.c
5716 -@@ -76,7 +76,13 @@
5717 - * aligned truncate). Lustre leaves partially truncated page in the cache,
5718 - * relying on struct inode::i_size to limit further accesses.
5719 - */
5720 --static void ll_invalidatepage(struct page *vmpage, unsigned long offset)
5721 -+static void ll_invalidatepage(struct page *vmpage,
5722 -+#ifdef HAVE_INVALIDATE_RANGE
5723 -+ unsigned int offset, unsigned int length
5724 -+#else
5725 -+ unsigned long offset
5726 -+#endif
5727 -+ )
5728 - {
5729 - struct inode *inode;
5730 - struct lu_env *env;
5731 -@@ -88,12 +94,16 @@ static void ll_invalidatepage(struct page *vmpage, unsigned long offset)
5732 - LASSERT(PageLocked(vmpage));
5733 - LASSERT(!PageWriteback(vmpage));
5734 -
5735 -- /*
5736 -- * It is safe to not check anything in invalidatepage/releasepage
5737 -- * below because they are run with page locked and all our io is
5738 -- * happening with locked page too
5739 -- */
5740 -- if (offset == 0) {
5741 -+ /*
5742 -+ * It is safe to not check anything in invalidatepage/releasepage
5743 -+ * below because they are run with page locked and all our io is
5744 -+ * happening with locked page too
5745 -+ */
5746 -+#ifdef HAVE_INVALIDATE_RANGE
5747 -+ if (offset == 0 && length == PAGE_CACHE_SIZE) {
5748 -+#else
5749 -+ if (offset == 0) {
5750 -+#endif
5751 - env = cl_env_get(&refcheck);
5752 - if (!IS_ERR(env)) {
5753 - inode = vmpage->mapping->host;
5754 ---
5755 -1.8.5.3
5756 -
5757
5758 diff --git a/sys-cluster/lustre/lustre-9999.ebuild b/sys-cluster/lustre/lustre-9999.ebuild
5759 index ad303cf..c4de667 100644
5760 --- a/sys-cluster/lustre/lustre-9999.ebuild
5761 +++ b/sys-cluster/lustre/lustre-9999.ebuild
5762 @@ -33,18 +33,15 @@ DEPEND="${RDEPEND}
5763 virtual/linux-sources"
5764
5765 PATCHES=(
5766 - "${FILESDIR}/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch"
5767 - "${FILESDIR}/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch"
5768 - "${FILESDIR}/0003-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch"
5769 - "${FILESDIR}/0004-LU-3319-procfs-fix-symlink-handling.patch"
5770 + "${FILESDIR}/0001-LU-3319-procfs-fix-symlink-handling.patch"
5771 + "${FILESDIR}/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch"
5772 + "${FILESDIR}/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch"
5773 + "${FILESDIR}/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch"
5774 "${FILESDIR}/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch"
5775 "${FILESDIR}/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch"
5776 - "${FILESDIR}/0007-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch"
5777 - "${FILESDIR}/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch"
5778 + "${FILESDIR}/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch"
5779 + "${FILESDIR}/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch"
5780 "${FILESDIR}/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch"
5781 - "${FILESDIR}/0010-LU-3319-lprocfs-client-side-cleanups.patch"
5782 - "${FILESDIR}/0011-LU-3974-llite-use-new-struct-dir_context.patch"
5783 - "${FILESDIR}/0012-LU-3974-llite-invalidatepage-api-changed.patch"
5784 )
5785
5786 pkg_setup() {