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: Tue, 04 Feb 2014 11:28:46
Message-Id: 1391513450.97dab7148009d3fe5414e7cad4bcac1102cdcb71.alexxy@gentoo
1 commit: 97dab7148009d3fe5414e7cad4bcac1102cdcb71
2 Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 4 11:30:50 2014 +0000
4 Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 4 11:30:50 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=97dab714
7
8 Make lustre build with 3.11 kernel
9
10 Package-Manager: portage-2.2.8-r1
11 RepoMan-Options: --force
12
13 ---
14 sys-cluster/lustre/ChangeLog | 34 +
15 ...ld-make-AC-check-for-linux-arch-sandbox-f.patch | 8 +-
16 ...0002-LU-3319-lprocfs-client-side-cleanups.patch | 463 ++
17 ...3-ldiskfs-ldiskfs-patches-for-3.11.1-fc19.patch | 5997 --------------------
18 .../0003-LU-3319-procfs-fix-symlink-handling.patch | 358 ++
19 ...74-llite-dentry-d_compare-changes-in-3.11.patch | 132 -
20 ...ocfs-move-mgs-proc-handling-to-seq_files.patch} | 53 +-
21 ...-LU-3974-llite-use-new-struct-dir_context.patch | 276 -
22 ...fs-update-zfs-proc-handling-to-seq_files.patch} | 82 +-
23 ...cfs-move-llite-proc-handling-over-to-seq_.patch | 1334 -----
24 ...ocfs-move-osp-proc-handling-to-seq_files.patch} | 235 +-
25 ...cfs-move-lmv-proc-handling-over-to-seq_fi.patch | 409 --
26 ...ocfs-move-lod-proc-handling-to-seq_files.patch} | 157 +-
27 ...cfs-move-ldlm-proc-handling-over-to-seq_f.patch | 789 ---
28 ...fs-move-mdt-mds-proc-handling-to-seq_fil.patch} | 214 +-
29 ...cfs-move-mdd-ofd-proc-handling-to-seq_fil.patch | 1928 +++++++
30 ...cfs-move-ost-proc-handling-over-to-seq_fi.patch | 174 -
31 ...fs-update-ldiskfs-proc-handling-to-seq_f.patch} | 220 +-
32 ...cfs-update-shared-server-side-core-proc-h.patch | 1260 ----
33 ...73-osd-ldiskfs-readdir-replace-by-iterate.patch | 140 +
34 ...-LU-3974-llite-use-new-struct-dir_context.patch | 262 +
35 ...rocfs-move-ofd-proc-handling-to-seq_files.patch | 759 ---
36 ...LU-3974-llite-invalidatepage-api-changed.patch} | 12 +-
37 ...rocfs-move-mdd-proc-handling-to-seq_files.patch | 788 ---
38 sys-cluster/lustre/lustre-9999.ebuild | 29 +-
39 25 files changed, 3788 insertions(+), 12325 deletions(-)
40
41 diff --git a/sys-cluster/lustre/ChangeLog b/sys-cluster/lustre/ChangeLog
42 index ea473e4..e5fdda4 100644
43 --- a/sys-cluster/lustre/ChangeLog
44 +++ b/sys-cluster/lustre/ChangeLog
45 @@ -2,6 +2,40 @@
46 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
47 # $Header: $
48
49 + 04 Feb 2014; Alexey Shvetsov <alexxy@g.o>
50 + +files/0002-LU-3319-lprocfs-client-side-cleanups.patch,
51 + +files/0003-LU-3319-procfs-fix-symlink-handling.patch,
52 + +files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch,
53 + +files/0005-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch,
54 + +files/0006-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch,
55 + +files/0007-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch,
56 + +files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch,
57 + +files/0009-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch,
58 + +files/0010-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch,
59 + +files/0011-LU-3373-osd-ldiskfs-readdir-replace-by-iterate.patch,
60 + +files/0012-LU-3974-llite-use-new-struct-dir_context.patch,
61 + +files/0013-LU-3974-llite-invalidatepage-api-changed.patch,
62 + -files/0002-LU-3373-ldiskfs-ldiskfs-patches-for-3.11.1-fc19.patch,
63 + -files/0003-LU-3974-llite-dentry-d_compare-changes-in-3.11.patch,
64 + -files/0004-LU-3974-llite-use-new-struct-dir_context.patch,
65 + -files/0005-LU-3974-llite-invalidatepage-api-changed.patch,
66 + -files/0006-LU-3319-procfs-move-llite-proc-handling-over-to-seq_.patch,
67 + -files/0007-LU-3319-procfs-move-lmv-proc-handling-over-to-seq_fi.patch,
68 + -files/0008-LU-3319-procfs-move-ldlm-proc-handling-over-to-seq_f.patch,
69 + -files/0009-LU-3319-procfs-move-ost-proc-handling-over-to-seq_fi.patch,
70 + -files/0010-LU-3319-procfs-update-shared-server-side-core-proc-h.patch,
71 + -files/0011-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch,
72 + -files/0012-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch,
73 + -files/0013-LU-3319-procfs-move-ofd-proc-handling-to-seq_files.patch,
74 + -files/0014-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch,
75 + -files/0015-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch,
76 + -files/0016-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch,
77 + -files/0017-LU-3319-procfs-move-mdd-proc-handling-to-seq_files.patch,
78 + -files/0018-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch,
79 + files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch,
80 + lustre-9999.ebuild:
81 + Make lustre build with 3.11 kernel
82 +
83 06 Jan 2014; Justin Lecher <jlec@g.o> lustre-9999.ebuild:
84 Switch from git-2 to git-r3
85
86
87 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
88 index e489733..eaec9aa 100644
89 --- a/sys-cluster/lustre/files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch
90 +++ b/sys-cluster/lustre/files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch
91 @@ -1,7 +1,7 @@
92 -From a607b37a64f797b766825ccb6f41176685cd843f Mon Sep 17 00:00:00 2001
93 +From 03643a33bd4d6a6fc3f8412f3e5f7f9a4bbd445b Mon Sep 17 00:00:00 2001
94 From: Alexey Shvetsov <alexxy@g.o>
95 Date: Mon, 18 Mar 2013 16:22:27 +0400
96 -Subject: [PATCH 01/18] LU-2982 build: make AC check for linux arch sandbox
97 +Subject: [PATCH 01/13] LU-2982 build: make AC check for linux arch sandbox
98 friendly
99
100 this commit makes AC check for linux kernel arch sandbox friendly
101 @@ -14,7 +14,7 @@ Signed-off-by: Alexey Shvetsov <alexxy@g.o>
102 1 file changed, 58 insertions(+), 8 deletions(-)
103
104 diff --git a/config/lustre-build-linux.m4 b/config/lustre-build-linux.m4
105 -index b1ec10e..4a835ea 100644
106 +index 894101c..8062ace 100644
107 --- a/config/lustre-build-linux.m4
108 +++ b/config/lustre-build-linux.m4
109 @@ -394,14 +394,64 @@ rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.
110 @@ -91,5 +91,5 @@ index b1ec10e..4a835ea 100644
111 #
112 # LB_LINUX_TRY_COMPILE
113 --
114 -1.8.5.1
115 +1.8.5.3
116
117
118 diff --git a/sys-cluster/lustre/files/0002-LU-3319-lprocfs-client-side-cleanups.patch b/sys-cluster/lustre/files/0002-LU-3319-lprocfs-client-side-cleanups.patch
119 new file mode 100644
120 index 0000000..5dd4981
121 --- /dev/null
122 +++ b/sys-cluster/lustre/files/0002-LU-3319-lprocfs-client-side-cleanups.patch
123 @@ -0,0 +1,463 @@
124 +From cc1b44ff52af1f78705c18169e951b2b626906b4 Mon Sep 17 00:00:00 2001
125 +From: James Simmons <uja.ornl@×××××.com>
126 +Date: Tue, 21 Jan 2014 12:06:59 -0500
127 +Subject: [PATCH 02/13] LU-3319 lprocfs: client side cleanups
128 +
129 +Now that all the client side seq_file patches it is
130 +time to handle the issue that people pointed out but
131 +were not severe enough to prevent landing. This patch
132 +addresses all the concerns as well and move all struct
133 +lprocfs_seq_var to be initialized C99 style.
134 +
135 +Change-Id: I89e8b719bd067ecf4e3cab481a2d4c62d5052af0
136 +Signed-off-by: James Simmons <uja.ornl@×××××.com>
137 +---
138 + lustre/fid/lproc_fid.c | 21 ++++++---
139 + lustre/lmv/lproc_lmv.c | 15 ++++---
140 + lustre/lov/lproc_lov.c | 42 ++++++++++++------
141 + lustre/mdc/lproc_mdc.c | 52 ++++++++++++++--------
142 + lustre/mgc/lproc_mgc.c | 25 +++++++----
143 + lustre/obdclass/lprocfs_status.c | 1 -
144 + lustre/obdecho/echo.c | 3 +-
145 + lustre/osc/lproc_osc.c | 94 +++++++++++++++++++++++++++-------------
146 + lustre/osc/osc_request.c | 2 +-
147 + lustre/ost/ost_handler.c | 3 +-
148 + lustre/ptlrpc/lproc_ptlrpc.c | 2 +-
149 + lustre/quota/qmt_pool.c | 3 +-
150 + lustre/quota/qsd_lib.c | 12 +++--
151 + 13 files changed, 183 insertions(+), 92 deletions(-)
152 +
153 +diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c
154 +index d89c4f6..3b9d170 100644
155 +--- a/lustre/fid/lproc_fid.c
156 ++++ b/lustre/fid/lproc_fid.c
157 +@@ -203,9 +203,12 @@ LPROC_SEQ_FOPS(lprocfs_server_fid_width);
158 + LPROC_SEQ_FOPS_RO(lprocfs_server_fid_server);
159 +
160 + struct lprocfs_seq_vars seq_server_proc_list[] = {
161 +- { "space", &lprocfs_server_fid_space_fops },
162 +- { "width", &lprocfs_server_fid_width_fops },
163 +- { "server", &lprocfs_server_fid_server_fops },
164 ++ { .name = "space",
165 ++ .fops = &lprocfs_server_fid_space_fops },
166 ++ { .name = "width",
167 ++ .fops = &lprocfs_server_fid_width_fops },
168 ++ { .name = "server",
169 ++ .fops = &lprocfs_server_fid_server_fops },
170 + { NULL }
171 + };
172 +
173 +@@ -623,10 +626,14 @@ LPROC_SEQ_FOPS_RO(lprocfs_client_fid_server);
174 + LPROC_SEQ_FOPS_RO(lprocfs_client_fid_fid);
175 +
176 + struct lprocfs_seq_vars seq_client_proc_list[] = {
177 +- { "space", &lprocfs_client_fid_space_fops },
178 +- { "width", &lprocfs_client_fid_width_fops },
179 +- { "server", &lprocfs_client_fid_server_fops },
180 +- { "fid", &lprocfs_client_fid_fid_fops },
181 ++ { .name = "space",
182 ++ .fops = &lprocfs_client_fid_space_fops },
183 ++ { .name = "width",
184 ++ .fops = &lprocfs_client_fid_width_fops },
185 ++ { .name = "server",
186 ++ .fops = &lprocfs_client_fid_server_fops },
187 ++ { .name = "fid",
188 ++ .fops = &lprocfs_client_fid_fid_fops },
189 + { NULL }
190 + };
191 + #endif
192 +diff --git a/lustre/lmv/lproc_lmv.c b/lustre/lmv/lproc_lmv.c
193 +index eea5927..5a7271a 100644
194 +--- a/lustre/lmv/lproc_lmv.c
195 ++++ b/lustre/lmv/lproc_lmv.c
196 +@@ -203,11 +203,16 @@ static int lmv_target_seq_open(struct inode *inode, struct file *file)
197 + LPROC_SEQ_FOPS_RO_TYPE(lmv, uuid);
198 +
199 + struct lprocfs_seq_vars lprocfs_lmv_obd_vars[] = {
200 +- { "numobd", &lmv_numobd_fops },
201 +- { "placement", &lmv_placement_fops },
202 +- { "activeobd", &lmv_activeobd_fops },
203 +- { "uuid", &lmv_uuid_fops },
204 +- { "desc_uuid", &lmv_desc_uuid_fops },
205 ++ { .name = "numobd",
206 ++ .fops = &lmv_numobd_fops },
207 ++ { .name = "placement",
208 ++ .fops = &lmv_placement_fops },
209 ++ { .name = "activeobd",
210 ++ .fops = &lmv_activeobd_fops },
211 ++ { .name = "uuid",
212 ++ .fops = &lmv_uuid_fops },
213 ++ { .name = "desc_uuid",
214 ++ .fops = &lmv_desc_uuid_fops },
215 + { 0 }
216 + };
217 +
218 +diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c
219 +index e400faf..7786513 100644
220 +--- a/lustre/lov/lproc_lov.c
221 ++++ b/lustre/lov/lproc_lov.c
222 +@@ -263,20 +263,34 @@ LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesfree);
223 + LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesavail);
224 +
225 + struct lprocfs_seq_vars lprocfs_lov_obd_vars[] = {
226 +- { "uuid", &lov_uuid_fops },
227 +- { "stripesize", &lov_stripesize_fops },
228 +- { "stripeoffset", &lov_stripeoffset_fops },
229 +- { "stripecount", &lov_stripecount_fops },
230 +- { "stripetype", &lov_stripetype_fops },
231 +- { "numobd", &lov_numobd_fops },
232 +- { "activeobd", &lov_activeobd_fops },
233 +- { "filestotal", &lov_filestotal_fops },
234 +- { "filesfree", &lov_filesfree_fops },
235 +- { "blocksize", &lov_blksize_fops },
236 +- { "kbytestotal", &lov_kbytestotal_fops },
237 +- { "kbytesfree", &lov_kbytesfree_fops },
238 +- { "kbytesavail", &lov_kbytesavail_fops },
239 +- { "desc_uuid", &lov_desc_uuid_fops },
240 ++ { .name = "uuid",
241 ++ .fops = &lov_uuid_fops },
242 ++ { .name = "stripesize",
243 ++ .fops = &lov_stripesize_fops },
244 ++ { .name = "stripeoffset",
245 ++ .fops = &lov_stripeoffset_fops },
246 ++ { .name = "stripecount",
247 ++ .fops = &lov_stripecount_fops },
248 ++ { .name = "stripetype",
249 ++ .fops = &lov_stripetype_fops },
250 ++ { .name = "numobd",
251 ++ .fops = &lov_numobd_fops },
252 ++ { .name = "activeobd",
253 ++ .fops = &lov_activeobd_fops },
254 ++ { .name = "filestotal",
255 ++ .fops = &lov_filestotal_fops },
256 ++ { .name = "filesfree",
257 ++ .fops = &lov_filesfree_fops },
258 ++ { .name = "blocksize",
259 ++ .fops = &lov_blksize_fops },
260 ++ { .name = "kbytestotal",
261 ++ .fops = &lov_kbytestotal_fops },
262 ++ { .name = "kbytesfree",
263 ++ .fops = &lov_kbytesfree_fops },
264 ++ { .name = "kbytesavail",
265 ++ .fops = &lov_kbytesavail_fops },
266 ++ { .name = "desc_uuid",
267 ++ .fops = &lov_desc_uuid_fops },
268 + { 0 }
269 + };
270 +
271 +diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c
272 +index cba4f61..69e377f 100644
273 +--- a/lustre/mdc/lproc_mdc.c
274 ++++ b/lustre/mdc/lproc_mdc.c
275 +@@ -103,29 +103,47 @@ LPROC_SEQ_FOPS_RW_TYPE(mdc, import);
276 + LPROC_SEQ_FOPS_RW_TYPE(mdc, pinger_recov);
277 +
278 + struct lprocfs_seq_vars lprocfs_mdc_obd_vars[] = {
279 +- { "uuid", &mdc_uuid_fops, 0, 0 },
280 +- { "ping", &mdc_ping_fops, 0, 0222 },
281 +- { "connect_flags", &mdc_connect_flags_fops,0, 0 },
282 +- { "blocksize", &mdc_blksize_fops, 0, 0 },
283 +- { "kbytestotal", &mdc_kbytestotal_fops, 0, 0 },
284 +- { "kbytesfree", &mdc_kbytesfree_fops, 0, 0 },
285 +- { "kbytesavail", &mdc_kbytesavail_fops, 0, 0 },
286 +- { "filestotal", &mdc_filestotal_fops, 0, 0 },
287 +- { "filesfree", &mdc_filesfree_fops, 0, 0 },
288 +- { "mds_server_uuid", &mdc_server_uuid_fops, 0, 0 },
289 +- { "mds_conn_uuid", &mdc_conn_uuid_fops, 0, 0 },
290 ++ { .name = "uuid",
291 ++ .fops = &mdc_uuid_fops },
292 ++ { .name = "ping",
293 ++ .fops = &mdc_ping_fops,
294 ++ .proc_mode = 0222 },
295 ++ { .name = "connect_flags",
296 ++ .fops = &mdc_connect_flags_fops },
297 ++ { .name = "blocksize",
298 ++ .fops = &mdc_blksize_fops },
299 ++ { .name = "kbytestotal",
300 ++ .fops = &mdc_kbytestotal_fops },
301 ++ { .name = "kbytesfree",
302 ++ .fops = &mdc_kbytesfree_fops },
303 ++ { .name = "kbytesavail",
304 ++ .fops = &mdc_kbytesavail_fops },
305 ++ { .name = "filestotal",
306 ++ .fops = &mdc_filestotal_fops },
307 ++ { .name = "filesfree",
308 ++ .fops = &mdc_filesfree_fops },
309 ++ { .name = "mds_server_uuid",
310 ++ .fops = &mdc_server_uuid_fops },
311 ++ { .name = "mds_conn_uuid",
312 ++ .fops = &mdc_conn_uuid_fops },
313 + /*
314 + * FIXME: below proc entry is provided, but not in used, instead
315 + * sbi->sb_md_brw_size is used, the per obd variable should be used
316 + * when CMD is enabled, and dir pages are managed in MDC layer.
317 + * Remember to enable proc write function.
318 + */
319 +- { "max_pages_per_rpc", &mdc_obd_max_pages_per_rpc_fops },
320 +- { "max_rpcs_in_flight", &mdc_max_rpcs_in_flight_fops },
321 +- { "timeouts", &mdc_timeouts_fops },
322 +- { "import", &mdc_import_fops },
323 +- { "state", &mdc_state_fops },
324 +- { "pinger_recov", &mdc_pinger_recov_fops },
325 ++ { .name = "max_pages_per_rpc",
326 ++ .fops = &mdc_obd_max_pages_per_rpc_fops },
327 ++ { .name = "max_rpcs_in_flight",
328 ++ .fops = &mdc_max_rpcs_in_flight_fops },
329 ++ { .name = "timeouts",
330 ++ .fops = &mdc_timeouts_fops },
331 ++ { .name = "import",
332 ++ .fops = &mdc_import_fops },
333 ++ { .name = "state",
334 ++ .fops = &mdc_state_fops },
335 ++ { .name = "pinger_recov",
336 ++ .fops = &mdc_pinger_recov_fops },
337 + { 0 }
338 + };
339 + #endif /* LPROCFS */
340 +diff --git a/lustre/mgc/lproc_mgc.c b/lustre/mgc/lproc_mgc.c
341 +index 648b6e5..f818def 100644
342 +--- a/lustre/mgc/lproc_mgc.c
343 ++++ b/lustre/mgc/lproc_mgc.c
344 +@@ -59,14 +59,23 @@ static int mgc_ir_state_seq_show(struct seq_file *m, void *v)
345 + LPROC_SEQ_FOPS_RO(mgc_ir_state);
346 +
347 + struct lprocfs_seq_vars lprocfs_mgc_obd_vars[] = {
348 +- { "uuid", &mgc_uuid_fops, 0, 0 },
349 +- { "ping", &mgc_ping_fops, 0, 0222 },
350 +- { "connect_flags", &mgc_connect_flags_fops,0, 0 },
351 +- { "mgs_server_uuid", &mgc_server_uuid_fops, 0, 0 },
352 +- { "mgs_conn_uuid", &mgc_conn_uuid_fops, 0, 0 },
353 +- { "import", &mgc_import_fops, 0, 0 },
354 +- { "state", &mgc_state_fops, 0, 0 },
355 +- { "ir_state", &mgc_ir_state_fops, 0, 0 },
356 ++ { .name = "uuid",
357 ++ .fops = &mgc_uuid_fops },
358 ++ { .name = "ping",
359 ++ .fops = &mgc_ping_fops,
360 ++ .proc_mode = 0222 },
361 ++ { .name = "connect_flags",
362 ++ .fops = &mgc_connect_flags_fops },
363 ++ { .name = "mgs_server_uuid",
364 ++ .fops = &mgc_server_uuid_fops },
365 ++ { .name = "mgs_conn_uuid",
366 ++ .fops = &mgc_conn_uuid_fops },
367 ++ { .name = "import",
368 ++ .fops = &mgc_import_fops },
369 ++ { .name = "state",
370 ++ .fops = &mgc_state_fops },
371 ++ { .name = "ir_state",
372 ++ .fops = &mgc_ir_state_fops },
373 + { 0 }
374 + };
375 + #endif /* LPROCFS */
376 +diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c
377 +index 7cd7870..63d01cc 100644
378 +--- a/lustre/obdclass/lprocfs_status.c
379 ++++ b/lustre/obdclass/lprocfs_status.c
380 +@@ -2582,7 +2582,6 @@ void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
381 + EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
382 +
383 + #ifdef HAVE_SERVER_SUPPORT
384 +-/* No one appears to be using this ?? */
385 + int lprocfs_exp_nid_seq_show(struct seq_file *m, void *data)
386 + {
387 + struct obd_export *exp = m->private;
388 +diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c
389 +index 6d63aff..8563e68 100644
390 +--- a/lustre/obdecho/echo.c
391 ++++ b/lustre/obdecho/echo.c
392 +@@ -561,7 +561,8 @@ commitrw_cleanup:
393 +
394 + LPROC_SEQ_FOPS_RO_TYPE(echo, uuid);
395 + static struct lprocfs_seq_vars lprocfs_echo_obd_vars[] = {
396 +- { "uuid", &echo_uuid_fops },
397 ++ { .name = "uuid",
398 ++ .fops = &echo_uuid_fops },
399 + { 0 }
400 + };
401 +
402 +diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c
403 +index d6e3703..ccfc212 100644
404 +--- a/lustre/osc/lproc_osc.c
405 ++++ b/lustre/osc/lproc_osc.c
406 +@@ -543,37 +543,69 @@ LPROC_SEQ_FOPS_RW_TYPE(osc, import);
407 + LPROC_SEQ_FOPS_RW_TYPE(osc, pinger_recov);
408 +
409 + struct lprocfs_seq_vars lprocfs_osc_obd_vars[] = {
410 +- { "uuid", &osc_uuid_fops },
411 +- { "ping", &osc_ping_fops, 0, 0222 },
412 +- { "connect_flags", &osc_connect_flags_fops },
413 +- { "blocksize", &osc_blksize_fops },
414 +- { "kbytestotal", &osc_kbytestotal_fops },
415 +- { "kbytesfree", &osc_kbytesfree_fops },
416 +- { "kbytesavail", &osc_kbytesavail_fops },
417 +- { "filestotal", &osc_filestotal_fops },
418 +- { "filesfree", &osc_filesfree_fops },
419 +- { "ost_server_uuid", &osc_server_uuid_fops },
420 +- { "ost_conn_uuid", &osc_conn_uuid_fops },
421 +- { "active", &osc_active_fops },
422 +- { "max_pages_per_rpc", &osc_obd_max_pages_per_rpc_fops },
423 +- { "max_rpcs_in_flight", &osc_max_rpcs_in_flight_fops },
424 +- { "destroys_in_flight", &osc_destroys_in_flight_fops },
425 +- { "max_dirty_mb", &osc_max_dirty_mb_fops },
426 +- { "osc_cached_mb", &osc_cached_mb_fops },
427 +- { "cur_dirty_bytes", &osc_cur_dirty_bytes_fops },
428 +- { "cur_grant_bytes", &osc_cur_grant_bytes_fops },
429 +- { "cur_lost_grant_bytes", &osc_cur_lost_grant_bytes_fops },
430 +- { "grant_shrink_interval", &osc_grant_shrink_interval_fops },
431 +- { "checksums", &osc_checksum_fops },
432 +- { "checksum_type", &osc_checksum_type_fops },
433 +- { "resend_count", &osc_resend_count_fops },
434 +- { "timeouts", &osc_timeouts_fops },
435 +- { "contention_seconds", &osc_contention_seconds_fops },
436 +- { "lockless_truncate", &osc_lockless_truncate_fops },
437 +- { "import", &osc_import_fops },
438 +- { "state", &osc_state_fops },
439 +- { "pinger_recov", &osc_pinger_recov_fops },
440 +- { "unstable_stats", &osc_unstable_stats_fops },
441 ++ { .name = "uuid",
442 ++ .fops = &osc_uuid_fops },
443 ++ { .name = "ping",
444 ++ .fops = &osc_ping_fops,
445 ++ .proc_mode = 0222 },
446 ++ { .name = "connect_flags",
447 ++ .fops = &osc_connect_flags_fops },
448 ++ { .name = "blocksize",
449 ++ .fops = &osc_blksize_fops },
450 ++ { .name = "kbytestotal",
451 ++ .fops = &osc_kbytestotal_fops },
452 ++ { .name = "kbytesfree",
453 ++ .fops = &osc_kbytesfree_fops },
454 ++ { .name = "kbytesavail",
455 ++ .fops = &osc_kbytesavail_fops },
456 ++ { .name = "filestotal",
457 ++ .fops = &osc_filestotal_fops },
458 ++ { .name = "filesfree",
459 ++ .fops = &osc_filesfree_fops },
460 ++ { .name = "ost_server_uuid",
461 ++ .fops = &osc_server_uuid_fops },
462 ++ { .name = "ost_conn_uuid",
463 ++ .fops = &osc_conn_uuid_fops },
464 ++ { .name = "active",
465 ++ .fops = &osc_active_fops },
466 ++ { .name = "max_pages_per_rpc",
467 ++ .fops = &osc_obd_max_pages_per_rpc_fops },
468 ++ { .name = "max_rpcs_in_flight",
469 ++ .fops = &osc_max_rpcs_in_flight_fops },
470 ++ { .name = "destroys_in_flight",
471 ++ .fops = &osc_destroys_in_flight_fops },
472 ++ { .name = "max_dirty_mb",
473 ++ .fops = &osc_max_dirty_mb_fops },
474 ++ { .name = "osc_cached_mb",
475 ++ .fops = &osc_cached_mb_fops },
476 ++ { .name = "cur_dirty_bytes",
477 ++ .fops = &osc_cur_dirty_bytes_fops },
478 ++ { .name = "cur_grant_bytes",
479 ++ .fops = &osc_cur_grant_bytes_fops },
480 ++ { .name = "cur_lost_grant_bytes",
481 ++ .fops = &osc_cur_lost_grant_bytes_fops },
482 ++ { .name = "grant_shrink_interval",
483 ++ .fops = &osc_grant_shrink_interval_fops },
484 ++ { .name = "checksums",
485 ++ .fops = &osc_checksum_fops },
486 ++ { .name = "checksum_type",
487 ++ .fops = &osc_checksum_type_fops },
488 ++ { .name = "resend_count",
489 ++ .fops = &osc_resend_count_fops },
490 ++ { .name = "timeouts",
491 ++ .fops = &osc_timeouts_fops },
492 ++ { .name = "contention_seconds",
493 ++ .fops = &osc_contention_seconds_fops },
494 ++ { .name = "lockless_truncate",
495 ++ .fops = &osc_lockless_truncate_fops },
496 ++ { .name = "import",
497 ++ .fops = &osc_import_fops },
498 ++ { .name = "state",
499 ++ .fops = &osc_state_fops },
500 ++ { .name = "pinger_recov",
501 ++ .fops = &osc_pinger_recov_fops },
502 ++ { .name = "unstable_stats",
503 ++ .fops = &osc_unstable_stats_fops },
504 + { 0 }
505 + };
506 +
507 +diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c
508 +index b9d1b71..f95fb55 100644
509 +--- a/lustre/osc/osc_request.c
510 ++++ b/lustre/osc/osc_request.c
511 +@@ -3669,7 +3669,7 @@ int osc_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg)
512 + {
513 + int rc = class_process_proc_seq_param(PARAM_OSC, obd->obd_vars,
514 + lcfg, obd);
515 +- return(rc > 0 ? 0: rc);
516 ++ return rc > 0 ? 0: rc;
517 + }
518 +
519 + static int osc_process_config(struct obd_device *obd, obd_count len, void *buf)
520 +diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c
521 +index d4da00d..d20a30f 100644
522 +--- a/lustre/ost/ost_handler.c
523 ++++ b/lustre/ost/ost_handler.c
524 +@@ -75,7 +75,8 @@ static struct cfs_cpt_table *ost_io_cptable;
525 + LPROC_SEQ_FOPS_RO_TYPE(ost, uuid);
526 +
527 + static struct lprocfs_seq_vars lprocfs_ost_obd_vars[] = {
528 +- { "uuid", &ost_uuid_fops },
529 ++ { .name = "uuid",
530 ++ .fops = &ost_uuid_fops },
531 + { 0 }
532 + };
533 + #endif /* LPROCFS */
534 +diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c
535 +index 8e5a397..bf21958 100644
536 +--- a/lustre/ptlrpc/lproc_ptlrpc.c
537 ++++ b/lustre/ptlrpc/lproc_ptlrpc.c
538 +@@ -1382,7 +1382,7 @@ lprocfs_import_seq_write(struct file *file, const char *buffer, size_t count,
539 +
540 + *ptr = 0;
541 + do_reconn = 0;
542 +- ptr += strlen("::");
543 ++ ptr += 2; /* Skip :: */
544 + inst = simple_strtol(ptr, &endptr, 10);
545 + if (*endptr) {
546 + CERROR("config: wrong instance # %s\n", ptr);
547 +diff --git a/lustre/quota/qmt_pool.c b/lustre/quota/qmt_pool.c
548 +index afd450c..df6d6fc 100644
549 +--- a/lustre/quota/qmt_pool.c
550 ++++ b/lustre/quota/qmt_pool.c
551 +@@ -171,7 +171,8 @@ static int qpi_state_seq_show(struct seq_file *m, void *data)
552 + LPROC_SEQ_FOPS_RO(qpi_state);
553 +
554 + static struct lprocfs_seq_vars lprocfs_quota_qpi_vars[] = {
555 +- { "info", &qpi_state_fops },
556 ++ { .name = "info",
557 ++ .fops = &qpi_state_fops },
558 + { NULL }
559 + };
560 +
561 +diff --git a/lustre/quota/qsd_lib.c b/lustre/quota/qsd_lib.c
562 +index 990cfee..573473c 100644
563 +--- a/lustre/quota/qsd_lib.c
564 ++++ b/lustre/quota/qsd_lib.c
565 +@@ -208,10 +208,14 @@ qsd_timeout_seq_write(struct file *file, const char *buffer,
566 + LPROC_SEQ_FOPS(qsd_timeout);
567 +
568 + static struct lprocfs_seq_vars lprocfs_quota_qsd_vars[] = {
569 +- { "info", &qsd_state_fops },
570 +- { "enabled", &qsd_enabled_fops },
571 +- { "force_reint", &qsd_force_reint_fops },
572 +- { "timeout", &qsd_timeout_fops },
573 ++ { .name = "info",
574 ++ .fops = &qsd_state_fops },
575 ++ { .name = "enabled",
576 ++ .fops = &qsd_enabled_fops },
577 ++ { .name = "force_reint",
578 ++ .fops = &qsd_force_reint_fops },
579 ++ { .name = "timeout",
580 ++ .fops = &qsd_timeout_fops },
581 + { NULL }
582 + };
583 +
584 +--
585 +1.8.5.3
586 +
587
588 diff --git a/sys-cluster/lustre/files/0002-LU-3373-ldiskfs-ldiskfs-patches-for-3.11.1-fc19.patch b/sys-cluster/lustre/files/0002-LU-3373-ldiskfs-ldiskfs-patches-for-3.11.1-fc19.patch
589 deleted file mode 100644
590 index 8f3258a..0000000
591 --- a/sys-cluster/lustre/files/0002-LU-3373-ldiskfs-ldiskfs-patches-for-3.11.1-fc19.patch
592 +++ /dev/null
593 @@ -1,5997 +0,0 @@
594 -From e53207df22261a635315a62f1405eb8c7b700963 Mon Sep 17 00:00:00 2001
595 -From: James Simmons <uja.ornl@×××××.com>
596 -Date: Thu, 5 Dec 2013 09:05:22 -0500
597 -Subject: [PATCH 02/18] LU-3373 ldiskfs: ldiskfs patches for 3.11.1 fc19
598 -
599 -ldiskfs patches
600 -
601 -Signed-off-by: yang sheng <yang.sheng@×××××.com>
602 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
603 -Change-Id: I59a8e7086c4567f1fe493ac7f0086365b5a6535c
604 ----
605 - config/lustre-build-ldiskfs.m4 | 15 +-
606 - config/lustre-build-linux.m4 | 12 +-
607 - .../fc19/ext4-change-entry-avoid-conflict.patch | 71 +
608 - .../patches/fc19/ext4-disable-mb-cache.patch | 150 ++
609 - .../kernel_patches/patches/fc19/ext4-fiemap.patch | 111 +
610 - .../patches/fc19/ext4-force_over_128tb.patch | 57 +
611 - .../patches/fc19/ext4-inode-version.patch | 59 +
612 - .../patches/fc19/ext4-kill-dx_root.patch | 235 ++
613 - .../patches/fc19/ext4-large-eas.patch | 785 +++++++
614 - .../patches/fc19/ext4-lookup-dotdot.patch | 37 +
615 - .../patches/fc19/ext4-max-dir-size.patch | 44 +
616 - .../patches/fc19/ext4-mballoc-extra-checks.patch | 315 +++
617 - .../fc19/ext4-mballoc-pa_free-mismatch.patch | 109 +
618 - .../kernel_patches/patches/fc19/ext4-misc.patch | 193 ++
619 - .../patches/fc19/ext4-nocmtime.patch | 28 +
620 - .../patches/fc19/ext4-osd-iam-exports.patch | 56 +
621 - .../patches/fc19/ext4-osd-iop-common.patch | 135 ++
622 - .../patches/fc19/ext4-pdir-fix.patch | 61 +
623 - .../patches/fc19/ext4-prealloc.patch | 387 ++++
624 - .../patches/fc19/ext4_data_in_dirent.patch | 649 ++++++
625 - .../kernel_patches/patches/fc19/ext4_pdirop.patch | 2252 ++++++++++++++++++++
626 - .../kernel_patches/series/ldiskfs-3.x-fc19.series | 22 +
627 - 22 files changed, 5781 insertions(+), 2 deletions(-)
628 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-change-entry-avoid-conflict.patch
629 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-disable-mb-cache.patch
630 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-fiemap.patch
631 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-force_over_128tb.patch
632 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-inode-version.patch
633 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-kill-dx_root.patch
634 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-large-eas.patch
635 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-lookup-dotdot.patch
636 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-max-dir-size.patch
637 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-mballoc-extra-checks.patch
638 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-mballoc-pa_free-mismatch.patch
639 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-misc.patch
640 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-nocmtime.patch
641 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-osd-iam-exports.patch
642 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-osd-iop-common.patch
643 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-pdir-fix.patch
644 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4-prealloc.patch
645 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4_data_in_dirent.patch
646 - create mode 100644 ldiskfs/kernel_patches/patches/fc19/ext4_pdirop.patch
647 - create mode 100644 ldiskfs/kernel_patches/series/ldiskfs-3.x-fc19.series
648 -
649 -diff --git a/config/lustre-build-ldiskfs.m4 b/config/lustre-build-ldiskfs.m4
650 -index 4b15de3..c979bab 100644
651 ---- a/config/lustre-build-ldiskfs.m4
652 -+++ b/config/lustre-build-ldiskfs.m4
653 -@@ -9,7 +9,7 @@ AS_IF([test x$RHEL_KERNEL = xyes], [
654 - AS_VERSION_COMPARE([$RHEL_KERNEL_VERSION],[2.6.32],[],
655 - [SER="2.6-rhel6.series"],[SER="2.6-rhel6.series"])],
656 - [SER="2.6-rhel6.4.series"],[SER="2.6-rhel6.4.series"])
657 --], [test x$SUSE_KERNEL = xyes], [
658 -+], [ AS_IF([test x$SUSE_KERNEL = xyes], [
659 - AS_VERSION_COMPARE([$LINUXRELEASE],[3.0.0],[
660 - AS_VERSION_COMPARE([$LINUXRELEASE],[2.6.32],[],
661 - [SER="2.6-sles11.series"],[SER="2.6-sles11.series"])],
662 -@@ -22,6 +22,19 @@ AS_IF([test x$RHEL_KERNEL = xyes], [
663 - ;;
664 - esac
665 - ])
666 -+], [ AS_IF([test x$FEDORA_KERNEL = xyes], [
667 -+ AS_VERSION_COMPARE([$LINUXRELEASE],[3.11],[],
668 -+ [SER="3.x-fc19.series"],[SER="3.x-fc19.series"])
669 -+])
670 -+])
671 -+])
672 -+
673 -+#
674 -+# Handle the case were someone uses their own kernel
675 -+#
676 -+AS_IF([test -z "$SER"], [
677 -+ AS_VERSION_COMPARE([$LINUXRELEASE],[3.11],[],
678 -+ [SER="3.x-fc19.series"],[SER="3.x-fc19.series"])
679 - ])
680 - LDISKFS_SERIES=$SER
681 -
682 -diff --git a/config/lustre-build-linux.m4 b/config/lustre-build-linux.m4
683 -index 4a835ea..9afda9c 100644
684 ---- a/config/lustre-build-linux.m4
685 -+++ b/config/lustre-build-linux.m4
686 -@@ -109,7 +109,16 @@ AC_MSG_CHECKING([for RedHat kernel version])
687 - AC_MSG_RESULT([${RHEL_KERNEL_VERSION}])
688 - ], [
689 - AC_MSG_RESULT([not found])
690 -- LB_LINUX_CONFIG([SUSE_KERNEL],[SUSE_KERNEL="yes"],[])
691 -+ LB_LINUX_CONFIG([SUSE_KERNEL],[SUSE_KERNEL="yes"],[
692 -+ AC_MSG_CHECKING([for Fedora 19 kernel])
693 -+ AS_IF([test "$(echo $LINUXRELEASE | grep fc19)" == "$LINUXRELEASE" ],[
694 -+ AC_MSG_RESULT([yes])
695 -+ FEDORA_KERNEL="yes"
696 -+ ], [
697 -+ FEDORA_KERNEL="no"
698 -+ AC_MSG_RESULT([no])
699 -+ ])
700 -+ ])
701 - ])
702 -
703 - AC_MSG_CHECKING([for kernel module package directory])
704 -@@ -118,6 +127,7 @@ AC_ARG_WITH([kmp-moddir],
705 - [set the kmod updates or extra directory]),
706 - [KMP_MODDIR=$withval],[
707 - AS_IF([test x$RHEL_KERNEL = xyes], [KMP_MODDIR="extra"],
708 -+ [test x$FEDORA_KERNEL = xyes], [KMP_MODDIR="extra"],
709 - [test x$SUSE_KERNEL = xyes], [KMP_MODDIR="updates"])])
710 -
711 - AC_MSG_RESULT($KMP_MODDIR)
712 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-change-entry-avoid-conflict.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-change-entry-avoid-conflict.patch
713 -new file mode 100644
714 -index 0000000..b1e4b9f
715 ---- /dev/null
716 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-change-entry-avoid-conflict.patch
717 -@@ -0,0 +1,71 @@
718 -+Index: linux-3.10.9-200.fc17.x86_64/fs/ext4/xattr.c
719 -+===================================================================
720 -+--- linux-3.10.9-200.fc17.x86_64.orig/fs/ext4/xattr.c
721 -++++ linux-3.10.9-200.fc17.x86_64/fs/ext4/xattr.c
722 -+@@ -945,7 +945,7 @@ ext4_xattr_set_entry(struct ext4_xattr_i
723 -+ if (!i->value) {
724 -+ /* Remove the old name. */
725 -+ size_t size = EXT4_XATTR_LEN(name_len);
726 -+- last = ENTRY((void *)last - size);
727 -++ last = XA_ENTRY((void *)last - size);
728 -+ memmove(s->here, (void *)s->here + size,
729 -+ (void *)last - (void *)s->here + sizeof(__u32));
730 -+ memset(last, 0, size);
731 -+@@ -1086,9 +1086,9 @@ ext4_xattr_block_set(handle_t *handle, s
732 -+ if (s->base == NULL)
733 -+ goto cleanup;
734 -+ memcpy(s->base, BHDR(bs->bh), bs->bh->b_size);
735 -+- s->first = ENTRY(header(s->base)+1);
736 -++ s->first = XA_ENTRY(header(s->base)+1);
737 -+ header(s->base)->h_refcount = cpu_to_le32(1);
738 -+- s->here = ENTRY(s->base + offset);
739 -++ s->here = XA_ENTRY(s->base + offset);
740 -+ s->end = s->base + bs->bh->b_size;
741 -+ }
742 -+ } else {
743 -+@@ -1101,8 +1101,8 @@ ext4_xattr_block_set(handle_t *handle, s
744 -+ header(s->base)->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC);
745 -+ header(s->base)->h_blocks = cpu_to_le32(1);
746 -+ header(s->base)->h_refcount = cpu_to_le32(1);
747 -+- s->first = ENTRY(header(s->base)+1);
748 -+- s->here = ENTRY(header(s->base)+1);
749 -++ s->first = XA_ENTRY(header(s->base)+1);
750 -++ s->here = XA_ENTRY(header(s->base)+1);
751 -+ s->end = s->base + sb->s_blocksize;
752 -+ }
753 -+
754 -+@@ -1884,8 +1884,8 @@ ext4_xattr_cmp(struct ext4_xattr_header
755 -+ {
756 -+ struct ext4_xattr_entry *entry1, *entry2;
757 -+
758 -+- entry1 = ENTRY(header1+1);
759 -+- entry2 = ENTRY(header2+1);
760 -++ entry1 = XA_ENTRY(header1+1);
761 -++ entry2 = XA_ENTRY(header2+1);
762 -+ while (!IS_LAST_ENTRY(entry1)) {
763 -+ if (IS_LAST_ENTRY(entry2))
764 -+ return 1;
765 -+@@ -2011,7 +2011,7 @@ static void ext4_xattr_rehash(struct ext
766 -+ __u32 hash = 0;
767 -+
768 -+ ext4_xattr_hash_entry(header, entry);
769 -+- here = ENTRY(header+1);
770 -++ here = XA_ENTRY(header+1);
771 -+ while (!IS_LAST_ENTRY(here)) {
772 -+ if (!here->e_hash) {
773 -+ /* Block is not shared if an entry's hash value == 0 */
774 -+Index: linux-3.10.9-200.fc17.x86_64/fs/ext4/xattr.h
775 -+===================================================================
776 -+--- linux-3.10.9-200.fc17.x86_64.orig/fs/ext4/xattr.h
777 -++++ linux-3.10.9-200.fc17.x86_64/fs/ext4/xattr.h
778 -+@@ -77,8 +77,8 @@ struct ext4_xattr_entry {
779 -+ ((b) - EXT4_XATTR_LEN(3) - sizeof(struct ext4_xattr_header) - 4)
780 -+
781 -+ #define BHDR(bh) ((struct ext4_xattr_header *)((bh)->b_data))
782 -+-#define ENTRY(ptr) ((struct ext4_xattr_entry *)(ptr))
783 -+-#define BFIRST(bh) ENTRY(BHDR(bh)+1)
784 -++#define XA_ENTRY(ptr) ((struct ext4_xattr_entry *)(ptr))
785 -++#define BFIRST(bh) XA_ENTRY(BHDR(bh)+1)
786 -+ #define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)
787 -+
788 -+ #define EXT4_ZERO_XATTR_VALUE ((void *)-1)
789 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-disable-mb-cache.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-disable-mb-cache.patch
790 -new file mode 100644
791 -index 0000000..93a9022
792 ---- /dev/null
793 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-disable-mb-cache.patch
794 -@@ -0,0 +1,150 @@
795 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
796 -+===================================================================
797 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4.h
798 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
799 -+@@ -941,6 +941,7 @@ struct ext4_inode_info {
800 -+ /*
801 -+ * Mount flags set via mount options or defaults
802 -+ */
803 -++#define EXT4_MOUNT_NO_MBCACHE 0x00001 /* Disable mbcache */
804 -+ #define EXT4_MOUNT_GRPID 0x00004 /* Create files with directory's group */
805 -+ #define EXT4_MOUNT_DEBUG 0x00008 /* Some debugging messages */
806 -+ #define EXT4_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */
807 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
808 -+===================================================================
809 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/super.c
810 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
811 -+@@ -1152,6 +1152,7 @@ enum {
812 -+ Opt_inode_readahead_blks, Opt_journal_ioprio,
813 -+ Opt_mballoc, Opt_force_over_128tb,
814 -+ Opt_dioread_nolock, Opt_dioread_lock,
815 -++ Opt_no_mbcache,
816 -+ Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
817 -+ Opt_max_dir_size_kb,
818 -+ };
819 -+@@ -1230,6 +1231,7 @@ static const match_table_t tokens = {
820 -+ {Opt_discard, "discard"},
821 -+ {Opt_nodiscard, "nodiscard"},
822 -+ {Opt_init_itable, "init_itable=%u"},
823 -++ {Opt_no_mbcache, "no_mbcache"},
824 -+ {Opt_init_itable, "init_itable"},
825 -+ {Opt_noinit_itable, "noinit_itable"},
826 -+ {Opt_max_dir_size_kb, "max_dir_size_kb=%u"},
827 -+@@ -1389,6 +1391,7 @@ static const struct mount_opts {
828 -+ {Opt_noauto_da_alloc, EXT4_MOUNT_NO_AUTO_DA_ALLOC, MOPT_SET},
829 -+ {Opt_auto_da_alloc, EXT4_MOUNT_NO_AUTO_DA_ALLOC, MOPT_CLEAR},
830 -+ {Opt_noinit_itable, EXT4_MOUNT_INIT_INODE_TABLE, MOPT_CLEAR},
831 -++ {Opt_no_mbcache, EXT4_MOUNT_NO_MBCACHE, MOPT_SET},
832 -+ {Opt_commit, 0, MOPT_GTE0},
833 -+ {Opt_max_batch_time, 0, MOPT_GTE0},
834 -+ {Opt_min_batch_time, 0, MOPT_GTE0},
835 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/xattr.c
836 -+===================================================================
837 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/xattr.c
838 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/xattr.c
839 -+@@ -81,7 +81,8 @@
840 -+ # define ea_bdebug(bh, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
841 -+ #endif
842 -+
843 -+-static void ext4_xattr_cache_insert(struct buffer_head *);
844 -++static void ext4_xattr_cache_insert(struct super_block *,
845 -++ struct buffer_head *);
846 -+ static struct buffer_head *ext4_xattr_cache_find(struct inode *,
847 -+ struct ext4_xattr_header *,
848 -+ struct mb_cache_entry **);
849 -+@@ -385,7 +386,7 @@ bad_block:
850 -+ error = -EIO;
851 -+ goto cleanup;
852 -+ }
853 -+- ext4_xattr_cache_insert(bh);
854 -++ ext4_xattr_cache_insert(inode->i_sb, bh);
855 -+ entry = BFIRST(bh);
856 -+ error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1,
857 -+ inode);
858 -+@@ -546,7 +547,7 @@ ext4_xattr_block_list(struct dentry *den
859 -+ error = -EIO;
860 -+ goto cleanup;
861 -+ }
862 -+- ext4_xattr_cache_insert(bh);
863 -++ ext4_xattr_cache_insert(inode->i_sb, bh);
864 -+ error = ext4_xattr_list_entries(dentry, BFIRST(bh), buffer, buffer_size);
865 -+
866 -+ cleanup:
867 -+@@ -643,7 +644,9 @@ ext4_xattr_release_block(handle_t *handl
868 -+ struct mb_cache_entry *ce = NULL;
869 -+ int error = 0;
870 -+
871 -+- ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev, bh->b_blocknr);
872 -++ if (!test_opt(inode->i_sb, NO_MBCACHE))
873 -++ ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev,
874 -++ bh->b_blocknr);
875 -+ error = ext4_journal_get_write_access(handle, bh);
876 -+ if (error)
877 -+ goto out;
878 -+@@ -1037,8 +1040,10 @@ ext4_xattr_block_set(handle_t *handle, s
879 -+ #define header(x) ((struct ext4_xattr_header *)(x))
880 -+
881 -+ if (s->base) {
882 -+- ce = mb_cache_entry_get(ext4_xattr_cache, bs->bh->b_bdev,
883 -+- bs->bh->b_blocknr);
884 -++ if (!test_opt(inode->i_sb, NO_MBCACHE))
885 -++ ce = mb_cache_entry_get(ext4_xattr_cache,
886 -++ bs->bh->b_bdev,
887 -++ bs->bh->b_blocknr);
888 -+ error = ext4_journal_get_write_access(handle, bs->bh);
889 -+ if (error)
890 -+ goto cleanup;
891 -+@@ -1055,7 +1060,7 @@ ext4_xattr_block_set(handle_t *handle, s
892 -+ if (!IS_LAST_ENTRY(s->first))
893 -+ ext4_xattr_rehash(header(s->base),
894 -+ s->here);
895 -+- ext4_xattr_cache_insert(bs->bh);
896 -++ ext4_xattr_cache_insert(sb, bs->bh);
897 -+ }
898 -+ unlock_buffer(bs->bh);
899 -+ if (error == -EIO)
900 -+@@ -1138,7 +1143,8 @@ inserted:
901 -+ if (error)
902 -+ goto cleanup_dquot;
903 -+ }
904 -+- mb_cache_entry_release(ce);
905 -++ if (ce)
906 -++ mb_cache_entry_release(ce);
907 -+ ce = NULL;
908 -+ } else if (bs->bh && s->base == bs->bh->b_data) {
909 -+ /* We were modifying this block in-place. */
910 -+@@ -1191,7 +1197,7 @@ getblk_failed:
911 -+ memcpy(new_bh->b_data, s->base, new_bh->b_size);
912 -+ set_buffer_uptodate(new_bh);
913 -+ unlock_buffer(new_bh);
914 -+- ext4_xattr_cache_insert(new_bh);
915 -++ ext4_xattr_cache_insert(sb, new_bh);
916 -+ error = ext4_handle_dirty_xattr_block(handle,
917 -+ inode, new_bh);
918 -+ if (error)
919 -+@@ -1837,12 +1843,15 @@ ext4_xattr_put_super(struct super_block
920 -+ * Returns 0, or a negative error number on failure.
921 -+ */
922 -+ static void
923 -+-ext4_xattr_cache_insert(struct buffer_head *bh)
924 -++ext4_xattr_cache_insert(struct super_block *sb, struct buffer_head *bh)
925 -+ {
926 -+ __u32 hash = le32_to_cpu(BHDR(bh)->h_hash);
927 -+ struct mb_cache_entry *ce;
928 -+ int error;
929 -+
930 -++ if (test_opt(sb, NO_MBCACHE))
931 -++ return;
932 -++
933 -+ ce = mb_cache_entry_alloc(ext4_xattr_cache, GFP_NOFS);
934 -+ if (!ce) {
935 -+ ea_bdebug(bh, "out of memory");
936 -+@@ -1915,6 +1924,8 @@ ext4_xattr_cache_find(struct inode *inod
937 -+ __u32 hash = le32_to_cpu(header->h_hash);
938 -+ struct mb_cache_entry *ce;
939 -+
940 -++ if (test_opt(inode->i_sb, NO_MBCACHE))
941 -++ return NULL;
942 -+ if (!header->h_hash)
943 -+ return NULL; /* never share */
944 -+ ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
945 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-fiemap.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-fiemap.patch
946 -new file mode 100644
947 -index 0000000..11d6d93
948 ---- /dev/null
949 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-fiemap.patch
950 -@@ -0,0 +1,111 @@
951 -+This patch adds direct EXT4_IOC_FIEMAP support to ldiskfs, for Lustre to call
952 -+without having to go through do_vfs_ioctl() (which isn't exported, and has a
953 -+number of other ioctls which are not suitable for Lustre). The actual FIEMAP
954 -+support is already in the kernel/ext4 for normal usage.
955 -+
956 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
957 -+===================================================================
958 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4.h
959 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
960 -+@@ -585,7 +585,7 @@ enum {
961 -+ #define EXT4_IOC_GROUP_ADD _IOW('f', 8, struct ext4_new_group_input)
962 -+ #define EXT4_IOC_MIGRATE _IO('f', 9)
963 -+ /* note ioctl 10 reserved for an early version of the FIEMAP ioctl */
964 -+- /* note ioctl 11 reserved for filesystem-independent FIEMAP ioctl */
965 -++#define EXT4_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
966 -+ #define EXT4_IOC_ALLOC_DA_BLKS _IO('f', 12)
967 -+ #define EXT4_IOC_MOVE_EXT _IOWR('f', 15, struct move_extent)
968 -+ #define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64)
969 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ioctl.c
970 -+===================================================================
971 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ioctl.c
972 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ioctl.c
973 -+@@ -214,6 +214,71 @@ swap_boot_out:
974 -+ return err;
975 -+ }
976 -+
977 -++/* So that the fiemap access checks can't overflow on 32 bit machines. */
978 -++#define FIEMAP_MAX_EXTENTS (UINT_MAX / sizeof(struct fiemap_extent))
979 -++
980 -++static int fiemap_check_ranges(struct super_block *sb,
981 -++ u64 start, u64 len, u64 *new_len)
982 -++{
983 -++ *new_len = len;
984 -++
985 -++ if (len == 0)
986 -++ return -EINVAL;
987 -++
988 -++ if (start > sb->s_maxbytes)
989 -++ return -EFBIG;
990 -++
991 -++ /*
992 -++ * Shrink request scope to what the fs can actually handle.
993 -++ */
994 -++ if ((len > sb->s_maxbytes) ||
995 -++ (sb->s_maxbytes - len) < start)
996 -++ *new_len = sb->s_maxbytes - start;
997 -++
998 -++ return 0;
999 -++}
1000 -++
1001 -++int ioctl_fiemap(struct inode *inode, struct file *filp, unsigned long arg)
1002 -++{
1003 -++ struct fiemap fiemap;
1004 -++ u64 len;
1005 -++ struct fiemap_extent_info fieinfo = {0, };
1006 -++ struct super_block *sb = inode->i_sb;
1007 -++ int error = 0;
1008 -++
1009 -++ if (copy_from_user(&fiemap, (struct fiemap __user *) arg,
1010 -++ sizeof(struct fiemap)))
1011 -++ return -EFAULT;
1012 -++
1013 -++ if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS)
1014 -++ return -EINVAL;
1015 -++
1016 -++ error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length,
1017 -++ &len);
1018 -++ if (error)
1019 -++ return error;
1020 -++
1021 -++ fieinfo.fi_flags = fiemap.fm_flags;
1022 -++ fieinfo.fi_extents_max = fiemap.fm_extent_count;
1023 -++ fieinfo.fi_extents_start = (struct fiemap_extent *)(arg + sizeof(fiemap));
1024 -++
1025 -++ if (fiemap.fm_extent_count != 0 &&
1026 -++ !access_ok(VERIFY_WRITE, (void *)arg,
1027 -++ offsetof(typeof(fiemap), fm_extents[fiemap.fm_extent_count])))
1028 -++ return -EFAULT;
1029 -++
1030 -++ if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
1031 -++ filemap_write_and_wait(inode->i_mapping);
1032 -++
1033 -++ error = ext4_fiemap(inode, &fieinfo, fiemap.fm_start, len);
1034 -++ fiemap.fm_flags = fieinfo.fi_flags;
1035 -++ fiemap.fm_mapped_extents = fieinfo.fi_extents_mapped;
1036 -++ if (copy_to_user((char *)arg, &fiemap, sizeof(fiemap)))
1037 -++ error = -EFAULT;
1038 -++
1039 -++ return error;
1040 -++}
1041 -++
1042 -+ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
1043 -+ {
1044 -+ struct inode *inode = file_inode(filp);
1045 -+@@ -532,6 +597,9 @@ group_add_out:
1046 -+ mnt_drop_write_file(filp);
1047 -+ return err;
1048 -+ }
1049 -++ case EXT4_IOC_FIEMAP: {
1050 -++ return ioctl_fiemap(inode, filp, arg);
1051 -++ }
1052 -+
1053 -+ case EXT4_IOC_ALLOC_DA_BLKS:
1054 -+ {
1055 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/fiemap.h
1056 -+===================================================================
1057 -+--- /dev/null
1058 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/fiemap.h
1059 -+@@ -0,0 +1,2 @@
1060 -++
1061 -++#include_next <fiemap.h>
1062 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-force_over_128tb.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-force_over_128tb.patch
1063 -new file mode 100644
1064 -index 0000000..84e75e5
1065 ---- /dev/null
1066 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-force_over_128tb.patch
1067 -@@ -0,0 +1,57 @@
1068 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
1069 -+===================================================================
1070 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/super.c
1071 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
1072 -+@@ -60,6 +60,8 @@ static struct ext4_lazy_init *ext4_li_in
1073 -+ static struct mutex ext4_li_mtx;
1074 -+ static struct ext4_features *ext4_feat;
1075 -+
1076 -++static int force_over_128tb;
1077 -++
1078 -+ static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
1079 -+ unsigned long journal_devnum);
1080 -+ static int ext4_show_options(struct seq_file *seq, struct dentry *root);
1081 -+@@ -1146,7 +1148,7 @@ enum {
1082 -+ Opt_stripe, Opt_delalloc, Opt_nodelalloc, Opt_mblk_io_submit,
1083 -+ Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity,
1084 -+ Opt_inode_readahead_blks, Opt_journal_ioprio,
1085 -+- Opt_mballoc,
1086 -++ Opt_mballoc, Opt_force_over_128tb,
1087 -+ Opt_dioread_nolock, Opt_dioread_lock,
1088 -+ Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
1089 -+ Opt_max_dir_size_kb,
1090 -+@@ -1222,6 +1224,7 @@ static const match_table_t tokens = {
1091 -+ {Opt_noauto_da_alloc, "noauto_da_alloc"},
1092 -+ {Opt_dioread_nolock, "dioread_nolock"},
1093 -+ {Opt_dioread_lock, "dioread_lock"},
1094 -++ {Opt_force_over_128tb, "force_over_128tb"},
1095 -+ {Opt_discard, "discard"},
1096 -+ {Opt_nodiscard, "nodiscard"},
1097 -+ {Opt_init_itable, "init_itable=%u"},
1098 -+@@ -1468,6 +1471,9 @@ static int handle_mount_opt(struct super
1099 -+ case Opt_iopen_nopriv:
1100 -+ case Opt_mballoc:
1101 -+ return 1;
1102 -++ case Opt_force_over_128tb:
1103 -++ force_over_128tb = 1;
1104 -++ break;
1105 -+ }
1106 -+
1107 -+ for (m = ext4_mount_opts; m->token != Opt_err; m++)
1108 -+@@ -3718,6 +3724,16 @@ static int ext4_fill_super(struct super_
1109 -+ goto failed_mount;
1110 -+ }
1111 -+
1112 -++ if (ext4_blocks_count(es) > (8ULL << 32)) {
1113 -++ if (force_over_128tb == 0) {
1114 -++ printk(KERN_ERR "EXT4-fs does not support filesystems "
1115 -++ "greater than 128TB and can cause data corruption."
1116 -++ "Use \"force_over_128tb\" mount option to override."
1117 -++ "\n");
1118 -++ goto failed_mount;
1119 -++ }
1120 -++ }
1121 -++
1122 -+ if (EXT4_BLOCKS_PER_GROUP(sb) == 0)
1123 -+ goto cantfind_ext4;
1124 -+
1125 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-inode-version.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-inode-version.patch
1126 -new file mode 100644
1127 -index 0000000..2cae2f0
1128 ---- /dev/null
1129 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-inode-version.patch
1130 -@@ -0,0 +1,59 @@
1131 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/inode.c
1132 -+===================================================================
1133 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/inode.c
1134 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/inode.c
1135 -+@@ -4145,11 +4145,11 @@ struct inode *ext4_iget(struct super_blo
1136 -+ EXT4_INODE_GET_XTIME(i_atime, inode, raw_inode);
1137 -+ EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
1138 -+
1139 -+- inode->i_version = le32_to_cpu(raw_inode->i_disk_version);
1140 -++ ei->i_fs_version = le32_to_cpu(raw_inode->i_disk_version);
1141 -+ if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
1142 -+ if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
1143 -+- inode->i_version |=
1144 -+- (__u64)(le32_to_cpu(raw_inode->i_version_hi)) << 32;
1145 -++ ei->i_fs_version |= (__u64)(le32_to_cpu(raw_inode->i_version_hi))
1146 -++ << 32;
1147 -+ }
1148 -+
1149 -+ ret = 0;
1150 -+@@ -4365,11 +4365,11 @@ static int ext4_do_update_inode(handle_t
1151 -+ raw_inode->i_block[block] = ei->i_data[block];
1152 -+ }
1153 -+
1154 -+- raw_inode->i_disk_version = cpu_to_le32(inode->i_version);
1155 -++ raw_inode->i_disk_version = cpu_to_le32(ei->i_fs_version);
1156 -+ if (ei->i_extra_isize) {
1157 -+ if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
1158 -+- raw_inode->i_version_hi =
1159 -+- cpu_to_le32(inode->i_version >> 32);
1160 -++ raw_inode->i_version_hi = cpu_to_le32(ei->i_fs_version
1161 -++ >> 32);
1162 -+ raw_inode->i_extra_isize = cpu_to_le16(ei->i_extra_isize);
1163 -+ }
1164 -+
1165 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ialloc.c
1166 -+===================================================================
1167 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ialloc.c
1168 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ialloc.c
1169 -+@@ -899,6 +899,7 @@ got:
1170 -+ ei->i_dtime = 0;
1171 -+ ei->i_block_group = group;
1172 -+ ei->i_last_alloc_group = ~0;
1173 -++ ei->i_fs_version = 0;
1174 -+
1175 -+ ext4_set_inode_flags(inode);
1176 -+ if (IS_DIRSYNC(inode))
1177 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
1178 -+===================================================================
1179 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4.h
1180 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
1181 -+@@ -915,6 +915,8 @@ struct ext4_inode_info {
1182 -+ tid_t i_sync_tid;
1183 -+ tid_t i_datasync_tid;
1184 -+
1185 -++ __u64 i_fs_version;
1186 -++
1187 -+ /* Precomputed uuid+inum+igen checksum for seeding inode checksums */
1188 -+ __u32 i_csum_seed;
1189 -+ };
1190 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-kill-dx_root.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-kill-dx_root.patch
1191 -new file mode 100644
1192 -index 0000000..f9c65d0
1193 ---- /dev/null
1194 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-kill-dx_root.patch
1195 -@@ -0,0 +1,235 @@
1196 -+removes static definition of dx_root struct. so that "." and ".." dirent can
1197 -+have extra data. This patch does not change any functionality but is required for
1198 -+ext4_data_in_dirent patch.
1199 -+
1200 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
1201 -+===================================================================
1202 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/namei.c
1203 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
1204 -+@@ -201,22 +201,13 @@ struct dx_entry
1205 -+ * hash version mod 4 should never be 0. Sincerely, the paranoia department.
1206 -+ */
1207 -+
1208 -+-struct dx_root
1209 -++struct dx_root_info
1210 -+ {
1211 -+- struct fake_dirent dot;
1212 -+- char dot_name[4];
1213 -+- struct fake_dirent dotdot;
1214 -+- char dotdot_name[4];
1215 -+- struct dx_root_info
1216 -+- {
1217 -+- __le32 reserved_zero;
1218 -+- u8 hash_version;
1219 -+- u8 info_length; /* 8 */
1220 -+- u8 indirect_levels;
1221 -+- u8 unused_flags;
1222 -+- }
1223 -+- info;
1224 -+- struct dx_entry entries[0];
1225 -++ __le32 reserved_zero;
1226 -++ u8 hash_version;
1227 -++ u8 info_length; /* 8 */
1228 -++ u8 indirect_levels;
1229 -++ u8 unused_flags;
1230 -+ };
1231 -+
1232 -+ struct dx_node
1233 -+@@ -519,6 +510,16 @@ ext4_next_entry(struct ext4_dir_entry_2
1234 -+ * Future: use high four bits of block for coalesce-on-delete flags
1235 -+ * Mask them off for now.
1236 -+ */
1237 -++struct dx_root_info * dx_get_dx_info(struct ext4_dir_entry_2 *de)
1238 -++{
1239 -++ /* get dotdot first */
1240 -++ de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(1));
1241 -++
1242 -++ /* dx root info is after dotdot entry */
1243 -++ de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(2));
1244 -++
1245 -++ return (struct dx_root_info *) de;
1246 -++}
1247 -+
1248 -+ static inline ext4_lblk_t dx_get_block(struct dx_entry *entry)
1249 -+ {
1250 -+@@ -681,7 +682,7 @@ dx_probe(const struct qstr *d_name, stru
1251 -+ {
1252 -+ unsigned count, indirect;
1253 -+ struct dx_entry *at, *entries, *p, *q, *m;
1254 -+- struct dx_root *root;
1255 -++ struct dx_root_info * info;
1256 -+ struct buffer_head *bh;
1257 -+ struct dx_frame *frame = frame_in;
1258 -+ u32 hash;
1259 -+@@ -692,17 +693,18 @@ dx_probe(const struct qstr *d_name, stru
1260 -+ *err = PTR_ERR(bh);
1261 -+ goto fail;
1262 -+ }
1263 -+- root = (struct dx_root *) bh->b_data;
1264 -+- if (root->info.hash_version != DX_HASH_TEA &&
1265 -+- root->info.hash_version != DX_HASH_HALF_MD4 &&
1266 -+- root->info.hash_version != DX_HASH_LEGACY) {
1267 -++
1268 -++ info = dx_get_dx_info((struct ext4_dir_entry_2*)bh->b_data);
1269 -++ if (info->hash_version != DX_HASH_TEA &&
1270 -++ info->hash_version != DX_HASH_HALF_MD4 &&
1271 -++ info->hash_version != DX_HASH_LEGACY) {
1272 -+ ext4_warning(dir->i_sb, "Unrecognised inode hash code %d for directory "
1273 -+- "#%lu", root->info.hash_version, dir->i_ino);
1274 -++ "#%lu", info->hash_version, dir->i_ino);
1275 -+ brelse(bh);
1276 -+ *err = ERR_BAD_DX_DIR;
1277 -+ goto fail;
1278 -+ }
1279 -+- hinfo->hash_version = root->info.hash_version;
1280 -++ hinfo->hash_version = info->hash_version;
1281 -+ if (hinfo->hash_version <= DX_HASH_TEA)
1282 -+ hinfo->hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned;
1283 -+ hinfo->seed = EXT4_SB(dir->i_sb)->s_hash_seed;
1284 -+@@ -710,27 +712,26 @@ dx_probe(const struct qstr *d_name, stru
1285 -+ ext4fs_dirhash(d_name->name, d_name->len, hinfo);
1286 -+ hash = hinfo->hash;
1287 -+
1288 -+- if (root->info.unused_flags & 1) {
1289 -++ if (info->unused_flags & 1) {
1290 -+ ext4_warning(dir->i_sb, "Unimplemented inode hash flags: %#06x",
1291 -+- root->info.unused_flags);
1292 -++ info->unused_flags);
1293 -+ brelse(bh);
1294 -+ *err = ERR_BAD_DX_DIR;
1295 -+ goto fail;
1296 -+ }
1297 -+
1298 -+- if ((indirect = root->info.indirect_levels) > 1) {
1299 -++ if ((indirect = info->indirect_levels) > 1) {
1300 -+ ext4_warning(dir->i_sb, "Unimplemented inode hash depth: %#06x",
1301 -+- root->info.indirect_levels);
1302 -++ info->indirect_levels);
1303 -+ brelse(bh);
1304 -+ *err = ERR_BAD_DX_DIR;
1305 -+ goto fail;
1306 -+ }
1307 -+
1308 -+- entries = (struct dx_entry *) (((char *)&root->info) +
1309 -+- root->info.info_length);
1310 -++ entries = (struct dx_entry *) (((char *)info) + info->info_length);
1311 -+
1312 -+ if (dx_get_limit(entries) != dx_root_limit(dir,
1313 -+- root->info.info_length)) {
1314 -++ info->info_length)) {
1315 -+ ext4_warning(dir->i_sb, "dx entry: limit != root limit");
1316 -+ brelse(bh);
1317 -+ *err = ERR_BAD_DX_DIR;
1318 -+@@ -815,10 +816,12 @@ fail:
1319 -+
1320 -+ static void dx_release (struct dx_frame *frames)
1321 -+ {
1322 -++ struct dx_root_info *info;
1323 -+ if (frames[0].bh == NULL)
1324 -+ return;
1325 -+
1326 -+- if (((struct dx_root *) frames[0].bh->b_data)->info.indirect_levels)
1327 -++ info = dx_get_dx_info((struct ext4_dir_entry_2*)frames[0].bh->b_data);
1328 -++ if (info->indirect_levels)
1329 -+ brelse(frames[1].bh);
1330 -+ brelse(frames[0].bh);
1331 -+ }
1332 -+@@ -1795,10 +1798,9 @@ static int make_indexed_dir(handle_t *ha
1333 -+ const char *name = dentry->d_name.name;
1334 -+ int namelen = dentry->d_name.len;
1335 -+ struct buffer_head *bh2;
1336 -+- struct dx_root *root;
1337 -+ struct dx_frame frames[2], *frame;
1338 -+ struct dx_entry *entries;
1339 -+- struct ext4_dir_entry_2 *de, *de2;
1340 -++ struct ext4_dir_entry_2 *de, *de2, *dot_de, *dotdot_de;
1341 -+ struct ext4_dir_entry_tail *t;
1342 -+ char *data1, *top;
1343 -+ unsigned len;
1344 -+@@ -1806,7 +1808,7 @@ static int make_indexed_dir(handle_t *ha
1345 -+ unsigned blocksize;
1346 -+ struct dx_hash_info hinfo;
1347 -+ ext4_lblk_t block;
1348 -+- struct fake_dirent *fde;
1349 -++ struct dx_root_info *dx_info;
1350 -+ int csum_size = 0;
1351 -+
1352 -+ if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb,
1353 -+@@ -1821,18 +1823,19 @@ static int make_indexed_dir(handle_t *ha
1354 -+ brelse(bh);
1355 -+ return retval;
1356 -+ }
1357 -+- root = (struct dx_root *) bh->b_data;
1358 -++
1359 -++ dot_de = (struct ext4_dir_entry_2 *) bh->b_data;
1360 -++ dotdot_de = ext4_next_entry(dot_de, blocksize);
1361 -+
1362 -+ /* The 0th block becomes the root, move the dirents out */
1363 -+- fde = &root->dotdot;
1364 -+- de = (struct ext4_dir_entry_2 *)((char *)fde +
1365 -+- ext4_rec_len_from_disk(fde->rec_len, blocksize));
1366 -+- if ((char *) de >= (((char *) root) + blocksize)) {
1367 -++ de = (struct ext4_dir_entry_2 *)((char *)dotdot_de +
1368 -++ ext4_rec_len_from_disk(dotdot_de->rec_len, blocksize));
1369 -++ if ((char *) de >= (((char *) dot_de) + blocksize)) {
1370 -+ EXT4_ERROR_INODE(dir, "invalid rec_len for '..'");
1371 -+ brelse(bh);
1372 -+ return -EIO;
1373 -+ }
1374 -+- len = ((char *) root) + (blocksize - csum_size) - (char *) de;
1375 -++ len = ((char *) dot_de) + (blocksize - csum_size) - (char *) de;
1376 -+
1377 -+ /* Allocate new block for the 0th block's dirents */
1378 -+ bh2 = ext4_append(handle, dir, &block);
1379 -+@@ -1858,19 +1861,23 @@ static int make_indexed_dir(handle_t *ha
1380 -+ }
1381 -+
1382 -+ /* Initialize the root; the dot dirents already exist */
1383 -+- de = (struct ext4_dir_entry_2 *) (&root->dotdot);
1384 -+- de->rec_len = ext4_rec_len_to_disk(blocksize - EXT4_DIR_REC_LEN(2),
1385 -+- blocksize);
1386 -+- memset (&root->info, 0, sizeof(root->info));
1387 -+- root->info.info_length = sizeof(root->info);
1388 -+- root->info.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
1389 -+- entries = root->entries;
1390 -++ dotdot_de->rec_len = ext4_rec_len_to_disk(blocksize -
1391 -++ le16_to_cpu(dot_de->rec_len), blocksize);
1392 -++
1393 -++ /* initialize hashing info */
1394 -++ dx_info = dx_get_dx_info(dot_de);
1395 -++ memset (dx_info, 0, sizeof(*dx_info));
1396 -++ dx_info->info_length = sizeof(*dx_info);
1397 -++ dx_info->hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
1398 -++
1399 -++ entries = (void *)dx_info + sizeof(*dx_info);
1400 -++
1401 -+ dx_set_block(entries, 1);
1402 -+ dx_set_count(entries, 1);
1403 -+- dx_set_limit(entries, dx_root_limit(dir, sizeof(root->info)));
1404 -++ dx_set_limit(entries, dx_root_limit(dir, sizeof(*dx_info)));
1405 -+
1406 -+ /* Initialize as for dx_probe */
1407 -+- hinfo.hash_version = root->info.hash_version;
1408 -++ hinfo.hash_version = dx_info->hash_version;
1409 -+ if (hinfo.hash_version <= DX_HASH_TEA)
1410 -+ hinfo.hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned;
1411 -+ hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed;
1412 -+@@ -2160,6 +2167,7 @@ static int ext4_dx_add_entry(handle_t *h
1413 -+ goto journal_error;
1414 -+ brelse (bh2);
1415 -+ } else {
1416 -++ struct dx_root_info * info;
1417 -+ dxtrace(printk(KERN_DEBUG
1418 -+ "Creating second level index...\n"));
1419 -+ memcpy((char *) entries2, (char *) entries,
1420 -+@@ -2169,7 +2177,9 @@ static int ext4_dx_add_entry(handle_t *h
1421 -+ /* Set up root */
1422 -+ dx_set_count(entries, 1);
1423 -+ dx_set_block(entries + 0, newblock);
1424 -+- ((struct dx_root *) frames[0].bh->b_data)->info.indirect_levels = 1;
1425 -++ info = dx_get_dx_info((struct ext4_dir_entry_2*)
1426 -++ frames[0].bh->b_data);
1427 -++ info->indirect_levels = 1;
1428 -+
1429 -+ /* Add new access path frame */
1430 -+ frame = frames + 1;
1431 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-large-eas.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-large-eas.patch
1432 -new file mode 100644
1433 -index 0000000..4bbb6f5
1434 ---- /dev/null
1435 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-large-eas.patch
1436 -@@ -0,0 +1,785 @@
1437 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
1438 -+===================================================================
1439 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4.h
1440 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
1441 -+@@ -1533,6 +1533,7 @@ static inline void ext4_clear_state_flag
1442 -+ EXT4_FEATURE_INCOMPAT_EXTENTS| \
1443 -+ EXT4_FEATURE_INCOMPAT_64BIT| \
1444 -+ EXT4_FEATURE_INCOMPAT_FLEX_BG| \
1445 -++ EXT4_FEATURE_INCOMPAT_EA_INODE| \
1446 -+ EXT4_FEATURE_INCOMPAT_MMP | \
1447 -+ EXT4_FEATURE_INCOMPAT_DIRDATA| \
1448 -+ EXT4_FEATURE_INCOMPAT_INLINE_DATA)
1449 -+@@ -1940,6 +1941,12 @@ struct mmpd_data {
1450 -+ #endif
1451 -+
1452 -+ /*
1453 -++ * Maximum size of xattr attributes for FEATURE_INCOMPAT_EA_INODE 1Mb
1454 -++ * This limit is arbitrary, but is reasonable for the xattr API.
1455 -++ */
1456 -++#define EXT4_XATTR_MAX_LARGE_EA_SIZE (1024 * 1024)
1457 -++
1458 -++/*
1459 -+ * Function prototypes
1460 -+ */
1461 -+
1462 -+@@ -2163,6 +2170,7 @@ extern void ext4_set_inode_flags(struct
1463 -+ extern void ext4_get_inode_flags(struct ext4_inode_info *);
1464 -+ extern int ext4_alloc_da_blocks(struct inode *inode);
1465 -+ extern void ext4_set_aops(struct inode *inode);
1466 -++extern int ext4_meta_trans_blocks(struct inode *, int nrblocks, int chunk);
1467 -+ extern int ext4_writepage_trans_blocks(struct inode *);
1468 -+ extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
1469 -+ extern int ext4_block_truncate_page(handle_t *handle,
1470 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/inode.c
1471 -+===================================================================
1472 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/inode.c
1473 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/inode.c
1474 -+@@ -136,8 +136,6 @@ static void ext4_invalidatepage(struct p
1475 -+ unsigned int length);
1476 -+ static int __ext4_journalled_writepage(struct page *page, unsigned int len);
1477 -+ static int ext4_bh_delay_or_unwritten(handle_t *handle, struct buffer_head *bh);
1478 -+-static int ext4_meta_trans_blocks(struct inode *inode, int lblocks,
1479 -+- int pextents);
1480 -+
1481 -+ /*
1482 -+ * Test whether an inode is a fast symlink.
1483 -+@@ -4716,7 +4714,7 @@ static int ext4_index_trans_blocks(struc
1484 -+ *
1485 -+ * Also account for superblock, inode, quota and xattr blocks
1486 -+ */
1487 -+-static int ext4_meta_trans_blocks(struct inode *inode, int lblocks,
1488 -++int ext4_meta_trans_blocks(struct inode *inode, int lblocks,
1489 -+ int pextents)
1490 -+ {
1491 -+ ext4_group_t groups, ngroups = ext4_get_groups_count(inode->i_sb);
1492 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/xattr.c
1493 -+===================================================================
1494 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/xattr.c
1495 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/xattr.c
1496 -+@@ -220,19 +220,26 @@ ext4_xattr_check_block(struct inode *ino
1497 -+ }
1498 -+
1499 -+ static inline int
1500 -+-ext4_xattr_check_entry(struct ext4_xattr_entry *entry, size_t size)
1501 -++ext4_xattr_check_entry(struct ext4_xattr_entry *entry, size_t size,
1502 -++ struct inode *inode)
1503 -+ {
1504 -+ size_t value_size = le32_to_cpu(entry->e_value_size);
1505 -+
1506 -+- if (entry->e_value_block != 0 || value_size > size ||
1507 -+- le16_to_cpu(entry->e_value_offs) + value_size > size)
1508 -++ if ((entry->e_value_inum == 0) &&
1509 -++ (le16_to_cpu(entry->e_value_offs) + value_size > size))
1510 -++ return -EIO;
1511 -++ if (entry->e_value_inum != 0 &&
1512 -++ (le32_to_cpu(entry->e_value_inum) < EXT4_FIRST_INO(inode->i_sb) ||
1513 -++ le32_to_cpu(entry->e_value_inum) >
1514 -++ le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_inodes_count)))
1515 -+ return -EIO;
1516 -+ return 0;
1517 -+ }
1518 -+
1519 -+ static int
1520 -+ ext4_xattr_find_entry(struct ext4_xattr_entry **pentry, int name_index,
1521 -+- const char *name, size_t size, int sorted)
1522 -++ const char *name, size_t size, int sorted,
1523 -++ struct inode *inode)
1524 -+ {
1525 -+ struct ext4_xattr_entry *entry;
1526 -+ size_t name_len;
1527 -+@@ -252,11 +259,103 @@ ext4_xattr_find_entry(struct ext4_xattr_
1528 -+ break;
1529 -+ }
1530 -+ *pentry = entry;
1531 -+- if (!cmp && ext4_xattr_check_entry(entry, size))
1532 -++ if (!cmp && ext4_xattr_check_entry(entry, size, inode))
1533 -+ return -EIO;
1534 -+ return cmp ? -ENODATA : 0;
1535 -+ }
1536 -+
1537 -++/*
1538 -++ * Read the EA value from an inode.
1539 -++ */
1540 -++static int
1541 -++ext4_xattr_inode_read(struct inode *ea_inode, void *buf, size_t *size)
1542 -++{
1543 -++ unsigned long block = 0;
1544 -++ struct buffer_head *bh = NULL;
1545 -++ int err, blocksize;
1546 -++ size_t csize, ret_size = 0;
1547 -++
1548 -++ if (*size == 0)
1549 -++ return 0;
1550 -++
1551 -++ blocksize = ea_inode->i_sb->s_blocksize;
1552 -++
1553 -++ while (ret_size < *size) {
1554 -++ csize = (*size - ret_size) > blocksize ? blocksize :
1555 -++ *size - ret_size;
1556 -++ bh = ext4_bread(NULL, ea_inode, block, 0, &err);
1557 -++ if (!bh) {
1558 -++ *size = ret_size;
1559 -++ return err;
1560 -++ }
1561 -++ memcpy(buf, bh->b_data, csize);
1562 -++ brelse(bh);
1563 -++
1564 -++ buf += csize;
1565 -++ block += 1;
1566 -++ ret_size += csize;
1567 -++ }
1568 -++
1569 -++ *size = ret_size;
1570 -++
1571 -++ return err;
1572 -++}
1573 -++
1574 -++struct inode *ext4_xattr_inode_iget(struct inode *parent, int ea_ino, int *err)
1575 -++{
1576 -++ struct inode *ea_inode = NULL;
1577 -++
1578 -++ ea_inode = ext4_iget(parent->i_sb, ea_ino);
1579 -++ if (IS_ERR(ea_inode) || is_bad_inode(ea_inode)) {
1580 -++ ext4_error(parent->i_sb, "error while reading EA inode %d",
1581 -++ ea_ino);
1582 -++ *err = -EIO;
1583 -++ return NULL;
1584 -++ }
1585 -++
1586 -++ if (ea_inode->i_xattr_inode_parent != parent->i_ino ||
1587 -++ ea_inode->i_generation != parent->i_generation) {
1588 -++ ext4_error(parent->i_sb, "Backpointer from EA inode %d "
1589 -++ "to parent invalid.", ea_ino);
1590 -++ *err = -EINVAL;
1591 -++ goto error;
1592 -++ }
1593 -++
1594 -++ if (!(EXT4_I(ea_inode)->i_flags & EXT4_EA_INODE_FL)) {
1595 -++ ext4_error(parent->i_sb, "EA inode %d does not have "
1596 -++ "EXT4_EA_INODE_FL flag set.\n", ea_ino);
1597 -++ *err = -EINVAL;
1598 -++ goto error;
1599 -++ }
1600 -++
1601 -++ *err = 0;
1602 -++ return ea_inode;
1603 -++
1604 -++error:
1605 -++ iput(ea_inode);
1606 -++ return NULL;
1607 -++}
1608 -++
1609 -++/*
1610 -++ * Read the value from the EA inode.
1611 -++ */
1612 -++static int
1613 -++ext4_xattr_inode_get(struct inode *inode, int ea_ino, void *buffer,
1614 -++ size_t *size)
1615 -++{
1616 -++ struct inode *ea_inode = NULL;
1617 -++ int err;
1618 -++
1619 -++ ea_inode = ext4_xattr_inode_iget(inode, ea_ino, &err);
1620 -++ if (err)
1621 -++ return err;
1622 -++
1623 -++ err = ext4_xattr_inode_read(ea_inode, buffer, size);
1624 -++ iput(ea_inode);
1625 -++
1626 -++ return err;
1627 -++}
1628 -++
1629 -+ static int
1630 -+ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name,
1631 -+ void *buffer, size_t buffer_size)
1632 -+@@ -288,7 +387,8 @@ bad_block:
1633 -+ }
1634 -+ ext4_xattr_cache_insert(bh);
1635 -+ entry = BFIRST(bh);
1636 -+- error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1);
1637 -++ error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1,
1638 -++ inode);
1639 -+ if (error == -EIO)
1640 -+ goto bad_block;
1641 -+ if (error)
1642 -+@@ -298,8 +398,16 @@ bad_block:
1643 -+ error = -ERANGE;
1644 -+ if (size > buffer_size)
1645 -+ goto cleanup;
1646 -+- memcpy(buffer, bh->b_data + le16_to_cpu(entry->e_value_offs),
1647 -+- size);
1648 -++ if (entry->e_value_inum != 0) {
1649 -++ error = ext4_xattr_inode_get(inode,
1650 -++ le32_to_cpu(entry->e_value_inum),
1651 -++ buffer, &size);
1652 -++ if (error)
1653 -++ goto cleanup;
1654 -++ } else {
1655 -++ memcpy(buffer, bh->b_data +
1656 -++ le16_to_cpu(entry->e_value_offs), size);
1657 -++ }
1658 -+ }
1659 -+ error = size;
1660 -+
1661 -+@@ -333,7 +441,7 @@ ext4_xattr_ibody_get(struct inode *inode
1662 -+ if (error)
1663 -+ goto cleanup;
1664 -+ error = ext4_xattr_find_entry(&entry, name_index, name,
1665 -+- end - (void *)entry, 0);
1666 -++ end - (void *)entry, 0, inode);
1667 -+ if (error)
1668 -+ goto cleanup;
1669 -+ size = le32_to_cpu(entry->e_value_size);
1670 -+@@ -341,8 +449,16 @@ ext4_xattr_ibody_get(struct inode *inode
1671 -+ error = -ERANGE;
1672 -+ if (size > buffer_size)
1673 -+ goto cleanup;
1674 -+- memcpy(buffer, (void *)IFIRST(header) +
1675 -+- le16_to_cpu(entry->e_value_offs), size);
1676 -++ if (entry->e_value_inum != 0) {
1677 -++ error = ext4_xattr_inode_get(inode,
1678 -++ le32_to_cpu(entry->e_value_inum),
1679 -++ buffer, &size);
1680 -++ if (error)
1681 -++ goto cleanup;
1682 -++ } else {
1683 -++ memcpy(buffer, (void *)IFIRST(header) +
1684 -++ le16_to_cpu(entry->e_value_offs), size);
1685 -++ }
1686 -+ }
1687 -+ error = size;
1688 -+
1689 -+@@ -568,7 +684,7 @@ static size_t ext4_xattr_free_space(stru
1690 -+ {
1691 -+ for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
1692 -+ *total += EXT4_XATTR_LEN(last->e_name_len);
1693 -+- if (!last->e_value_block && last->e_value_size) {
1694 -++ if (last->e_value_inum == 0 && last->e_value_size > 0) {
1695 -+ size_t offs = le16_to_cpu(last->e_value_offs);
1696 -+ if (offs < *min_offs)
1697 -+ *min_offs = offs;
1698 -+@@ -577,16 +693,171 @@ static size_t ext4_xattr_free_space(stru
1699 -+ return (*min_offs - ((void *)last - base) - sizeof(__u32));
1700 -+ }
1701 -+
1702 -++/*
1703 -++ * Write the value of the EA in an inode.
1704 -++ */
1705 -++static int
1706 -++ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode,
1707 -++ const void *buf, int bufsize)
1708 -++{
1709 -++ struct buffer_head *bh = NULL;
1710 -++ unsigned long block = 0;
1711 -++ unsigned blocksize = ea_inode->i_sb->s_blocksize;
1712 -++ unsigned max_blocks = (bufsize + blocksize - 1) >> ea_inode->i_blkbits;
1713 -++ int csize, wsize = 0;
1714 -++ int ret = 0;
1715 -++ int retries = 0;
1716 -++
1717 -++retry:
1718 -++ while (ret >= 0 && ret < max_blocks) {
1719 -++ struct ext4_map_blocks map;
1720 -++ map.m_lblk = block += ret;
1721 -++ map.m_len = max_blocks -= ret;
1722 -++
1723 -++ ret = ext4_map_blocks(handle, ea_inode, &map, EXT4_GET_BLOCKS_CREATE);
1724 -++ if (ret <= 0) {
1725 -++ ext4_mark_inode_dirty(handle, ea_inode);
1726 -++ if (ret == -ENOSPC &&
1727 -++ ext4_should_retry_alloc(ea_inode->i_sb, &retries)) {
1728 -++ ret = 0;
1729 -++ goto retry;
1730 -++ }
1731 -++ break;
1732 -++ }
1733 -++ }
1734 -++
1735 -++ if (ret < 0)
1736 -++ return ret;
1737 -++
1738 -++ block = 0;
1739 -++ while (wsize < bufsize) {
1740 -++ if (bh != NULL)
1741 -++ brelse(bh);
1742 -++ csize = (bufsize - wsize) > blocksize ? blocksize :
1743 -++ bufsize - wsize;
1744 -++ bh = ext4_getblk(handle, ea_inode, block, 0, &ret);
1745 -++ if (!bh)
1746 -++ goto out;
1747 -++ ret = ext4_journal_get_write_access(handle, bh);
1748 -++ if (ret)
1749 -++ goto out;
1750 -++
1751 -++ memcpy(bh->b_data, buf, csize);
1752 -++ set_buffer_uptodate(bh);
1753 -++ ext4_journal_dirty_metadata(handle, bh);
1754 -++
1755 -++ buf += csize;
1756 -++ wsize += csize;
1757 -++ block += 1;
1758 -++ }
1759 -++
1760 -++ i_size_write(ea_inode, wsize);
1761 -++ ext4_update_i_disksize(ea_inode, wsize);
1762 -++
1763 -++ ext4_mark_inode_dirty(handle, ea_inode);
1764 -++
1765 -++out:
1766 -++ brelse(bh);
1767 -++
1768 -++ return ret;
1769 -++}
1770 -++
1771 -++/*
1772 -++ * Create an inode to store the value of a large EA.
1773 -++ */
1774 -++static struct inode *
1775 -++ext4_xattr_inode_create(handle_t *handle, struct inode *inode)
1776 -++{
1777 -++ struct inode *ea_inode = NULL;
1778 -++
1779 -++ /*
1780 -++ * Let the next inode be the goal, so we try and allocate the EA inode
1781 -++ * in the same group, or nearby one.
1782 -++ */
1783 -++ ea_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode,
1784 -++ S_IFREG|0600, NULL, inode->i_ino + 1, NULL);
1785 -++
1786 -++ if (!IS_ERR(ea_inode)) {
1787 -++ ea_inode->i_op = &ext4_file_inode_operations;
1788 -++ ea_inode->i_fop = &ext4_file_operations;
1789 -++ ext4_set_aops(ea_inode);
1790 -++ ea_inode->i_generation = inode->i_generation;
1791 -++ EXT4_I(ea_inode)->i_flags |= EXT4_EA_INODE_FL;
1792 -++
1793 -++ /*
1794 -++ * A back-pointer from EA inode to parent inode will be useful
1795 -++ * for e2fsck.
1796 -++ */
1797 -++ ea_inode->i_xattr_inode_parent = inode->i_ino;
1798 -++ unlock_new_inode(ea_inode);
1799 -++ }
1800 -++
1801 -++ return ea_inode;
1802 -++}
1803 -++
1804 -++/*
1805 -++ * Unlink the inode storing the value of the EA.
1806 -++ */
1807 -+ static int
1808 -+-ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
1809 -++ext4_xattr_inode_unlink(struct inode *inode, int ea_ino)
1810 -++{
1811 -++ struct inode *ea_inode = NULL;
1812 -++ int err;
1813 -++
1814 -++ ea_inode = ext4_xattr_inode_iget(inode, ea_ino, &err);
1815 -++ if (err)
1816 -++ return err;
1817 -++
1818 -++ clear_nlink(ea_inode);
1819 -++ iput(ea_inode);
1820 -++
1821 -++ return 0;
1822 -++}
1823 -++
1824 -++/*
1825 -++ * Add value of the EA in an inode.
1826 -++ */
1827 -++static int
1828 -++ext4_xattr_inode_set(handle_t *handle, struct inode *inode, int *ea_ino,
1829 -++ const void *value, size_t value_len)
1830 -++{
1831 -++ struct inode *ea_inode = NULL;
1832 -++ int err;
1833 -++
1834 -++ /* Create an inode for the EA value */
1835 -++ ea_inode = ext4_xattr_inode_create(handle, inode);
1836 -++ if (IS_ERR(ea_inode))
1837 -++ return -1;
1838 -++
1839 -++ err = ext4_xattr_inode_write(handle, ea_inode, value, value_len);
1840 -++ if (err)
1841 -++ clear_nlink(ea_inode);
1842 -++ else
1843 -++ *ea_ino = ea_inode->i_ino;
1844 -++
1845 -++ iput(ea_inode);
1846 -++
1847 -++ return err;
1848 -++}
1849 -++
1850 -++static int
1851 -++ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s,
1852 -++ handle_t *handle, struct inode *inode)
1853 -+ {
1854 -+ struct ext4_xattr_entry *last;
1855 -+ size_t free, min_offs = s->end - s->base, name_len = strlen(i->name);
1856 -++ int in_inode = i->in_inode;
1857 -++
1858 -++ if (EXT4_HAS_INCOMPAT_FEATURE(inode->i_sb,
1859 -++ EXT4_FEATURE_INCOMPAT_EA_INODE) &&
1860 -++ (EXT4_XATTR_SIZE(i->value_len) >
1861 -++ EXT4_XATTR_MIN_LARGE_EA_SIZE(inode->i_sb->s_blocksize)))
1862 -++ in_inode = 1;
1863 -+
1864 -+ /* Compute min_offs and last. */
1865 -+ last = s->first;
1866 -+ for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
1867 -+- if (!last->e_value_block && last->e_value_size) {
1868 -++ if (last->e_value_inum == 0 && last->e_value_size > 0) {
1869 -+ size_t offs = le16_to_cpu(last->e_value_offs);
1870 -+ if (offs < min_offs)
1871 -+ min_offs = offs;
1872 -+@@ -594,16 +865,21 @@ ext4_xattr_set_entry(struct ext4_xattr_i
1873 -+ }
1874 -+ free = min_offs - ((void *)last - s->base) - sizeof(__u32);
1875 -+ if (!s->not_found) {
1876 -+- if (!s->here->e_value_block && s->here->e_value_size) {
1877 -++ if (!in_inode && s->here->e_value_inum == 0 &&
1878 -++ s->here->e_value_size > 0) {
1879 -+ size_t size = le32_to_cpu(s->here->e_value_size);
1880 -+ free += EXT4_XATTR_SIZE(size);
1881 -+ }
1882 -+ free += EXT4_XATTR_LEN(name_len);
1883 -+ }
1884 -+ if (i->value) {
1885 -+- if (free < EXT4_XATTR_SIZE(i->value_len) ||
1886 -+- free < EXT4_XATTR_LEN(name_len) +
1887 -+- EXT4_XATTR_SIZE(i->value_len))
1888 -++ size_t value_len = EXT4_XATTR_SIZE(i->value_len);
1889 -++
1890 -++ if (in_inode)
1891 -++ value_len = 0;
1892 -++
1893 -++ if (free < value_len ||
1894 -++ free < EXT4_XATTR_LEN(name_len) + value_len)
1895 -+ return -ENOSPC;
1896 -+ }
1897 -+
1898 -+@@ -617,7 +893,8 @@ ext4_xattr_set_entry(struct ext4_xattr_i
1899 -+ s->here->e_name_len = name_len;
1900 -+ memcpy(s->here->e_name, i->name, name_len);
1901 -+ } else {
1902 -+- if (!s->here->e_value_block && s->here->e_value_size) {
1903 -++ if (s->here->e_value_offs > 0 && s->here->e_value_inum == 0 &&
1904 -++ s->here->e_value_size > 0) {
1905 -+ void *first_val = s->base + min_offs;
1906 -+ size_t offs = le16_to_cpu(s->here->e_value_offs);
1907 -+ void *val = s->base + offs;
1908 -+@@ -651,13 +928,17 @@ ext4_xattr_set_entry(struct ext4_xattr_i
1909 -+ last = s->first;
1910 -+ while (!IS_LAST_ENTRY(last)) {
1911 -+ size_t o = le16_to_cpu(last->e_value_offs);
1912 -+- if (!last->e_value_block &&
1913 -+- last->e_value_size && o < offs)
1914 -++ if (last->e_value_size > 0 && o < offs)
1915 -+ last->e_value_offs =
1916 -+ cpu_to_le16(o + size);
1917 -+ last = EXT4_XATTR_NEXT(last);
1918 -+ }
1919 -+ }
1920 -++ if (s->here->e_value_inum != 0) {
1921 -++ ext4_xattr_inode_unlink(inode,
1922 -++ le32_to_cpu(s->here->e_value_inum));
1923 -++ s->here->e_value_inum = 0;
1924 -++ }
1925 -+ if (!i->value) {
1926 -+ /* Remove the old name. */
1927 -+ size_t size = EXT4_XATTR_LEN(name_len);
1928 -+@@ -671,10 +952,17 @@ ext4_xattr_set_entry(struct ext4_xattr_i
1929 -+ if (i->value) {
1930 -+ /* Insert the new value. */
1931 -+ s->here->e_value_size = cpu_to_le32(i->value_len);
1932 -+- if (i->value_len) {
1933 -++ if (in_inode) {
1934 -++ int ea_ino = le32_to_cpu(s->here->e_value_inum);
1935 -++ ext4_xattr_inode_set(handle, inode, &ea_ino, i->value,
1936 -++ i->value_len);
1937 -++ s->here->e_value_inum = cpu_to_le32(ea_ino);
1938 -++ s->here->e_value_offs = 0;
1939 -++ } else if (i->value_len) {
1940 -+ size_t size = EXT4_XATTR_SIZE(i->value_len);
1941 -+ void *val = s->base + min_offs - size;
1942 -+ s->here->e_value_offs = cpu_to_le16(min_offs - size);
1943 -++ s->here->e_value_inum = 0;
1944 -+ if (i->value == EXT4_ZERO_XATTR_VALUE) {
1945 -+ memset(val, 0, size);
1946 -+ } else {
1947 -+@@ -724,7 +1012,7 @@ ext4_xattr_block_find(struct inode *inod
1948 -+ bs->s.end = bs->bh->b_data + bs->bh->b_size;
1949 -+ bs->s.here = bs->s.first;
1950 -+ error = ext4_xattr_find_entry(&bs->s.here, i->name_index,
1951 -+- i->name, bs->bh->b_size, 1);
1952 -++ i->name, bs->bh->b_size, 1, inode);
1953 -+ if (error && error != -ENODATA)
1954 -+ goto cleanup;
1955 -+ bs->s.not_found = error;
1956 -+@@ -748,8 +1036,6 @@ ext4_xattr_block_set(handle_t *handle, s
1957 -+
1958 -+ #define header(x) ((struct ext4_xattr_header *)(x))
1959 -+
1960 -+- if (i->value && i->value_len > sb->s_blocksize)
1961 -+- return -ENOSPC;
1962 -+ if (s->base) {
1963 -+ ce = mb_cache_entry_get(ext4_xattr_cache, bs->bh->b_bdev,
1964 -+ bs->bh->b_blocknr);
1965 -+@@ -764,7 +1050,7 @@ ext4_xattr_block_set(handle_t *handle, s
1966 -+ ce = NULL;
1967 -+ }
1968 -+ ea_bdebug(bs->bh, "modifying in-place");
1969 -+- error = ext4_xattr_set_entry(i, s);
1970 -++ error = ext4_xattr_set_entry(i, s, handle, inode);
1971 -+ if (!error) {
1972 -+ if (!IS_LAST_ENTRY(s->first))
1973 -+ ext4_xattr_rehash(header(s->base),
1974 -+@@ -815,7 +1101,7 @@ ext4_xattr_block_set(handle_t *handle, s
1975 -+ s->end = s->base + sb->s_blocksize;
1976 -+ }
1977 -+
1978 -+- error = ext4_xattr_set_entry(i, s);
1979 -++ error = ext4_xattr_set_entry(i, s, handle, inode);
1980 -+ if (error == -EIO)
1981 -+ goto bad_block;
1982 -+ if (error)
1983 -+@@ -963,7 +1249,7 @@ int ext4_xattr_ibody_find(struct inode *
1984 -+ /* Find the named attribute. */
1985 -+ error = ext4_xattr_find_entry(&is->s.here, i->name_index,
1986 -+ i->name, is->s.end -
1987 -+- (void *)is->s.base, 0);
1988 -++ (void *)is->s.base, 0, inode);
1989 -+ if (error && error != -ENODATA)
1990 -+ return error;
1991 -+ is->s.not_found = error;
1992 -+@@ -981,7 +1267,7 @@ int ext4_xattr_ibody_inline_set(handle_t
1993 -+
1994 -+ if (EXT4_I(inode)->i_extra_isize == 0)
1995 -+ return -ENOSPC;
1996 -+- error = ext4_xattr_set_entry(i, s);
1997 -++ error = ext4_xattr_set_entry(i, s, handle, inode);
1998 -+ if (error) {
1999 -+ if (error == -ENOSPC &&
2000 -+ ext4_has_inline_data(inode)) {
2001 -+@@ -993,7 +1279,7 @@ int ext4_xattr_ibody_inline_set(handle_t
2002 -+ error = ext4_xattr_ibody_find(inode, i, is);
2003 -+ if (error)
2004 -+ return error;
2005 -+- error = ext4_xattr_set_entry(i, s);
2006 -++ error = ext4_xattr_set_entry(i, s, handle, inode);
2007 -+ }
2008 -+ if (error)
2009 -+ return error;
2010 -+@@ -1019,7 +1305,7 @@ static int ext4_xattr_ibody_set(handle_t
2011 -+
2012 -+ if (EXT4_I(inode)->i_extra_isize == 0)
2013 -+ return -ENOSPC;
2014 -+- error = ext4_xattr_set_entry(i, s);
2015 -++ error = ext4_xattr_set_entry(i, s, handle, inode);
2016 -+ if (error)
2017 -+ return error;
2018 -+ header = IHDR(inode, ext4_raw_inode(&is->iloc));
2019 -+@@ -1055,7 +1341,7 @@ ext4_xattr_set_handle(handle_t *handle,
2020 -+ .name = name,
2021 -+ .value = value,
2022 -+ .value_len = value_len,
2023 -+-
2024 -++ .in_inode = 0,
2025 -+ };
2026 -+ struct ext4_xattr_ibody_find is = {
2027 -+ .s = { .not_found = -ENODATA, },
2028 -+@@ -1120,6 +1406,15 @@ ext4_xattr_set_handle(handle_t *handle,
2029 -+ goto cleanup;
2030 -+ }
2031 -+ error = ext4_xattr_block_set(handle, inode, &i, &bs);
2032 -++ if (EXT4_HAS_INCOMPAT_FEATURE(inode->i_sb,
2033 -++ EXT4_FEATURE_INCOMPAT_EA_INODE) &&
2034 -++ error == -ENOSPC) {
2035 -++ /* xattr not fit to block, store at external
2036 -++ * inode */
2037 -++ i.in_inode = 1;
2038 -++ error = ext4_xattr_ibody_set(handle, inode,
2039 -++ &i, &is);
2040 -++ }
2041 -+ if (error)
2042 -+ goto cleanup;
2043 -+ if (!is.s.not_found) {
2044 -+@@ -1167,9 +1462,22 @@ ext4_xattr_set(struct inode *inode, int
2045 -+ const void *value, size_t value_len, int flags)
2046 -+ {
2047 -+ handle_t *handle;
2048 -++ struct super_block *sb = inode->i_sb;
2049 -+ int error, retries = 0;
2050 -+ int credits = ext4_jbd2_credits_xattr(inode);
2051 -+
2052 -++ if ((value_len >= EXT4_XATTR_MIN_LARGE_EA_SIZE(sb->s_blocksize)) &&
2053 -++ EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EA_INODE)) {
2054 -++ int nrblocks = (value_len + sb->s_blocksize - 1) >>
2055 -++ sb->s_blocksize_bits;
2056 -++
2057 -++ /* For new inode */
2058 -++ credits += EXT4_SINGLEDATA_TRANS_BLOCKS(sb) + 3;
2059 -++
2060 -++ /* For data blocks of EA inode */
2061 -++ credits += ext4_meta_trans_blocks(inode, nrblocks, 0);
2062 -++ }
2063 -++
2064 -+ retry:
2065 -+ handle = ext4_journal_start(inode, EXT4_HT_XATTR, credits);
2066 -+ if (IS_ERR(handle)) {
2067 -+@@ -1181,7 +1489,7 @@ retry:
2068 -+ value, value_len, flags);
2069 -+ error2 = ext4_journal_stop(handle);
2070 -+ if (error == -ENOSPC &&
2071 -+- ext4_should_retry_alloc(inode->i_sb, &retries))
2072 -++ ext4_should_retry_alloc(sb, &retries))
2073 -+ goto retry;
2074 -+ if (error == 0)
2075 -+ error = error2;
2076 -+@@ -1203,7 +1511,7 @@ static void ext4_xattr_shift_entries(str
2077 -+
2078 -+ /* Adjust the value offsets of the entries */
2079 -+ for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
2080 -+- if (!last->e_value_block && last->e_value_size) {
2081 -++ if (last->e_value_inum == 0 && last->e_value_size > 0) {
2082 -+ new_offs = le16_to_cpu(last->e_value_offs) +
2083 -+ value_offs_shift;
2084 -+ BUG_ON(new_offs + le32_to_cpu(last->e_value_size)
2085 -+@@ -1443,15 +1751,41 @@ cleanup:
2086 -+ /*
2087 -+ * ext4_xattr_delete_inode()
2088 -+ *
2089 -+- * Free extended attribute resources associated with this inode. This
2090 -++ * Free extended attribute resources associated with this inode. Traverse
2091 -++ * all entries and unlink any xattr inodes associated with this inode. This
2092 -+ * is called immediately before an inode is freed. We have exclusive
2093 -+- * access to the inode.
2094 -++ * access to the inode. If an orphan inode is deleted it will also delete any
2095 -++ * xattr block and all xattr inodes. They are checked by ext4_xattr_inode_iget()
2096 -++ * to ensure they belong to the parent inode and were not deleted already.
2097 -+ */
2098 -+ void
2099 -+ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode)
2100 -+ {
2101 -+ struct buffer_head *bh = NULL;
2102 -++ struct ext4_xattr_ibody_header *header;
2103 -++ struct ext4_inode *raw_inode;
2104 -++ struct ext4_iloc iloc;
2105 -++ struct ext4_xattr_entry *entry;
2106 -++ int error;
2107 -++
2108 -++ if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR))
2109 -++ goto delete_external_ea;
2110 -++
2111 -++ error = ext4_get_inode_loc(inode, &iloc);
2112 -++ if (error)
2113 -++ goto cleanup;
2114 -++ raw_inode = ext4_raw_inode(&iloc);
2115 -++ header = IHDR(inode, raw_inode);
2116 -++ entry = IFIRST(header);
2117 -++ for (; !IS_LAST_ENTRY(entry); entry = EXT4_XATTR_NEXT(entry)) {
2118 -++ if (entry->e_value_inum != 0) {
2119 -++ ext4_xattr_inode_unlink(inode,
2120 -++ le32_to_cpu(entry->e_value_inum));
2121 -++ entry->e_value_inum = 0;
2122 -++ }
2123 -++ }
2124 -+
2125 -++delete_external_ea:
2126 -+ if (!EXT4_I(inode)->i_file_acl)
2127 -+ goto cleanup;
2128 -+ bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);
2129 -+@@ -1466,6 +1800,16 @@ ext4_xattr_delete_inode(handle_t *handle
2130 -+ EXT4_I(inode)->i_file_acl);
2131 -+ goto cleanup;
2132 -+ }
2133 -++
2134 -++ entry = BFIRST(bh);
2135 -++ for (; !IS_LAST_ENTRY(entry); entry = EXT4_XATTR_NEXT(entry)) {
2136 -++ if (entry->e_value_inum != 0) {
2137 -++ ext4_xattr_inode_unlink(inode,
2138 -++ le32_to_cpu(entry->e_value_inum));
2139 -++ entry->e_value_inum = 0;
2140 -++ }
2141 -++ }
2142 -++
2143 -+ ext4_xattr_release_block(handle, inode, bh);
2144 -+ EXT4_I(inode)->i_file_acl = 0;
2145 -+
2146 -+@@ -1540,10 +1884,9 @@ ext4_xattr_cmp(struct ext4_xattr_header
2147 -+ entry1->e_name_index != entry2->e_name_index ||
2148 -+ entry1->e_name_len != entry2->e_name_len ||
2149 -+ entry1->e_value_size != entry2->e_value_size ||
2150 -++ entry1->e_value_inum != entry2->e_value_inum ||
2151 -+ memcmp(entry1->e_name, entry2->e_name, entry1->e_name_len))
2152 -+ return 1;
2153 -+- if (entry1->e_value_block != 0 || entry2->e_value_block != 0)
2154 -+- return -EIO;
2155 -+ if (memcmp((char *)header1 + le16_to_cpu(entry1->e_value_offs),
2156 -+ (char *)header2 + le16_to_cpu(entry2->e_value_offs),
2157 -+ le32_to_cpu(entry1->e_value_size)))
2158 -+@@ -1627,7 +1970,7 @@ static inline void ext4_xattr_hash_entry
2159 -+ *name++;
2160 -+ }
2161 -+
2162 -+- if (entry->e_value_block == 0 && entry->e_value_size != 0) {
2163 -++ if (entry->e_value_inum == 0 && entry->e_value_size != 0) {
2164 -+ __le32 *value = (__le32 *)((char *)header +
2165 -+ le16_to_cpu(entry->e_value_offs));
2166 -+ for (n = (le32_to_cpu(entry->e_value_size) +
2167 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/xattr.h
2168 -+===================================================================
2169 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/xattr.h
2170 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/xattr.h
2171 -+@@ -42,7 +42,7 @@ struct ext4_xattr_entry {
2172 -+ __u8 e_name_len; /* length of name */
2173 -+ __u8 e_name_index; /* attribute name index */
2174 -+ __le16 e_value_offs; /* offset in disk block of value */
2175 -+- __le32 e_value_block; /* disk block attribute is stored on (n/i) */
2176 -++ __le32 e_value_inum; /* inode in which the value is stored */
2177 -+ __le32 e_value_size; /* size of attribute value */
2178 -+ __le32 e_hash; /* hash value of name and value */
2179 -+ char e_name[0]; /* attribute name */
2180 -+@@ -67,6 +67,15 @@ struct ext4_xattr_entry {
2181 -+ EXT4_I(inode)->i_extra_isize))
2182 -+ #define IFIRST(hdr) ((struct ext4_xattr_entry *)((hdr)+1))
2183 -+
2184 -++#define i_xattr_inode_parent i_mtime.tv_sec
2185 -++
2186 -++/*
2187 -++ * The minimum size of EA value when you start storing it in an external inode
2188 -++ * size of block - size of header - size of 1 entry - 4 null bytes
2189 -++*/
2190 -++#define EXT4_XATTR_MIN_LARGE_EA_SIZE(b) \
2191 -++ ((b) - EXT4_XATTR_LEN(3) - sizeof(struct ext4_xattr_header) - 4)
2192 -++
2193 -+ #define BHDR(bh) ((struct ext4_xattr_header *)((bh)->b_data))
2194 -+ #define ENTRY(ptr) ((struct ext4_xattr_entry *)(ptr))
2195 -+ #define BFIRST(bh) ENTRY(BHDR(bh)+1)
2196 -+@@ -75,10 +84,11 @@ struct ext4_xattr_entry {
2197 -+ #define EXT4_ZERO_XATTR_VALUE ((void *)-1)
2198 -+
2199 -+ struct ext4_xattr_info {
2200 -+- int name_index;
2201 -+ const char *name;
2202 -+ const void *value;
2203 -+ size_t value_len;
2204 -++ int name_index;
2205 -++ int in_inode;
2206 -+ };
2207 -+
2208 -+ struct ext4_xattr_search {
2209 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/inline.c
2210 -+===================================================================
2211 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/inline.c
2212 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/inline.c
2213 -+@@ -59,7 +59,7 @@ static int get_max_inline_xattr_value_si
2214 -+
2215 -+ /* Compute min_offs. */
2216 -+ for (; !IS_LAST_ENTRY(entry); entry = EXT4_XATTR_NEXT(entry)) {
2217 -+- if (!entry->e_value_block && entry->e_value_size) {
2218 -++ if (!entry->e_value_inum && entry->e_value_size) {
2219 -+ size_t offs = le16_to_cpu(entry->e_value_offs);
2220 -+ if (offs < min_offs)
2221 -+ min_offs = offs;
2222 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-lookup-dotdot.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-lookup-dotdot.patch
2223 -new file mode 100644
2224 -index 0000000..f4318c5
2225 ---- /dev/null
2226 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-lookup-dotdot.patch
2227 -@@ -0,0 +1,37 @@
2228 -+Index: linux-3.10.9-200.fc17.x86_64/fs/ext4/namei.c
2229 -+===================================================================
2230 -+--- linux-3.10.9-200.fc17.x86_64.orig/fs/ext4/namei.c
2231 -++++ linux-3.10.9-200.fc17.x86_64/fs/ext4/namei.c
2232 -+@@ -1438,6 +1438,32 @@ static struct dentry *ext4_lookup(struct
2233 -+ return ERR_PTR(-EIO);
2234 -+ }
2235 -+ }
2236 -++ /* ".." shouldn't go into dcache to preserve dcache hierarchy
2237 -++ * otherwise we'll get parent being a child of actual child.
2238 -++ * see bug 10458 for details -bzzz */
2239 -++ if (inode && (dentry->d_name.name[0] == '.' && (dentry->d_name.len == 1 ||
2240 -++ (dentry->d_name.len == 2 && dentry->d_name.name[1] == '.')))) {
2241 -++ struct dentry *goal = NULL;
2242 -++
2243 -++ /* first, look for an existing dentry - any one is good */
2244 -++ goal = d_find_any_alias(inode);
2245 -++ if (goal == NULL) {
2246 -++ spin_lock(&dentry->d_lock);
2247 -++ /* there is no alias, we need to make current dentry:
2248 -++ * a) inaccessible for __d_lookup()
2249 -++ * b) inaccessible for iopen */
2250 -++ J_ASSERT(hlist_unhashed(&dentry->d_alias));
2251 -++ dentry->d_flags |= DCACHE_NFSFS_RENAMED;
2252 -++ /* this is d_instantiate() ... */
2253 -++ hlist_add_head(&dentry->d_alias, &inode->i_dentry);
2254 -++ dentry->d_inode = inode;
2255 -++ spin_unlock(&dentry->d_lock);
2256 -++ }
2257 -++ if (goal)
2258 -++ iput(inode);
2259 -++ return goal;
2260 -++ }
2261 -++
2262 -+ return d_splice_alias(inode, dentry);
2263 -+ }
2264 -+
2265 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-max-dir-size.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-max-dir-size.patch
2266 -new file mode 100644
2267 -index 0000000..a1e12a8
2268 ---- /dev/null
2269 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-max-dir-size.patch
2270 -@@ -0,0 +1,44 @@
2271 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
2272 -+===================================================================
2273 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/super.c
2274 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
2275 -+@@ -2485,8 +2485,11 @@ static ssize_t sbi_ui_show(struct ext4_a
2276 -+ struct ext4_sb_info *sbi, char *buf)
2277 -+ {
2278 -+ unsigned int *ui = (unsigned int *) (((char *) sbi) + a->u.offset);
2279 -++ unsigned int v = *ui;
2280 -+
2281 -+- return snprintf(buf, PAGE_SIZE, "%u\n", *ui);
2282 -++ if (strcmp("max_dir_size", a->attr.name) == 0)
2283 -++ v <<= 10;
2284 -++ return snprintf(buf, PAGE_SIZE, "%u\n", v);
2285 -+ }
2286 -+
2287 -+ static ssize_t sbi_ui_store(struct ext4_attr *a,
2288 -+@@ -2500,6 +2503,8 @@ static ssize_t sbi_ui_store(struct ext4_
2289 -+ ret = kstrtoul(skip_spaces(buf), 0, &t);
2290 -+ if (ret)
2291 -+ return ret;
2292 -++ if (strcmp("max_dir_size", a->attr.name) == 0)
2293 -++ t >>= 10;
2294 -+ *ui = t;
2295 -+ return count;
2296 -+ }
2297 -+@@ -2582,6 +2587,8 @@ EXT4_RW_ATTR(reserved_clusters);
2298 -+ EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show,
2299 -+ inode_readahead_blks_store, s_inode_readahead_blks);
2300 -+ EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal);
2301 -++EXT4_RW_ATTR_SBI_UI(max_dir_size, s_max_dir_size_kb);
2302 -++EXT4_RW_ATTR_SBI_UI(max_dir_size_kb, s_max_dir_size_kb);
2303 -+ EXT4_RW_ATTR_SBI_UI(mb_stats, s_mb_stats);
2304 -+ EXT4_RW_ATTR_SBI_UI(mb_max_to_scan, s_mb_max_to_scan);
2305 -+ EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan);
2306 -+@@ -2600,6 +2607,8 @@ static struct attribute *ext4_attrs[] =
2307 -+ ATTR_LIST(reserved_clusters),
2308 -+ ATTR_LIST(inode_readahead_blks),
2309 -+ ATTR_LIST(inode_goal),
2310 -++ ATTR_LIST(max_dir_size),
2311 -++ ATTR_LIST(max_dir_size_kb),
2312 -+ ATTR_LIST(mb_stats),
2313 -+ ATTR_LIST(mb_max_to_scan),
2314 -+ ATTR_LIST(mb_min_to_scan),
2315 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-mballoc-extra-checks.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-mballoc-extra-checks.patch
2316 -new file mode 100644
2317 -index 0000000..a0eb883
2318 ---- /dev/null
2319 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-mballoc-extra-checks.patch
2320 -@@ -0,0 +1,315 @@
2321 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
2322 -+===================================================================
2323 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4.h
2324 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
2325 -+@@ -2449,6 +2449,7 @@ struct ext4_group_info {
2326 -+ ext4_grpblk_t bb_fragments; /* nr of freespace fragments */
2327 -+ ext4_grpblk_t bb_largest_free_order;/* order of largest frag in BG */
2328 -+ struct list_head bb_prealloc_list;
2329 -++ unsigned long bb_prealloc_nr;
2330 -+ #ifdef DOUBLE_CHECK
2331 -+ void *bb_bitmap;
2332 -+ #endif
2333 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/mballoc.c
2334 -+===================================================================
2335 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/mballoc.c
2336 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/mballoc.c
2337 -+@@ -362,7 +362,7 @@ static const char *ext4_groupinfo_slab_n
2338 -+ "ext4_groupinfo_64k", "ext4_groupinfo_128k"
2339 -+ };
2340 -+
2341 -+-static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
2342 -++static int ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
2343 -+ ext4_group_t group);
2344 -+ static void ext4_mb_generate_from_freelist(struct super_block *sb, void *bitmap,
2345 -+ ext4_group_t group);
2346 -+@@ -718,7 +718,7 @@ mb_set_largest_free_order(struct super_b
2347 -+ }
2348 -+
2349 -+ static noinline_for_stack
2350 -+-void ext4_mb_generate_buddy(struct super_block *sb,
2351 -++int ext4_mb_generate_buddy(struct super_block *sb,
2352 -+ void *buddy, void *bitmap, ext4_group_t group)
2353 -+ {
2354 -+ struct ext4_group_info *grp = ext4_get_group_info(sb, group);
2355 -+@@ -750,14 +750,13 @@ void ext4_mb_generate_buddy(struct super
2356 -+ grp->bb_fragments = fragments;
2357 -+
2358 -+ if (free != grp->bb_free) {
2359 -+- ext4_grp_locked_error(sb, group, 0, 0,
2360 -+- "%u clusters in bitmap, %u in gd",
2361 -+- free, grp->bb_free);
2362 -+- /*
2363 -+- * If we intent to continue, we consider group descritor
2364 -+- * corrupt and update bb_free using bitmap value
2365 -+- */
2366 -+- grp->bb_free = free;
2367 -++ struct ext4_group_desc *gdp;
2368 -++ gdp = ext4_get_group_desc (sb, group, NULL);
2369 -++ ext4_error(sb, "group %lu: %u blocks in bitmap, %u in bb, "
2370 -++ "%u in gd, %lu pa's\n", (long unsigned int)group,
2371 -++ free, grp->bb_free, ext4_free_group_clusters(sb, gdp),
2372 -++ grp->bb_prealloc_nr);
2373 -++ return -EIO;
2374 -+ }
2375 -+ mb_set_largest_free_order(sb, grp);
2376 -+
2377 -+@@ -768,6 +767,8 @@ void ext4_mb_generate_buddy(struct super
2378 -+ EXT4_SB(sb)->s_mb_buddies_generated++;
2379 -+ EXT4_SB(sb)->s_mb_generation_time += period;
2380 -+ spin_unlock(&EXT4_SB(sb)->s_bal_lock);
2381 -++
2382 -++ return 0;
2383 -+ }
2384 -+
2385 -+ static void mb_regenerate_buddy(struct ext4_buddy *e4b)
2386 -+@@ -883,7 +884,7 @@ static int ext4_mb_init_cache(struct pag
2387 -+ }
2388 -+
2389 -+ first_block = page->index * blocks_per_page;
2390 -+- for (i = 0; i < blocks_per_page; i++) {
2391 -++ for (i = 0; i < blocks_per_page && err == 0; i++) {
2392 -+ group = (first_block + i) >> 1;
2393 -+ if (group >= ngroups)
2394 -+ break;
2395 -+@@ -922,7 +923,7 @@ static int ext4_mb_init_cache(struct pag
2396 -+ ext4_lock_group(sb, group);
2397 -+ /* init the buddy */
2398 -+ memset(data, 0xff, blocksize);
2399 -+- ext4_mb_generate_buddy(sb, data, incore, group);
2400 -++ err = ext4_mb_generate_buddy(sb, data, incore, group);
2401 -+ ext4_unlock_group(sb, group);
2402 -+ incore = NULL;
2403 -+ } else {
2404 -+@@ -937,7 +938,7 @@ static int ext4_mb_init_cache(struct pag
2405 -+ memcpy(data, bitmap, blocksize);
2406 -+
2407 -+ /* mark all preallocated blks used in in-core bitmap */
2408 -+- ext4_mb_generate_from_pa(sb, data, group);
2409 -++ err = ext4_mb_generate_from_pa(sb, data, group);
2410 -+ ext4_mb_generate_from_freelist(sb, data, group);
2411 -+ ext4_unlock_group(sb, group);
2412 -+
2413 -+@@ -947,7 +948,8 @@ static int ext4_mb_init_cache(struct pag
2414 -+ incore = data;
2415 -+ }
2416 -+ }
2417 -+- SetPageUptodate(page);
2418 -++ if (likely(err == 0))
2419 -++ SetPageUptodate(page);
2420 -+
2421 -+ out:
2422 -+ if (bh) {
2423 -+@@ -2224,9 +2226,11 @@ static void *ext4_mb_seq_groups_next(str
2424 -+ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
2425 -+ {
2426 -+ struct super_block *sb = seq->private;
2427 -++ struct ext4_group_desc *gdp;
2428 -+ ext4_group_t group = (ext4_group_t) ((unsigned long) v);
2429 -+ int i;
2430 -+ int err, buddy_loaded = 0;
2431 -++ int free = 0;
2432 -+ struct ext4_buddy e4b;
2433 -+ struct ext4_group_info *grinfo;
2434 -+ struct sg {
2435 -+@@ -2236,10 +2240,10 @@ static int ext4_mb_seq_groups_show(struc
2436 -+
2437 -+ group--;
2438 -+ if (group == 0)
2439 -+- seq_printf(seq, "#%-5s: %-5s %-5s %-5s "
2440 -++ seq_printf(seq, "#%-5s: %-5s %-5s %-5s %-5s %-5s"
2441 -+ "[ %-5s %-5s %-5s %-5s %-5s %-5s %-5s "
2442 -+ "%-5s %-5s %-5s %-5s %-5s %-5s %-5s ]\n",
2443 -+- "group", "free", "frags", "first",
2444 -++ "group", "free", "frags", "first", "first", "pa",
2445 -+ "2^0", "2^1", "2^2", "2^3", "2^4", "2^5", "2^6",
2446 -+ "2^7", "2^8", "2^9", "2^10", "2^11", "2^12", "2^13");
2447 -+
2448 -+@@ -2256,13 +2260,19 @@ static int ext4_mb_seq_groups_show(struc
2449 -+ buddy_loaded = 1;
2450 -+ }
2451 -+
2452 -++ gdp = ext4_get_group_desc(sb, group, NULL);
2453 -++ if (gdp != NULL)
2454 -++ free = ext4_free_group_clusters(sb, gdp);
2455 -++
2456 -+ memcpy(&sg, ext4_get_group_info(sb, group), i);
2457 -+
2458 -+ if (buddy_loaded)
2459 -+ ext4_mb_unload_buddy(&e4b);
2460 -+
2461 -+- seq_printf(seq, "#%-5u: %-5u %-5u %-5u [", group, sg.info.bb_free,
2462 -+- sg.info.bb_fragments, sg.info.bb_first_free);
2463 -++ seq_printf(seq, "#%-5lu: %-5u %-5u %-5u %-5u %-5lu [",
2464 -++ (long unsigned int)group, sg.info.bb_free, free,
2465 -++ sg.info.bb_fragments, sg.info.bb_first_free,
2466 -++ sg.info.bb_prealloc_nr);
2467 -+ for (i = 0; i <= 13; i++)
2468 -+ seq_printf(seq, " %-5u", i <= sb->s_blocksize_bits + 1 ?
2469 -+ sg.info.bb_counters[i] : 0);
2470 -+@@ -3507,22 +3517,67 @@ static void ext4_mb_generate_from_freeli
2471 -+ }
2472 -+
2473 -+ /*
2474 -++ * check free blocks in bitmap match free block in group descriptor
2475 -++ * do this before taking preallocated blocks into account to be able
2476 -++ * to detect on-disk corruptions. The group lock should be hold by the
2477 -++ * caller.
2478 -++ */
2479 -++int ext4_mb_check_ondisk_bitmap(struct super_block *sb, void *bitmap,
2480 -++ struct ext4_group_desc *gdp, int group)
2481 -++{
2482 -++ unsigned short max = EXT4_BLOCKS_PER_GROUP(sb);
2483 -++ unsigned short i, first, free = 0;
2484 -++
2485 -++ i = mb_find_next_zero_bit(bitmap, max, 0);
2486 -++
2487 -++ while (i < max) {
2488 -++ first = i;
2489 -++ i = mb_find_next_bit(bitmap, max, i);
2490 -++ if (i > max)
2491 -++ i = max;
2492 -++ free += i - first;
2493 -++ if (i < max)
2494 -++ i = mb_find_next_zero_bit(bitmap, max, i);
2495 -++ }
2496 -++
2497 -++ if (free != ext4_free_group_clusters(sb, gdp)) {
2498 -++ ext4_error(sb, "on-disk bitmap for group %d"
2499 -++ "corrupted: %u blocks free in bitmap, %u - in gd\n",
2500 -++ group, free, ext4_free_group_clusters(sb, gdp));
2501 -++ return -EIO;
2502 -++ }
2503 -++ return 0;
2504 -++}
2505 -++
2506 -++/*
2507 -+ * the function goes through all preallocation in this group and marks them
2508 -+ * used in in-core bitmap. buddy must be generated from this bitmap
2509 -+ * Need to be called with ext4 group lock held
2510 -+ */
2511 -+ static noinline_for_stack
2512 -+-void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
2513 -++int ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
2514 -+ ext4_group_t group)
2515 -+ {
2516 -+ struct ext4_group_info *grp = ext4_get_group_info(sb, group);
2517 -+ struct ext4_prealloc_space *pa;
2518 -++ struct ext4_group_desc *gdp;
2519 -+ struct list_head *cur;
2520 -+ ext4_group_t groupnr;
2521 -+ ext4_grpblk_t start;
2522 -+ int preallocated = 0;
2523 -++ int skip = 0, count = 0;
2524 -++ int err;
2525 -+ int len;
2526 -+
2527 -++ gdp = ext4_get_group_desc (sb, group, NULL);
2528 -++ if (gdp == NULL)
2529 -++ return -EIO;
2530 -++
2531 -++ /* before applying preallocations, check bitmap consistency */
2532 -++ err = ext4_mb_check_ondisk_bitmap(sb, bitmap, gdp, group);
2533 -++ if (err)
2534 -++ return err;
2535 -++
2536 -+ /* all form of preallocation discards first load group,
2537 -+ * so the only competing code is preallocation use.
2538 -+ * we don't need any locking here
2539 -+@@ -3538,13 +3593,23 @@ void ext4_mb_generate_from_pa(struct sup
2540 -+ &groupnr, &start);
2541 -+ len = pa->pa_len;
2542 -+ spin_unlock(&pa->pa_lock);
2543 -+- if (unlikely(len == 0))
2544 -++ if (unlikely(len == 0)) {
2545 -++ skip++;
2546 -+ continue;
2547 -++ }
2548 -+ BUG_ON(groupnr != group);
2549 -+ ext4_set_bits(bitmap, start, len);
2550 -+ preallocated += len;
2551 -++ count ++;
2552 -++ }
2553 -++ if (count + skip != grp->bb_prealloc_nr) {
2554 -++ ext4_error(sb, "lost preallocations: "
2555 -++ "count %d, bb_prealloc_nr %lu, skip %d\n",
2556 -++ count, grp->bb_prealloc_nr, skip);
2557 -++ return -EIO;
2558 -+ }
2559 -+ mb_debug(1, "prellocated %u for group %u\n", preallocated, group);
2560 -++ return 0;
2561 -+ }
2562 -+
2563 -+ static void ext4_mb_pa_callback(struct rcu_head *head)
2564 -+@@ -3603,6 +3668,7 @@ static void ext4_mb_put_pa(struct ext4_a
2565 -+ */
2566 -+ ext4_lock_group(sb, grp);
2567 -+ list_del(&pa->pa_group_list);
2568 -++ ext4_get_group_info(sb, grp)->bb_prealloc_nr--;
2569 -+ ext4_unlock_group(sb, grp);
2570 -+
2571 -+ spin_lock(pa->pa_obj_lock);
2572 -+@@ -3697,6 +3763,7 @@ ext4_mb_new_inode_pa(struct ext4_allocat
2573 -+
2574 -+ ext4_lock_group(sb, ac->ac_b_ex.fe_group);
2575 -+ list_add(&pa->pa_group_list, &grp->bb_prealloc_list);
2576 -++ grp->bb_prealloc_nr++;
2577 -+ ext4_unlock_group(sb, ac->ac_b_ex.fe_group);
2578 -+
2579 -+ spin_lock(pa->pa_obj_lock);
2580 -+@@ -3758,6 +3825,7 @@ ext4_mb_new_group_pa(struct ext4_allocat
2581 -+
2582 -+ ext4_lock_group(sb, ac->ac_b_ex.fe_group);
2583 -+ list_add(&pa->pa_group_list, &grp->bb_prealloc_list);
2584 -++ grp->bb_prealloc_nr++;
2585 -+ ext4_unlock_group(sb, ac->ac_b_ex.fe_group);
2586 -+
2587 -+ /*
2588 -+@@ -3927,6 +3995,8 @@ repeat:
2589 -+
2590 -+ spin_unlock(&pa->pa_lock);
2591 -+
2592 -++ BUG_ON(grp->bb_prealloc_nr == 0);
2593 -++ grp->bb_prealloc_nr--;
2594 -+ list_del(&pa->pa_group_list);
2595 -+ list_add(&pa->u.pa_tmp_list, &list);
2596 -+ }
2597 -+@@ -4056,7 +4126,7 @@ repeat:
2598 -+ if (err) {
2599 -+ ext4_error(sb, "Error loading buddy information for %u",
2600 -+ group);
2601 -+- continue;
2602 -++ return;
2603 -+ }
2604 -+
2605 -+ bitmap_bh = ext4_read_block_bitmap(sb, group);
2606 -+@@ -4068,6 +4138,8 @@ repeat:
2607 -+ }
2608 -+
2609 -+ ext4_lock_group(sb, group);
2610 -++ BUG_ON(e4b.bd_info->bb_prealloc_nr == 0);
2611 -++ e4b.bd_info->bb_prealloc_nr--;
2612 -+ list_del(&pa->pa_group_list);
2613 -+ ext4_mb_release_inode_pa(&e4b, bitmap_bh, pa);
2614 -+ ext4_unlock_group(sb, group);
2615 -+@@ -4328,6 +4400,7 @@ ext4_mb_discard_lg_preallocations(struct
2616 -+ }
2617 -+ ext4_lock_group(sb, group);
2618 -+ list_del(&pa->pa_group_list);
2619 -++ ext4_get_group_info(sb, group)->bb_prealloc_nr--;
2620 -+ ext4_mb_release_group_pa(&e4b, pa);
2621 -+ ext4_unlock_group(sb, group);
2622 -+
2623 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/mballoc.h
2624 -+===================================================================
2625 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/mballoc.h
2626 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/mballoc.h
2627 -+@@ -82,7 +82,7 @@ extern ushort ext4_mballoc_debug;
2628 -+ /*
2629 -+ * for which requests use 2^N search using buddies
2630 -+ */
2631 -+-#define MB_DEFAULT_ORDER2_REQS 2
2632 -++#define MB_DEFAULT_ORDER2_REQS 8
2633 -+
2634 -+ /*
2635 -+ * default group prealloc size 512 blocks
2636 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-mballoc-pa_free-mismatch.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-mballoc-pa_free-mismatch.patch
2637 -new file mode 100644
2638 -index 0000000..df69372
2639 ---- /dev/null
2640 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-mballoc-pa_free-mismatch.patch
2641 -@@ -0,0 +1,109 @@
2642 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/mballoc.c
2643 -+===================================================================
2644 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/mballoc.c
2645 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/mballoc.c
2646 -+@@ -3747,6 +3747,7 @@ ext4_mb_new_inode_pa(struct ext4_allocat
2647 -+ INIT_LIST_HEAD(&pa->pa_group_list);
2648 -+ pa->pa_deleted = 0;
2649 -+ pa->pa_type = MB_INODE_PA;
2650 -++ pa->pa_error = 0;
2651 -+
2652 -+ mb_debug(1, "new inode pa %p: %llu/%u for %u\n", pa,
2653 -+ pa->pa_pstart, pa->pa_len, pa->pa_lstart);
2654 -+@@ -3808,6 +3809,7 @@ ext4_mb_new_group_pa(struct ext4_allocat
2655 -+ INIT_LIST_HEAD(&pa->pa_group_list);
2656 -+ pa->pa_deleted = 0;
2657 -+ pa->pa_type = MB_GROUP_PA;
2658 -++ pa->pa_error = 0;
2659 -+
2660 -+ mb_debug(1, "new group pa %p: %llu/%u for %u\n", pa,
2661 -+ pa->pa_pstart, pa->pa_len, pa->pa_lstart);
2662 -+@@ -3868,7 +3870,9 @@ ext4_mb_release_inode_pa(struct ext4_bud
2663 -+ int err = 0;
2664 -+ int free = 0;
2665 -+
2666 -++ assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group));
2667 -+ BUG_ON(pa->pa_deleted == 0);
2668 -++ BUG_ON(pa->pa_inode == NULL);
2669 -+ ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit);
2670 -+ grp_blk_start = pa->pa_pstart - EXT4_C2B(sbi, bit);
2671 -+ BUG_ON(group != e4b->bd_group && pa->pa_len != 0);
2672 -+@@ -3891,12 +3895,18 @@ ext4_mb_release_inode_pa(struct ext4_bud
2673 -+ mb_free_blocks(pa->pa_inode, e4b, bit, next - bit);
2674 -+ bit = next + 1;
2675 -+ }
2676 -+- if (free != pa->pa_free) {
2677 -+- ext4_msg(e4b->bd_sb, KERN_CRIT,
2678 -+- "pa %p: logic %lu, phys. %lu, len %lu",
2679 -+- pa, (unsigned long) pa->pa_lstart,
2680 -+- (unsigned long) pa->pa_pstart,
2681 -+- (unsigned long) pa->pa_len);
2682 -++
2683 -++ /* "free < pa->pa_free" means we maybe double alloc the same blocks,
2684 -++ * otherwise maybe leave some free blocks unavailable, no need to BUG.*/
2685 -++ if ((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) {
2686 -++ ext4_error(sb, "pa free mismatch: [pa %p] "
2687 -++ "[phy %lu] [logic %lu] [len %u] [free %u] "
2688 -++ "[error %u] [inode %lu] [freed %u]", pa,
2689 -++ (unsigned long)pa->pa_pstart,
2690 -++ (unsigned long)pa->pa_lstart,
2691 -++ (unsigned)pa->pa_len, (unsigned)pa->pa_free,
2692 -++ (unsigned)pa->pa_error, pa->pa_inode->i_ino,
2693 -++ free);
2694 -+ ext4_grp_locked_error(sb, group, 0, 0, "free %u, pa_free %u",
2695 -+ free, pa->pa_free);
2696 -+ /*
2697 -+@@ -3904,6 +3914,7 @@ ext4_mb_release_inode_pa(struct ext4_bud
2698 -+ * from the bitmap and continue.
2699 -+ */
2700 -+ }
2701 -++ BUG_ON(pa->pa_free != free);
2702 -+ atomic_add(free, &sbi->s_mb_discarded);
2703 -+
2704 -+ return err;
2705 -+@@ -4661,6 +4672,25 @@ errout:
2706 -+ ac->ac_b_ex.fe_len = 0;
2707 -+ ar->len = 0;
2708 -+ ext4_mb_show_ac(ac);
2709 -++ if (ac->ac_pa) {
2710 -++ struct ext4_prealloc_space *pa = ac->ac_pa;
2711 -++
2712 -++ /* We can not make sure whether the bitmap has
2713 -++ * been updated or not when fail case. So can
2714 -++ * not revert pa_free back, just mark pa_error*/
2715 -++ pa->pa_error++;
2716 -++ ext4_error(sb,
2717 -++ "Updating bitmap error: [err %d] "
2718 -++ "[pa %p] [phy %lu] [logic %lu] "
2719 -++ "[len %u] [free %u] [error %u] "
2720 -++ "[inode %lu]", *errp, pa,
2721 -++ (unsigned long)pa->pa_pstart,
2722 -++ (unsigned long)pa->pa_lstart,
2723 -++ (unsigned)pa->pa_len,
2724 -++ (unsigned)pa->pa_free,
2725 -++ (unsigned)pa->pa_error,
2726 -++ pa->pa_inode ? pa->pa_inode->i_ino : 0);
2727 -++ }
2728 -+ }
2729 -+ ext4_mb_release_context(ac);
2730 -+ out:
2731 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/mballoc.h
2732 -+===================================================================
2733 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/mballoc.h
2734 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/mballoc.h
2735 -+@@ -19,6 +19,7 @@
2736 -+ #include <linux/seq_file.h>
2737 -+ #include <linux/blkdev.h>
2738 -+ #include <linux/mutex.h>
2739 -++#include <linux/genhd.h>
2740 -+ #include "ext4_jbd2.h"
2741 -+ #include "ext4.h"
2742 -+
2743 -+@@ -126,6 +127,7 @@ struct ext4_prealloc_space {
2744 -+ ext4_grpblk_t pa_free; /* how many blocks are free */
2745 -+ unsigned short pa_type; /* pa type. inode or group */
2746 -+ spinlock_t *pa_obj_lock;
2747 -++ unsigned short pa_error;
2748 -+ struct inode *pa_inode; /* hack, for history only */
2749 -+ };
2750 -+
2751 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-misc.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-misc.patch
2752 -new file mode 100644
2753 -index 0000000..1f0ab31
2754 ---- /dev/null
2755 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-misc.patch
2756 -@@ -0,0 +1,193 @@
2757 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
2758 -+===================================================================
2759 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4.h
2760 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
2761 -+@@ -1421,6 +1421,11 @@ static inline void ext4_clear_state_flag
2762 -+
2763 -+ #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
2764 -+
2765 -++/* Has been moved to linux/magic.h but we need it for Lustre */
2766 -++#define EXT4_SUPER_MAGIC 0xEF53
2767 -++#define JOURNAL_START_HAS_3ARGS 1
2768 -++#define HAVE_LDISKFS_MAP_BLOCKS 1
2769 -++
2770 -+ /*
2771 -+ * Codes for operating systems
2772 -+ */
2773 -+@@ -2670,6 +2675,8 @@ struct ext4_extent;
2774 -+
2775 -+ extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
2776 -+ extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
2777 -++extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb,
2778 -++ ext4_group_t block_group);
2779 -+ extern int ext4_ext_index_trans_blocks(struct inode *inode, int extents);
2780 -+ extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
2781 -+ struct ext4_map_blocks *map, int flags);
2782 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4_jbd2.c
2783 -+===================================================================
2784 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4_jbd2.c
2785 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4_jbd2.c
2786 -+@@ -34,6 +34,8 @@ static void ext4_put_nojournal(handle_t
2787 -+
2788 -+ current->journal_info = handle;
2789 -+ }
2790 -++EXPORT_SYMBOL(__ext4_journal_get_write_access);
2791 -++EXPORT_SYMBOL(__ext4_journal_start_sb);
2792 -+
2793 -+ /*
2794 -+ * Wrappers for jbd2_journal_start/end.
2795 -+@@ -299,3 +301,4 @@ int __ext4_handle_dirty_super(const char
2796 -+ mark_buffer_dirty(bh);
2797 -+ return err;
2798 -+ }
2799 -++EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
2800 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4_jbd2.h
2801 -+===================================================================
2802 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4_jbd2.h
2803 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4_jbd2.h
2804 -+@@ -37,6 +37,8 @@
2805 -+ (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
2806 -+ ? 20U : 8U)
2807 -+
2808 -++#define ext4_journal_dirty_metadata(handle, bh) \
2809 -++ ext4_handle_dirty_metadata(handle, NULL, bh)
2810 -+ /* Extended attribute operations touch at most two data buffers,
2811 -+ * two bitmap buffers, and two group summaries, in addition to the inode
2812 -+ * and the superblock, which are already accounted for. */
2813 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/inode.c
2814 -+===================================================================
2815 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/inode.c
2816 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/inode.c
2817 -+@@ -4222,6 +4222,9 @@ bad_inode:
2818 -+ iget_failed(inode);
2819 -+ return ERR_PTR(ret);
2820 -+ }
2821 -++EXPORT_SYMBOL(ext4_iget);
2822 -++EXPORT_SYMBOL(ext4_map_blocks);
2823 -++EXPORT_SYMBOL(ext4_truncate);
2824 -+
2825 -+ static int ext4_inode_blocks_set(handle_t *handle,
2826 -+ struct ext4_inode *raw_inode,
2827 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
2828 -+===================================================================
2829 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/super.c
2830 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
2831 -+@@ -1141,10 +1141,12 @@ enum {
2832 -+ Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
2833 -+ Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
2834 -+ Opt_noquota, Opt_barrier, Opt_nobarrier, Opt_err,
2835 -++ Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
2836 -+ Opt_usrquota, Opt_grpquota, Opt_i_version,
2837 -+ Opt_stripe, Opt_delalloc, Opt_nodelalloc, Opt_mblk_io_submit,
2838 -+ Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity,
2839 -+ Opt_inode_readahead_blks, Opt_journal_ioprio,
2840 -++ Opt_mballoc,
2841 -+ Opt_dioread_nolock, Opt_dioread_lock,
2842 -+ Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
2843 -+ Opt_max_dir_size_kb,
2844 -+@@ -1198,6 +1200,10 @@ static const match_table_t tokens = {
2845 -+ {Opt_noquota, "noquota"},
2846 -+ {Opt_quota, "quota"},
2847 -+ {Opt_usrquota, "usrquota"},
2848 -++ {Opt_iopen, "iopen"},
2849 -++ {Opt_noiopen, "noiopen"},
2850 -++ {Opt_iopen_nopriv, "iopen_nopriv"},
2851 -++ {Opt_mballoc, "mballoc"},
2852 -+ {Opt_barrier, "barrier=%u"},
2853 -+ {Opt_barrier, "barrier"},
2854 -+ {Opt_nobarrier, "nobarrier"},
2855 -+@@ -1457,6 +1463,11 @@ static int handle_mount_opt(struct super
2856 -+ case Opt_i_version:
2857 -+ sb->s_flags |= MS_I_VERSION;
2858 -+ return 1;
2859 -++ case Opt_iopen:
2860 -++ case Opt_noiopen:
2861 -++ case Opt_iopen_nopriv:
2862 -++ case Opt_mballoc:
2863 -++ return 1;
2864 -+ }
2865 -+
2866 -+ for (m = ext4_mount_opts; m->token != Opt_err; m++)
2867 -+@@ -4162,6 +4173,8 @@ out_free_orig:
2868 -+ return err ? err : ret;
2869 -+ }
2870 -+
2871 -++EXPORT_SYMBOL(ext4_force_commit);
2872 -++
2873 -+ /*
2874 -+ * Setup any per-fs journal parameters now. We'll do this both on
2875 -+ * initial mount, once the journal has been initialised but before we've
2876 -+@@ -5501,6 +5514,9 @@ static void __exit ext4_exit_fs(void)
2877 -+ ext4_exit_es();
2878 -+ }
2879 -+
2880 -++EXPORT_SYMBOL(ext4_bread);
2881 -++EXPORT_SYMBOL(__ext4_journal_stop);
2882 -++
2883 -+ MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
2884 -+ MODULE_DESCRIPTION("Fourth Extended Filesystem");
2885 -+ MODULE_LICENSE("GPL");
2886 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
2887 -+===================================================================
2888 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/namei.c
2889 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
2890 -+@@ -2210,7 +2210,7 @@ out:
2891 -+ * DIR_NLINK feature is set if 1) nlinks > EXT4_LINK_MAX or 2) nlinks == 2,
2892 -+ * since this indicates that nlinks count was previously 1.
2893 -+ */
2894 -+-static void ext4_inc_count(handle_t *handle, struct inode *inode)
2895 -++void ext4_inc_count(handle_t *handle, struct inode *inode)
2896 -+ {
2897 -+ inc_nlink(inode);
2898 -+ if (is_dx(inode) && inode->i_nlink > 1) {
2899 -+@@ -2222,16 +2222,18 @@ static void ext4_inc_count(handle_t *han
2900 -+ }
2901 -+ }
2902 -+ }
2903 -++EXPORT_SYMBOL(ext4_inc_count);
2904 -+
2905 -+ /*
2906 -+ * If a directory had nlink == 1, then we should let it be 1. This indicates
2907 -+ * directory has >EXT4_LINK_MAX subdirs.
2908 -+ */
2909 -+-static void ext4_dec_count(handle_t *handle, struct inode *inode)
2910 -++void ext4_dec_count(handle_t *handle, struct inode *inode)
2911 -+ {
2912 -+ if (!S_ISDIR(inode->i_mode) || inode->i_nlink > 2)
2913 -+ drop_nlink(inode);
2914 -+ }
2915 -++EXPORT_SYMBOL(ext4_dec_count);
2916 -+
2917 -+
2918 -+ static int ext4_add_nondir(handle_t *handle,
2919 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ialloc.c
2920 -+===================================================================
2921 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ialloc.c
2922 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ialloc.c
2923 -+@@ -111,7 +111,7 @@ void ext4_end_bitmap_read(struct buffer_
2924 -+ *
2925 -+ * Return buffer_head of bitmap on success or NULL.
2926 -+ */
2927 -+-static struct buffer_head *
2928 -++struct buffer_head *
2929 -+ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
2930 -+ {
2931 -+ struct ext4_group_desc *desc;
2932 -+@@ -191,6 +191,7 @@ verify:
2933 -+ set_buffer_verified(bh);
2934 -+ return bh;
2935 -+ }
2936 -++EXPORT_SYMBOL(ext4_read_inode_bitmap);
2937 -+
2938 -+ /*
2939 -+ * NOTE! When we get the inode, we're the only people
2940 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/extents.c
2941 -+===================================================================
2942 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/extents.c
2943 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/extents.c
2944 -+@@ -4774,3 +4774,5 @@ int ext4_fiemap(struct inode *inode, str
2945 -+
2946 -+ return error;
2947 -+ }
2948 -++
2949 -++EXPORT_SYMBOL(ext4_mark_inode_dirty);
2950 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-nocmtime.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-nocmtime.patch
2951 -new file mode 100644
2952 -index 0000000..0717d15
2953 ---- /dev/null
2954 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-nocmtime.patch
2955 -@@ -0,0 +1,28 @@
2956 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/xattr.c
2957 -+===================================================================
2958 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/xattr.c
2959 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/xattr.c
2960 -+@@ -1432,7 +1432,8 @@ ext4_xattr_set_handle(handle_t *handle,
2961 -+ }
2962 -+ if (!error) {
2963 -+ ext4_xattr_update_super_block(handle, inode->i_sb);
2964 -+- inode->i_ctime = ext4_current_time(inode);
2965 -++ if (!IS_NOCMTIME(inode))
2966 -++ inode->i_ctime = ext4_current_time(inode);
2967 -+ if (!value)
2968 -+ ext4_clear_inode_state(inode, EXT4_STATE_NO_EXPAND);
2969 -+ error = ext4_mark_iloc_dirty(handle, inode, &is.iloc);
2970 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
2971 -+===================================================================
2972 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/namei.c
2973 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
2974 -+@@ -1797,7 +1797,8 @@ static int add_dirent_to_buf(handle_t *h
2975 -+ * happen is that the times are slightly out of date
2976 -+ * and/or different from the directory change time.
2977 -+ */
2978 -+- dir->i_mtime = dir->i_ctime = ext4_current_time(dir);
2979 -++ if (!IS_NOCMTIME(dir))
2980 -++ dir->i_mtime = dir->i_ctime = ext4_current_time(dir);
2981 -+ ext4_update_dx_flag(dir);
2982 -+ dir->i_version++;
2983 -+ ext4_mark_inode_dirty(handle, dir);
2984 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-osd-iam-exports.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-osd-iam-exports.patch
2985 -new file mode 100644
2986 -index 0000000..1f2cf1a
2987 ---- /dev/null
2988 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-osd-iam-exports.patch
2989 -@@ -0,0 +1,56 @@
2990 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
2991 -+===================================================================
2992 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4.h
2993 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
2994 -+@@ -2167,6 +2167,9 @@ extern struct buffer_head * ext4_find_en
2995 -+ struct ext4_dir_entry_2 ** res_dir,
2996 -+ int *inlined);
2997 -+ #define ll_ext4_find_entry(inode, dentry, res_dir) ext4_find_entry(inode, &(dentry)->d_name, res_dir, NULL)
2998 -++extern struct buffer_head *ext4_append(handle_t *handle,
2999 -++ struct inode *inode,
3000 -++ ext4_lblk_t *block);
3001 -+ extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
3002 -+ struct inode *inode);
3003 -+ extern int search_dir(struct buffer_head *bh,
3004 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/hash.c
3005 -+===================================================================
3006 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/hash.c
3007 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/hash.c
3008 -+@@ -206,3 +206,4 @@ int ext4fs_dirhash(const char *name, int
3009 -+ hinfo->minor_hash = minor_hash;
3010 -+ return 0;
3011 -+ }
3012 -++EXPORT_SYMBOL(ext4fs_dirhash);
3013 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
3014 -+===================================================================
3015 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/namei.c
3016 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
3017 -+@@ -48,7 +48,7 @@
3018 -+ #define NAMEI_RA_BLOCKS 4
3019 -+ #define NAMEI_RA_SIZE (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)
3020 -+
3021 -+-static struct buffer_head *ext4_append(handle_t *handle,
3022 -++struct buffer_head *ext4_append(handle_t *handle,
3023 -+ struct inode *inode,
3024 -+ ext4_lblk_t *block)
3025 -+ {
3026 -+@@ -163,6 +163,7 @@ static struct buffer_head *__ext4_read_d
3027 -+ }
3028 -+ return bh;
3029 -+ }
3030 -++EXPORT_SYMBOL(ext4_append);
3031 -+
3032 -+ #ifndef assert
3033 -+ #define assert(test) J_ASSERT(test)
3034 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
3035 -+===================================================================
3036 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/super.c
3037 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
3038 -+@@ -552,6 +552,7 @@ void __ext4_std_error(struct super_block
3039 -+
3040 -+ ext4_handle_error(sb);
3041 -+ }
3042 -++EXPORT_SYMBOL(__ext4_std_error);
3043 -+
3044 -+ /*
3045 -+ * ext4_abort is a much stronger failure handler than ext4_error. The
3046 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-osd-iop-common.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-osd-iop-common.patch
3047 -new file mode 100644
3048 -index 0000000..64e82d7
3049 ---- /dev/null
3050 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-osd-iop-common.patch
3051 -@@ -0,0 +1,135 @@
3052 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
3053 -+===================================================================
3054 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4.h
3055 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
3056 -+@@ -2155,6 +2155,20 @@ extern int ext4_orphan_add(handle_t *, s
3057 -+ extern int ext4_orphan_del(handle_t *, struct inode *);
3058 -+ extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
3059 -+ __u32 start_minor_hash, __u32 *next_hash);
3060 -++extern struct inode *ext4_create_inode(handle_t *handle,
3061 -++ struct inode * dir, int mode);
3062 -++extern int ext4_add_entry(handle_t *handle, struct dentry *dentry,
3063 -++ struct inode *inode);
3064 -++extern int ext4_delete_entry(handle_t *handle, struct inode * dir,
3065 -++ struct ext4_dir_entry_2 * de_del,
3066 -++ struct buffer_head * bh);
3067 -++extern struct buffer_head * ext4_find_entry(struct inode *dir,
3068 -++ const struct qstr *d_name,
3069 -++ struct ext4_dir_entry_2 ** res_dir,
3070 -++ int *inlined);
3071 -++#define ll_ext4_find_entry(inode, dentry, res_dir) ext4_find_entry(inode, &(dentry)->d_name, res_dir, NULL)
3072 -++extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
3073 -++ struct inode *inode);
3074 -+ extern int search_dir(struct buffer_head *bh,
3075 -+ char *search_buf,
3076 -+ int buf_size,
3077 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
3078 -+===================================================================
3079 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/namei.c
3080 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
3081 -+@@ -1218,7 +1218,7 @@ static int is_dx_internal_node(struct in
3082 -+ * The returned buffer_head has ->b_count elevated. The caller is expected
3083 -+ * to brelse() it when appropriate.
3084 -+ */
3085 -+-static struct buffer_head * ext4_find_entry (struct inode *dir,
3086 -++struct buffer_head * ext4_find_entry(struct inode *dir,
3087 -+ const struct qstr *d_name,
3088 -+ struct ext4_dir_entry_2 **res_dir,
3089 -+ int *inlined)
3090 -+@@ -1362,6 +1362,7 @@ cleanup_and_exit:
3091 -+ brelse(bh_use[ra_ptr]);
3092 -+ return ret;
3093 -+ }
3094 -++EXPORT_SYMBOL(ext4_find_entry);
3095 -+
3096 -+ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, const struct qstr *d_name,
3097 -+ struct ext4_dir_entry_2 **res_dir, int *err)
3098 -+@@ -1910,8 +1911,8 @@ static int make_indexed_dir(handle_t *ha
3099 -+ * may not sleep between calling this and putting something into
3100 -+ * the entry, as someone else might have used it while you slept.
3101 -+ */
3102 -+-static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
3103 -+- struct inode *inode)
3104 -++int ext4_add_entry(handle_t *handle, struct dentry *dentry,
3105 -++ struct inode *inode)
3106 -+ {
3107 -+ struct inode *dir = dentry->d_parent->d_inode;
3108 -+ struct buffer_head *bh;
3109 -+@@ -1986,6 +1987,7 @@ static int ext4_add_entry(handle_t *hand
3110 -+ ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY);
3111 -+ return retval;
3112 -+ }
3113 -++EXPORT_SYMBOL(ext4_add_entry);
3114 -+
3115 -+ /*
3116 -+ * Returns 0 for success, or a negative error value
3117 -+@@ -2172,7 +2174,7 @@ int ext4_generic_delete_entry(handle_t *
3118 -+ return -ENOENT;
3119 -+ }
3120 -+
3121 -+-static int ext4_delete_entry(handle_t *handle,
3122 -++int ext4_delete_entry(handle_t *handle,
3123 -+ struct inode *dir,
3124 -+ struct ext4_dir_entry_2 *de_del,
3125 -+ struct buffer_head *bh)
3126 -+@@ -2213,7 +2215,7 @@ out:
3127 -+ ext4_std_error(dir->i_sb, err);
3128 -+ return err;
3129 -+ }
3130 -+-
3131 -++EXPORT_SYMBOL(ext4_delete_entry);
3132 -+ /*
3133 -+ * DIR_NLINK feature is set if 1) nlinks > EXT4_LINK_MAX or 2) nlinks == 2,
3134 -+ * since this indicates that nlinks count was previously 1.
3135 -+@@ -2260,6 +2262,27 @@ static int ext4_add_nondir(handle_t *han
3136 -+ return err;
3137 -+ }
3138 -+
3139 -++struct inode * ext4_create_inode(handle_t *handle, struct inode * dir, int mode)
3140 -++{
3141 -++ struct inode *inode;
3142 -++
3143 -++ inode = ext4_new_inode(handle, dir, mode, NULL, 0, NULL);
3144 -++ if (!IS_ERR(inode)) {
3145 -++ if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode)) {
3146 -++#ifdef CONFIG_LDISKFS_FS_XATTR
3147 -++ inode->i_op = &ext4_special_inode_operations;
3148 -++#endif
3149 -++ } else {
3150 -++ inode->i_op = &ext4_file_inode_operations;
3151 -++ inode->i_fop = &ext4_file_operations;
3152 -++ ext4_set_aops(inode);
3153 -++ }
3154 -++ unlock_new_inode(inode);
3155 -++ }
3156 -++ return inode;
3157 -++}
3158 -++EXPORT_SYMBOL(ext4_create_inode);
3159 -++
3160 -+ /*
3161 -+ * By the time this is called, we already have created
3162 -+ * the directory cache entry for the new file, but it
3163 -+@@ -2448,6 +2471,23 @@ out:
3164 -+ return err;
3165 -+ }
3166 -+
3167 -++/* Initialize @inode as a subdirectory of @dir, and add the
3168 -++ * "." and ".." entries into the first directory block. */
3169 -++int ext4_add_dot_dotdot(handle_t *handle, struct inode * dir,
3170 -++ struct inode *inode)
3171 -++{
3172 -++ if (IS_ERR(handle))
3173 -++ return PTR_ERR(handle);
3174 -++
3175 -++ if (IS_DIRSYNC(dir))
3176 -++ ext4_handle_sync(handle);
3177 -++
3178 -++ inode->i_op = &ext4_dir_inode_operations;
3179 -++ inode->i_fop = &ext4_dir_operations;
3180 -++ return ext4_init_new_dir(handle, dir, inode);
3181 -++}
3182 -++EXPORT_SYMBOL(ext4_add_dot_dotdot);
3183 -++
3184 -+ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
3185 -+ {
3186 -+ handle_t *handle;
3187 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-pdir-fix.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-pdir-fix.patch
3188 -new file mode 100644
3189 -index 0000000..db24d01
3190 ---- /dev/null
3191 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-pdir-fix.patch
3192 -@@ -0,0 +1,61 @@
3193 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
3194 -+===================================================================
3195 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4.h
3196 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
3197 -+@@ -793,6 +793,9 @@ struct ext4_inode_info {
3198 -+ __u32 i_dtime;
3199 -+ ext4_fsblk_t i_file_acl;
3200 -+
3201 -++ /* following fields for parallel directory operations -bzzz */
3202 -++ struct semaphore i_append_sem;
3203 -++
3204 -+ /*
3205 -+ * i_block_group is the number of the block group which contains
3206 -+ * this file's inode. Constant across the lifetime of the inode,
3207 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
3208 -+===================================================================
3209 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/namei.c
3210 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
3211 -+@@ -53,6 +53,7 @@ static struct buffer_head *ext4_append(h
3212 -+ ext4_lblk_t *block)
3213 -+ {
3214 -+ struct buffer_head *bh;
3215 -++ struct ext4_inode_info *ei = EXT4_I(inode);
3216 -+ int err = 0;
3217 -+
3218 -+ if (unlikely(EXT4_SB(inode->i_sb)->s_max_dir_size_kb &&
3219 -+@@ -60,14 +61,21 @@ static struct buffer_head *ext4_append(h
3220 -+ EXT4_SB(inode->i_sb)->s_max_dir_size_kb)))
3221 -+ return ERR_PTR(-ENOSPC);
3222 -+
3223 -++ /* with parallel dir operations all appends
3224 -++ * have to be serialized -bzzz */
3225 -++ down(&ei->i_append_sem);
3226 -++
3227 -+ *block = inode->i_size >> inode->i_sb->s_blocksize_bits;
3228 -+
3229 -+ bh = ext4_bread(handle, inode, *block, 1, &err);
3230 -+- if (!bh)
3231 -++ if (!bh) {
3232 -++ up(&ei->i_append_sem);
3233 -+ return ERR_PTR(err);
3234 -++ }
3235 -+ inode->i_size += inode->i_sb->s_blocksize;
3236 -+ EXT4_I(inode)->i_disksize = inode->i_size;
3237 -+ err = ext4_journal_get_write_access(handle, bh);
3238 -++ up(&ei->i_append_sem);
3239 -+ if (err) {
3240 -+ brelse(bh);
3241 -+ ext4_std_error(inode->i_sb, err);
3242 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
3243 -+===================================================================
3244 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/super.c
3245 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
3246 -+@@ -859,6 +859,7 @@ static struct inode *ext4_alloc_inode(st
3247 -+ return NULL;
3248 -+
3249 -+ ei->vfs_inode.i_version = 1;
3250 -++ sema_init(&ei->i_append_sem, 1);
3251 -+ INIT_LIST_HEAD(&ei->i_prealloc_list);
3252 -+ spin_lock_init(&ei->i_prealloc_lock);
3253 -+ ext4_es_init_tree(&ei->i_es_tree);
3254 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4-prealloc.patch b/ldiskfs/kernel_patches/patches/fc19/ext4-prealloc.patch
3255 -new file mode 100644
3256 -index 0000000..cb54844
3257 ---- /dev/null
3258 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4-prealloc.patch
3259 -@@ -0,0 +1,387 @@
3260 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
3261 -+===================================================================
3262 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4.h
3263 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
3264 -+@@ -1237,11 +1237,14 @@ struct ext4_sb_info {
3265 -+
3266 -+ /* tunables */
3267 -+ unsigned long s_stripe;
3268 -+- unsigned int s_mb_stream_request;
3269 -++ unsigned long s_mb_small_req;
3270 -++ unsigned long s_mb_large_req;
3271 -+ unsigned int s_mb_max_to_scan;
3272 -+ unsigned int s_mb_min_to_scan;
3273 -+ unsigned int s_mb_stats;
3274 -+ unsigned int s_mb_order2_reqs;
3275 -++ unsigned long *s_mb_prealloc_table;
3276 -++ unsigned long s_mb_prealloc_table_size;
3277 -+ unsigned int s_mb_group_prealloc;
3278 -+ unsigned int s_max_dir_size_kb;
3279 -+ /* where last allocation was done - for stream allocation */
3280 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/mballoc.c
3281 -+===================================================================
3282 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/mballoc.c
3283 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/mballoc.c
3284 -+@@ -1828,6 +1828,25 @@ int ext4_mb_find_by_goal(struct ext4_all
3285 -+ return 0;
3286 -+ }
3287 -+
3288 -++static void ext4_mb_prealloc_table_add(struct ext4_sb_info *sbi, int value)
3289 -++{
3290 -++ int i;
3291 -++
3292 -++ if (value > (sbi->s_blocks_per_group - 1 - 1 - sbi->s_itb_per_group))
3293 -++ return;
3294 -++
3295 -++ for (i = 0; i < sbi->s_mb_prealloc_table_size; i++) {
3296 -++ if (sbi->s_mb_prealloc_table[i] == 0) {
3297 -++ sbi->s_mb_prealloc_table[i] = value;
3298 -++ return;
3299 -++ }
3300 -++
3301 -++ /* they should add values in order */
3302 -++ if (value <= sbi->s_mb_prealloc_table[i])
3303 -++ return;
3304 -++ }
3305 -++}
3306 -++
3307 -+ /*
3308 -+ * The routine scans buddy structures (not bitmap!) from given order
3309 -+ * to max order and tries to find big enough chunk to satisfy the req
3310 -+@@ -2263,6 +2282,86 @@ static const struct seq_operations ext4_
3311 -+ .show = ext4_mb_seq_groups_show,
3312 -+ };
3313 -+
3314 -++#define EXT4_MB_PREALLOC_TABLE "prealloc_table"
3315 -++
3316 -++static ssize_t ext4_mb_prealloc_table_proc_write(struct file *file,
3317 -++ const char __user *buf,
3318 -++ size_t cnt, loff_t *pos)
3319 -++{
3320 -++ struct ext4_sb_info *sbi = EXT4_SB(PDE_DATA(file_inode(file)));
3321 -++ unsigned long value;
3322 -++ unsigned long prev = 0;
3323 -++ char str[128];
3324 -++ char *cur;
3325 -++ char *end;
3326 -++ unsigned long *new_table;
3327 -++ int num = 0;
3328 -++ int i = 0;
3329 -++
3330 -++ if (cnt >= sizeof(str))
3331 -++ return -EINVAL;
3332 -++ if (copy_from_user(str, buf, cnt))
3333 -++ return -EFAULT;
3334 -++
3335 -++ num = 0;
3336 -++ cur = str;
3337 -++ end = str + cnt;
3338 -++ while (cur < end) {
3339 -++ while ((cur < end) && (*cur == ' ')) cur++;
3340 -++ value = simple_strtol(cur, &cur, 0);
3341 -++ if (value == 0)
3342 -++ break;
3343 -++ if (value <= prev)
3344 -++ return -EINVAL;
3345 -++ prev = value;
3346 -++ num++;
3347 -++ }
3348 -++
3349 -++ new_table = kmalloc(num * sizeof(*new_table), GFP_KERNEL);
3350 -++ if (new_table == NULL)
3351 -++ return -ENOMEM;
3352 -++ kfree(sbi->s_mb_prealloc_table);
3353 -++ memset(new_table, 0, num * sizeof(*new_table));
3354 -++ sbi->s_mb_prealloc_table = new_table;
3355 -++ sbi->s_mb_prealloc_table_size = num;
3356 -++ cur = str;
3357 -++ end = str + cnt;
3358 -++ while (cur < end && i < num) {
3359 -++ while ((cur < end) && (*cur == ' ')) cur++;
3360 -++ value = simple_strtol(cur, &cur, 0);
3361 -++ ext4_mb_prealloc_table_add(sbi, value);
3362 -++ i++;
3363 -++ }
3364 -++
3365 -++ return cnt;
3366 -++}
3367 -++
3368 -++static int mb_prealloc_table_seq_show(struct seq_file *m, void *v)
3369 -++{
3370 -++ struct ext4_sb_info *sbi = EXT4_SB(m->private);
3371 -++ int i;
3372 -++
3373 -++ for (i = 0; i < sbi->s_mb_prealloc_table_size; i++)
3374 -++ seq_printf(m, "%ld ", sbi->s_mb_prealloc_table[i]);
3375 -++ seq_printf(m, "\n");
3376 -++
3377 -++ return 0;
3378 -++}
3379 -++
3380 -++static int mb_prealloc_table_seq_open(struct inode *inode, struct file *file)
3381 -++{
3382 -++ return single_open(file, mb_prealloc_table_seq_show, PDE_DATA(inode));
3383 -++}
3384 -++
3385 -++struct file_operations ext4_mb_prealloc_seq_fops = {
3386 -++ .owner = THIS_MODULE,
3387 -++ .open = mb_prealloc_table_seq_open,
3388 -++ .read = seq_read,
3389 -++ .llseek = seq_lseek,
3390 -++ .release = single_release,
3391 -++ .write = ext4_mb_prealloc_table_proc_write,
3392 -++};
3393 -++
3394 -+ static int ext4_mb_seq_groups_open(struct inode *inode, struct file *file)
3395 -+ {
3396 -+ struct super_block *sb = PDE_DATA(inode);
3397 -+@@ -2557,7 +2656,6 @@ int ext4_mb_init(struct super_block *sb)
3398 -+ sbi->s_mb_max_to_scan = MB_DEFAULT_MAX_TO_SCAN;
3399 -+ sbi->s_mb_min_to_scan = MB_DEFAULT_MIN_TO_SCAN;
3400 -+ sbi->s_mb_stats = MB_DEFAULT_STATS;
3401 -+- sbi->s_mb_stream_request = MB_DEFAULT_STREAM_THRESHOLD;
3402 -+ sbi->s_mb_order2_reqs = MB_DEFAULT_ORDER2_REQS;
3403 -+ /*
3404 -+ * The default group preallocation is 512, which for 4k block
3405 -+@@ -2581,9 +2679,48 @@ int ext4_mb_init(struct super_block *sb)
3406 -+ * RAID stripe size so that preallocations don't fragment
3407 -+ * the stripes.
3408 -+ */
3409 -+- if (sbi->s_stripe > 1) {
3410 -+- sbi->s_mb_group_prealloc = roundup(
3411 -+- sbi->s_mb_group_prealloc, sbi->s_stripe);
3412 -++
3413 -++ if (sbi->s_stripe == 0) {
3414 -++ sbi->s_mb_prealloc_table_size = 10;
3415 -++ i = sbi->s_mb_prealloc_table_size * sizeof(unsigned long);
3416 -++ sbi->s_mb_prealloc_table = kmalloc(i, GFP_NOFS);
3417 -++ if (sbi->s_mb_prealloc_table == NULL) {
3418 -++ ret = -ENOMEM;
3419 -++ goto out;
3420 -++ }
3421 -++ memset(sbi->s_mb_prealloc_table, 0, i);
3422 -++
3423 -++ ext4_mb_prealloc_table_add(sbi, 4);
3424 -++ ext4_mb_prealloc_table_add(sbi, 8);
3425 -++ ext4_mb_prealloc_table_add(sbi, 16);
3426 -++ ext4_mb_prealloc_table_add(sbi, 32);
3427 -++ ext4_mb_prealloc_table_add(sbi, 64);
3428 -++ ext4_mb_prealloc_table_add(sbi, 128);
3429 -++ ext4_mb_prealloc_table_add(sbi, 256);
3430 -++ ext4_mb_prealloc_table_add(sbi, 512);
3431 -++ ext4_mb_prealloc_table_add(sbi, 1024);
3432 -++ ext4_mb_prealloc_table_add(sbi, 2048);
3433 -++
3434 -++ sbi->s_mb_small_req = 256;
3435 -++ sbi->s_mb_large_req = 1024;
3436 -++ sbi->s_mb_group_prealloc = 512;
3437 -++ } else {
3438 -++ sbi->s_mb_prealloc_table_size = 3;
3439 -++ i = sbi->s_mb_prealloc_table_size * sizeof(unsigned long);
3440 -++ sbi->s_mb_prealloc_table = kmalloc(i, GFP_NOFS);
3441 -++ if (sbi->s_mb_prealloc_table == NULL) {
3442 -++ ret = -ENOMEM;
3443 -++ goto out;
3444 -++ }
3445 -++ memset(sbi->s_mb_prealloc_table, 0, i);
3446 -++
3447 -++ ext4_mb_prealloc_table_add(sbi, sbi->s_stripe);
3448 -++ ext4_mb_prealloc_table_add(sbi, sbi->s_stripe * 2);
3449 -++ ext4_mb_prealloc_table_add(sbi, sbi->s_stripe * 4);
3450 -++
3451 -++ sbi->s_mb_small_req = sbi->s_stripe;
3452 -++ sbi->s_mb_large_req = sbi->s_stripe * 8;
3453 -++ sbi->s_mb_group_prealloc = sbi->s_stripe * 4;
3454 -+ }
3455 -+
3456 -+ sbi->s_locality_groups = alloc_percpu(struct ext4_locality_group);
3457 -+@@ -2605,9 +2742,13 @@ int ext4_mb_init(struct super_block *sb)
3458 -+ if (ret != 0)
3459 -+ goto out_free_locality_groups;
3460 -+
3461 -+- if (sbi->s_proc)
3462 -++ if (sbi->s_proc) {
3463 -+ proc_create_data("mb_groups", S_IRUGO, sbi->s_proc,
3464 -+ &ext4_mb_seq_groups_fops, sb);
3465 -++ proc_create_data(EXT4_MB_PREALLOC_TABLE, S_IFREG | S_IRUGO |
3466 -++ S_IWUSR, sbi->s_proc,
3467 -++ &ext4_mb_prealloc_seq_fops, sb);
3468 -++ }
3469 -+
3470 -+ return 0;
3471 -+
3472 -+@@ -2615,6 +2756,7 @@ out_free_locality_groups:
3473 -+ free_percpu(sbi->s_locality_groups);
3474 -+ sbi->s_locality_groups = NULL;
3475 -+ out_free_groupinfo_slab:
3476 -++ kfree(sbi->s_mb_prealloc_table);
3477 -+ ext4_groupinfo_destroy_slabs();
3478 -+ out:
3479 -+ kfree(sbi->s_mb_offsets);
3480 -+@@ -2651,8 +2793,10 @@ int ext4_mb_release(struct super_block *
3481 -+ struct ext4_sb_info *sbi = EXT4_SB(sb);
3482 -+ struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits);
3483 -+
3484 -+- if (sbi->s_proc)
3485 -++ if (sbi->s_proc) {
3486 -+ remove_proc_entry("mb_groups", sbi->s_proc);
3487 -++ remove_proc_entry(EXT4_MB_PREALLOC_TABLE, sbi->s_proc);
3488 -++ }
3489 -+
3490 -+ if (sbi->s_group_info) {
3491 -+ for (i = 0; i < ngroups; i++) {
3492 -+@@ -2963,9 +3107,9 @@ ext4_mb_normalize_request(struct ext4_al
3493 -+ struct ext4_allocation_request *ar)
3494 -+ {
3495 -+ struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
3496 -+- int bsbits, max;
3497 -++ int bsbits, i, wind;
3498 -+ ext4_lblk_t end;
3499 -+- loff_t size, start_off;
3500 -++ loff_t size;
3501 -+ loff_t orig_size __maybe_unused;
3502 -+ ext4_lblk_t start;
3503 -+ struct ext4_inode_info *ei = EXT4_I(ac->ac_inode);
3504 -+@@ -2998,50 +3142,34 @@ ext4_mb_normalize_request(struct ext4_al
3505 -+ size = size << bsbits;
3506 -+ if (size < i_size_read(ac->ac_inode))
3507 -+ size = i_size_read(ac->ac_inode);
3508 -+- orig_size = size;
3509 -++ size = (size + ac->ac_sb->s_blocksize - 1) >> bsbits;
3510 -+
3511 -+- /* max size of free chunks */
3512 -+- max = 2 << bsbits;
3513 -++ start = wind = 0;
3514 -+
3515 -+-#define NRL_CHECK_SIZE(req, size, max, chunk_size) \
3516 -+- (req <= (size) || max <= (chunk_size))
3517 -++ /* let's choose preallocation window depending on file size */
3518 -++ for (i = 0; i < sbi->s_mb_prealloc_table_size; i++) {
3519 -++ if (size <= sbi->s_mb_prealloc_table[i]) {
3520 -++ wind = sbi->s_mb_prealloc_table[i];
3521 -++ break;
3522 -++ }
3523 -++ }
3524 -++ size = wind;
3525 -+
3526 -+- /* first, try to predict filesize */
3527 -+- /* XXX: should this table be tunable? */
3528 -+- start_off = 0;
3529 -+- if (size <= 16 * 1024) {
3530 -+- size = 16 * 1024;
3531 -+- } else if (size <= 32 * 1024) {
3532 -+- size = 32 * 1024;
3533 -+- } else if (size <= 64 * 1024) {
3534 -+- size = 64 * 1024;
3535 -+- } else if (size <= 128 * 1024) {
3536 -+- size = 128 * 1024;
3537 -+- } else if (size <= 256 * 1024) {
3538 -+- size = 256 * 1024;
3539 -+- } else if (size <= 512 * 1024) {
3540 -+- size = 512 * 1024;
3541 -+- } else if (size <= 1024 * 1024) {
3542 -+- size = 1024 * 1024;
3543 -+- } else if (NRL_CHECK_SIZE(size, 4 * 1024 * 1024, max, 2 * 1024)) {
3544 -+- start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
3545 -+- (21 - bsbits)) << 21;
3546 -+- size = 2 * 1024 * 1024;
3547 -+- } else if (NRL_CHECK_SIZE(size, 8 * 1024 * 1024, max, 4 * 1024)) {
3548 -+- start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
3549 -+- (22 - bsbits)) << 22;
3550 -+- size = 4 * 1024 * 1024;
3551 -+- } else if (NRL_CHECK_SIZE(ac->ac_o_ex.fe_len,
3552 -+- (8<<20)>>bsbits, max, 8 * 1024)) {
3553 -+- start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
3554 -+- (23 - bsbits)) << 23;
3555 -+- size = 8 * 1024 * 1024;
3556 -+- } else {
3557 -+- start_off = (loff_t)ac->ac_o_ex.fe_logical << bsbits;
3558 -+- size = ac->ac_o_ex.fe_len << bsbits;
3559 -++ if (wind == 0) {
3560 -++ __u64 tstart, tend;
3561 -++ /* file is quite large, we now preallocate with
3562 -++ * the biggest configured window with regart to
3563 -++ * logical offset */
3564 -++ wind = sbi->s_mb_prealloc_table[i - 1];
3565 -++ tstart = ac->ac_o_ex.fe_logical;
3566 -++ do_div(tstart, wind);
3567 -++ start = tstart * wind;
3568 -++ tend = ac->ac_o_ex.fe_logical + ac->ac_o_ex.fe_len - 1;
3569 -++ do_div(tend, wind);
3570 -++ tend = tend * wind + wind;
3571 -++ size = tend - start;
3572 -+ }
3573 -+- size = size >> bsbits;
3574 -+- start = start_off >> bsbits;
3575 -++ orig_size = size;
3576 -+
3577 -+ /* don't cover already allocated blocks in selected range */
3578 -+ if (ar->pleft && start <= ar->lleft) {
3579 -+@@ -3117,7 +3245,6 @@ ext4_mb_normalize_request(struct ext4_al
3580 -+ }
3581 -+ BUG_ON(start + size <= ac->ac_o_ex.fe_logical &&
3582 -+ start > ac->ac_o_ex.fe_logical);
3583 -+- BUG_ON(size <= 0 || size > EXT4_CLUSTERS_PER_GROUP(ac->ac_sb));
3584 -+
3585 -+ /* now prepare goal request */
3586 -+
3587 -+@@ -4056,11 +4183,19 @@ static void ext4_mb_group_or_file(struct
3588 -+
3589 -+ /* don't use group allocation for large files */
3590 -+ size = max(size, isize);
3591 -+- if (size > sbi->s_mb_stream_request) {
3592 -++ if ((ac->ac_o_ex.fe_len >= sbi->s_mb_small_req) ||
3593 -++ (size >= sbi->s_mb_large_req)) {
3594 -+ ac->ac_flags |= EXT4_MB_STREAM_ALLOC;
3595 -+ return;
3596 -+ }
3597 -+
3598 -++ /*
3599 -++ * request is so large that we don't care about
3600 -++ * streaming - it overweights any possible seek
3601 -++ */
3602 -++ if (ac->ac_o_ex.fe_len >= sbi->s_mb_large_req)
3603 -++ return;
3604 -++
3605 -+ BUG_ON(ac->ac_lg != NULL);
3606 -+ /*
3607 -+ * locality group prealloc space are per cpu. The reason for having
3608 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
3609 -+===================================================================
3610 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/super.c
3611 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/super.c
3612 -+@@ -2564,7 +2564,8 @@ EXT4_RW_ATTR_SBI_UI(mb_stats, s_mb_stats
3613 -+ EXT4_RW_ATTR_SBI_UI(mb_max_to_scan, s_mb_max_to_scan);
3614 -+ EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan);
3615 -+ EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs);
3616 -+-EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request);
3617 -++EXT4_RW_ATTR_SBI_UI(mb_small_req, s_mb_small_req);
3618 -++EXT4_RW_ATTR_SBI_UI(mb_large_req, s_mb_large_req);
3619 -+ EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc);
3620 -+ EXT4_DEPRECATED_ATTR(max_writeback_mb_bump, 128);
3621 -+ EXT4_RW_ATTR_SBI_UI(extent_max_zeroout_kb, s_extent_max_zeroout_kb);
3622 -+@@ -2581,7 +2582,8 @@ static struct attribute *ext4_attrs[] =
3623 -+ ATTR_LIST(mb_max_to_scan),
3624 -+ ATTR_LIST(mb_min_to_scan),
3625 -+ ATTR_LIST(mb_order2_req),
3626 -+- ATTR_LIST(mb_stream_req),
3627 -++ ATTR_LIST(mb_small_req),
3628 -++ ATTR_LIST(mb_large_req),
3629 -+ ATTR_LIST(mb_group_prealloc),
3630 -+ ATTR_LIST(max_writeback_mb_bump),
3631 -+ ATTR_LIST(extent_max_zeroout_kb),
3632 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/inode.c
3633 -+===================================================================
3634 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/inode.c
3635 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/inode.c
3636 -+@@ -2434,6 +2434,10 @@ static int ext4_writepages(struct addres
3637 -+ ext4_journal_stop(handle);
3638 -+ }
3639 -+
3640 -++ if (wbc->nr_to_write < sbi->s_mb_small_req) {
3641 -++ wbc->nr_to_write = sbi->s_mb_small_req;
3642 -++ }
3643 -++
3644 -+ if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
3645 -+ range_whole = 1;
3646 -+
3647 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4_data_in_dirent.patch b/ldiskfs/kernel_patches/patches/fc19/ext4_data_in_dirent.patch
3648 -new file mode 100644
3649 -index 0000000..7e8e94d
3650 ---- /dev/null
3651 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4_data_in_dirent.patch
3652 -@@ -0,0 +1,649 @@
3653 -+this patch implements feature which allows ext4 fs users (e.g. Lustre)
3654 -+to store data in ext4 dirent.
3655 -+data is stored in ext4 dirent after file-name, this space is accounted
3656 -+in de->rec_len. flag EXT4_DIRENT_LUFID added to d_type if extra data
3657 -+is present.
3658 -+
3659 -+make use of dentry->d_fsdata to pass fid to ext4. so no
3660 -+changes in ext4_add_entry() interface required.
3661 -+
3662 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/dir.c
3663 -+===================================================================
3664 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/dir.c
3665 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/dir.c
3666 -+@@ -70,11 +70,11 @@ int __ext4_check_dir_entry(const char *f
3667 -+ const int rlen = ext4_rec_len_from_disk(de->rec_len,
3668 -+ dir->i_sb->s_blocksize);
3669 -+
3670 -+- if (unlikely(rlen < EXT4_DIR_REC_LEN(1)))
3671 -++ if (unlikely(rlen < __EXT4_DIR_REC_LEN(1)))
3672 -+ error_msg = "rec_len is smaller than minimal";
3673 -+ else if (unlikely(rlen % 4 != 0))
3674 -+ error_msg = "rec_len % 4 != 0";
3675 -+- else if (unlikely(rlen < EXT4_DIR_REC_LEN(de->name_len)))
3676 -++ else if (unlikely(rlen < EXT4_DIR_REC_LEN(de)))
3677 -+ error_msg = "rec_len is too small for name_len";
3678 -+ else if (unlikely(((char *) de - buf) + rlen > size))
3679 -+ error_msg = "directory entry across range";
3680 -+@@ -202,7 +202,7 @@ static int ext4_readdir(struct file *fil
3681 -+ * failure will be detected in the
3682 -+ * dirent test below. */
3683 -+ if (ext4_rec_len_from_disk(de->rec_len,
3684 -+- sb->s_blocksize) < EXT4_DIR_REC_LEN(1))
3685 -++ sb->s_blocksize) < __EXT4_DIR_REC_LEN(1))
3686 -+ break;
3687 -+ i += ext4_rec_len_from_disk(de->rec_len,
3688 -+ sb->s_blocksize);
3689 -+@@ -421,12 +421,17 @@ int ext4_htree_store_dirent(struct file
3690 -+ struct fname *fname, *new_fn;
3691 -+ struct dir_private_info *info;
3692 -+ int len;
3693 -++ int extra_data = 1;
3694 -+
3695 -+ info = dir_file->private_data;
3696 -+ p = &info->root.rb_node;
3697 -+
3698 -+ /* Create and allocate the fname structure */
3699 -+- len = sizeof(struct fname) + dirent->name_len + 1;
3700 -++ if (dirent->file_type & EXT4_DIRENT_LUFID)
3701 -++ extra_data = ext4_get_dirent_data_len(dirent);
3702 -++
3703 -++ len = sizeof(struct fname) + dirent->name_len + extra_data;
3704 -++
3705 -+ new_fn = kzalloc(len, GFP_KERNEL);
3706 -+ if (!new_fn)
3707 -+ return -ENOMEM;
3708 -+@@ -435,7 +440,7 @@ int ext4_htree_store_dirent(struct file
3709 -+ new_fn->inode = le32_to_cpu(dirent->inode);
3710 -+ new_fn->name_len = dirent->name_len;
3711 -+ new_fn->file_type = dirent->file_type;
3712 -+- memcpy(new_fn->name, dirent->name, dirent->name_len);
3713 -++ memcpy(new_fn->name, dirent->name, dirent->name_len + extra_data);
3714 -+ new_fn->name[dirent->name_len] = 0;
3715 -+
3716 -+ while (*p) {
3717 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
3718 -+===================================================================
3719 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4.h
3720 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
3721 -+@@ -1534,6 +1534,7 @@ static inline void ext4_clear_state_flag
3722 -+ EXT4_FEATURE_INCOMPAT_64BIT| \
3723 -+ EXT4_FEATURE_INCOMPAT_FLEX_BG| \
3724 -+ EXT4_FEATURE_INCOMPAT_MMP | \
3725 -++ EXT4_FEATURE_INCOMPAT_DIRDATA| \
3726 -+ EXT4_FEATURE_INCOMPAT_INLINE_DATA)
3727 -+ #define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
3728 -+ EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
3729 -+@@ -1640,6 +1641,43 @@ struct ext4_dir_entry_tail {
3730 -+ #define EXT4_FT_SYMLINK 7
3731 -+
3732 -+ #define EXT4_FT_MAX 8
3733 -++#define EXT4_FT_MASK 0xf
3734 -++
3735 -++#if EXT4_FT_MAX > EXT4_FT_MASK
3736 -++#error "conflicting EXT4_FT_MAX and EXT4_FT_MASK"
3737 -++#endif
3738 -++
3739 -++/*
3740 -++ * d_type has 4 unused bits, so it can hold four types data. these different
3741 -++ * type of data (e.g. lustre data, high 32 bits of 64-bit inode number) can be
3742 -++ * stored, in flag order, after file-name in ext4 dirent.
3743 -++*/
3744 -++/*
3745 -++ * this flag is added to d_type if ext4 dirent has extra data after
3746 -++ * filename. this data length is variable and length is stored in first byte
3747 -++ * of data. data start after filename NUL byte.
3748 -++ * This is used by Lustre FS.
3749 -++ */
3750 -++#define EXT4_DIRENT_LUFID 0x10
3751 -++
3752 -++#define EXT4_LUFID_MAGIC 0xAD200907UL
3753 -++struct ext4_dentry_param {
3754 -++ __u32 edp_magic; /* EXT4_LUFID_MAGIC */
3755 -++ char edp_len; /* size of edp_data in bytes */
3756 -++ char edp_data[0]; /* packed array of data */
3757 -++} __attribute__((packed));
3758 -++
3759 -++static inline unsigned char *ext4_dentry_get_data(struct super_block *sb,
3760 -++ struct ext4_dentry_param* p)
3761 -++
3762 -++{
3763 -++ if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_DIRDATA))
3764 -++ return NULL;
3765 -++ if (p && p->edp_magic == EXT4_LUFID_MAGIC)
3766 -++ return &p->edp_len;
3767 -++ else
3768 -++ return NULL;
3769 -++}
3770 -+
3771 -+ #define EXT4_FT_DIR_CSUM 0xDE
3772 -+
3773 -+@@ -1650,8 +1688,11 @@ struct ext4_dir_entry_tail {
3774 -+ */
3775 -+ #define EXT4_DIR_PAD 4
3776 -+ #define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1)
3777 -+-#define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \
3778 -++#define __EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \
3779 -+ ~EXT4_DIR_ROUND)
3780 -++#define EXT4_DIR_REC_LEN(de) (__EXT4_DIR_REC_LEN((de)->name_len +\
3781 -++ ext4_get_dirent_data_len(de)))
3782 -++
3783 -+ #define EXT4_MAX_REC_LEN ((1<<16)-1)
3784 -+
3785 -+ /*
3786 -+@@ -1998,7 +2039,7 @@ extern int ext4_find_dest_de(struct inod
3787 -+ void ext4_insert_dentry(struct inode *inode,
3788 -+ struct ext4_dir_entry_2 *de,
3789 -+ int buf_size,
3790 -+- const char *name, int namelen);
3791 -++ const char *name, int namelen, void *data);
3792 -+ static inline void ext4_update_dx_flag(struct inode *inode)
3793 -+ {
3794 -+ if (!EXT4_HAS_COMPAT_FEATURE(inode->i_sb,
3795 -+@@ -2011,11 +2052,18 @@ static unsigned char ext4_filetype_table
3796 -+
3797 -+ static inline unsigned char get_dtype(struct super_block *sb, int filetype)
3798 -+ {
3799 -++ int fl_index = filetype & EXT4_FT_MASK;
3800 -++
3801 -+ if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FILETYPE) ||
3802 -+- (filetype >= EXT4_FT_MAX))
3803 -++ (fl_index >= EXT4_FT_MAX))
3804 -+ return DT_UNKNOWN;
3805 -+
3806 -+- return ext4_filetype_table[filetype];
3807 -++ if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_DIRDATA))
3808 -++ return (ext4_filetype_table[fl_index]);
3809 -++
3810 -++ return (ext4_filetype_table[fl_index]) |
3811 -++ (filetype & EXT4_DIRENT_LUFID);
3812 -++
3813 -+ }
3814 -+
3815 -+ /* fsync.c */
3816 -+@@ -2171,7 +2219,7 @@ extern struct buffer_head *ext4_append(h
3817 -+ struct inode *inode,
3818 -+ ext4_lblk_t *block);
3819 -+ extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
3820 -+- struct inode *inode);
3821 -++ struct inode *inode, const void *, const void *);
3822 -+ extern int search_dir(struct buffer_head *bh,
3823 -+ char *search_buf,
3824 -+ int buf_size,
3825 -+@@ -2827,6 +2875,28 @@ extern struct mutex ext4__aio_mutex[EXT4
3826 -+ extern int ext4_resize_begin(struct super_block *sb);
3827 -+ extern void ext4_resize_end(struct super_block *sb);
3828 -+
3829 -++/*
3830 -++ * Compute the total directory entry data length.
3831 -++ * This includes the filename and an implicit NUL terminator (always present),
3832 -++ * and optional extensions. Each extension has a bit set in the high 4 bits of
3833 -++ * de->file_type, and the extension length is the first byte in each entry.
3834 -++ */
3835 -++static inline int ext4_get_dirent_data_len(struct ext4_dir_entry_2 *de)
3836 -++{
3837 -++ char *len = de->name + de->name_len + 1 /* NUL terminator */;
3838 -++ int dlen = 0;
3839 -++ __u8 extra_data_flags = (de->file_type & ~EXT4_FT_MASK) >> 4;
3840 -++
3841 -++ while (extra_data_flags) {
3842 -++ if (extra_data_flags & 1) {
3843 -++ dlen += *len + (dlen == 0);
3844 -++ len += *len;
3845 -++ }
3846 -++ extra_data_flags >>= 1;
3847 -++ }
3848 -++ return dlen;
3849 -++}
3850 -++
3851 -+ #endif /* __KERNEL__ */
3852 -+
3853 -+ #endif /* _EXT4_H */
3854 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
3855 -+===================================================================
3856 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/namei.c
3857 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
3858 -+@@ -247,7 +247,8 @@ static unsigned dx_get_count(struct dx_e
3859 -+ static unsigned dx_get_limit(struct dx_entry *entries);
3860 -+ static void dx_set_count(struct dx_entry *entries, unsigned value);
3861 -+ static void dx_set_limit(struct dx_entry *entries, unsigned value);
3862 -+-static unsigned dx_root_limit(struct inode *dir, unsigned infosize);
3863 -++static inline unsigned dx_root_limit(struct inode *dir,
3864 -++ struct ext4_dir_entry_2 *dot_de, unsigned infosize);
3865 -+ static unsigned dx_node_limit(struct inode *dir);
3866 -+ static struct dx_frame *dx_probe(const struct qstr *d_name,
3867 -+ struct inode *dir,
3868 -+@@ -512,11 +513,12 @@ ext4_next_entry(struct ext4_dir_entry_2
3869 -+ */
3870 -+ struct dx_root_info * dx_get_dx_info(struct ext4_dir_entry_2 *de)
3871 -+ {
3872 -+- /* get dotdot first */
3873 -+- de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(1));
3874 -++ BUG_ON(de->name_len != 1);
3875 -++ /* get dotdot first */
3876 -++ de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(de));
3877 -+
3878 -+- /* dx root info is after dotdot entry */
3879 -+- de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(2));
3880 -++ /* dx root info is after dotdot entry */
3881 -++ de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(de));
3882 -+
3883 -+ return (struct dx_root_info *) de;
3884 -+ }
3885 -+@@ -561,10 +563,16 @@ static inline void dx_set_limit(struct d
3886 -+ ((struct dx_countlimit *) entries)->limit = cpu_to_le16(value);
3887 -+ }
3888 -+
3889 -+-static inline unsigned dx_root_limit(struct inode *dir, unsigned infosize)
3890 -++static inline unsigned dx_root_limit(struct inode *dir,
3891 -++ struct ext4_dir_entry_2 *dot_de, unsigned infosize)
3892 -+ {
3893 -+- unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(1) -
3894 -+- EXT4_DIR_REC_LEN(2) - infosize;
3895 -++ struct ext4_dir_entry_2 *dotdot_de;
3896 -++ unsigned entry_space;
3897 -++
3898 -++ BUG_ON(dot_de->name_len != 1);
3899 -++ dotdot_de = ext4_next_entry(dot_de, dir->i_sb->s_blocksize);
3900 -++ entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(dot_de) -
3901 -++ EXT4_DIR_REC_LEN(dotdot_de) - infosize;
3902 -+
3903 -+ if (EXT4_HAS_RO_COMPAT_FEATURE(dir->i_sb,
3904 -+ EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
3905 -+@@ -574,7 +582,7 @@ static inline unsigned dx_root_limit(str
3906 -+
3907 -+ static inline unsigned dx_node_limit(struct inode *dir)
3908 -+ {
3909 -+- unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(0);
3910 -++ unsigned entry_space = dir->i_sb->s_blocksize - __EXT4_DIR_REC_LEN(0);
3911 -+
3912 -+ if (EXT4_HAS_RO_COMPAT_FEATURE(dir->i_sb,
3913 -+ EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
3914 -+@@ -625,7 +633,7 @@ static struct stats dx_show_leaf(struct
3915 -+ printk(":%x.%u ", h.hash,
3916 -+ (unsigned) ((char *) de - base));
3917 -+ }
3918 -+- space += EXT4_DIR_REC_LEN(de->name_len);
3919 -++ space += EXT4_DIR_REC_LEN(de);
3920 -+ names++;
3921 -+ }
3922 -+ de = ext4_next_entry(de, size);
3923 -+@@ -731,6 +739,7 @@ dx_probe(const struct qstr *d_name, stru
3924 -+ entries = (struct dx_entry *) (((char *)info) + info->info_length);
3925 -+
3926 -+ if (dx_get_limit(entries) != dx_root_limit(dir,
3927 -++ (struct ext4_dir_entry_2*)bh->b_data,
3928 -+ info->info_length)) {
3929 -+ ext4_warning(dir->i_sb, "dx entry: limit != root limit");
3930 -+ brelse(bh);
3931 -+@@ -924,7 +933,7 @@ static int htree_dirblock_to_tree(struct
3932 -+ de = (struct ext4_dir_entry_2 *) bh->b_data;
3933 -+ top = (struct ext4_dir_entry_2 *) ((char *) de +
3934 -+ dir->i_sb->s_blocksize -
3935 -+- EXT4_DIR_REC_LEN(0));
3936 -++ __EXT4_DIR_REC_LEN(0));
3937 -+ for (; de < top; de = ext4_next_entry(de, dir->i_sb->s_blocksize)) {
3938 -+ if (ext4_check_dir_entry(dir, NULL, de, bh,
3939 -+ bh->b_data, bh->b_size,
3940 -+@@ -1516,7 +1525,7 @@ dx_move_dirents(char *from, char *to, st
3941 -+ while (count--) {
3942 -+ struct ext4_dir_entry_2 *de = (struct ext4_dir_entry_2 *)
3943 -+ (from + (map->offs<<2));
3944 -+- rec_len = EXT4_DIR_REC_LEN(de->name_len);
3945 -++ rec_len = EXT4_DIR_REC_LEN(de);
3946 -+ memcpy (to, de, rec_len);
3947 -+ ((struct ext4_dir_entry_2 *) to)->rec_len =
3948 -+ ext4_rec_len_to_disk(rec_len, blocksize);
3949 -+@@ -1540,7 +1549,7 @@ static struct ext4_dir_entry_2* dx_pack_
3950 -+ while ((char*)de < base + blocksize) {
3951 -+ next = ext4_next_entry(de, blocksize);
3952 -+ if (de->inode && de->name_len) {
3953 -+- rec_len = EXT4_DIR_REC_LEN(de->name_len);
3954 -++ rec_len = EXT4_DIR_REC_LEN(de);
3955 -+ if (de > to)
3956 -+ memmove(to, de, rec_len);
3957 -+ to->rec_len = ext4_rec_len_to_disk(rec_len, blocksize);
3958 -+@@ -1675,11 +1684,12 @@ int ext4_find_dest_de(struct inode *dir,
3959 -+ struct ext4_dir_entry_2 **dest_de)
3960 -+ {
3961 -+ struct ext4_dir_entry_2 *de;
3962 -+- unsigned short reclen = EXT4_DIR_REC_LEN(namelen);
3963 -++ unsigned short reclen = __EXT4_DIR_REC_LEN((namelen & 0xffff) + (namelen >> 16));
3964 -+ int nlen, rlen;
3965 -+ unsigned int offset = 0;
3966 -+ char *top;
3967 -+
3968 -++ namelen &= 0xffff;
3969 -+ de = (struct ext4_dir_entry_2 *)buf;
3970 -+ top = buf + buf_size - reclen;
3971 -+ while ((char *) de <= top) {
3972 -+@@ -1688,7 +1698,7 @@ int ext4_find_dest_de(struct inode *dir,
3973 -+ return -EIO;
3974 -+ if (ext4_match(namelen, name, de))
3975 -+ return -EEXIST;
3976 -+- nlen = EXT4_DIR_REC_LEN(de->name_len);
3977 -++ nlen = EXT4_DIR_REC_LEN(de);
3978 -+ rlen = ext4_rec_len_from_disk(de->rec_len, buf_size);
3979 -+ if ((de->inode ? rlen - nlen : rlen) >= reclen)
3980 -+ break;
3981 -+@@ -1705,12 +1715,12 @@ int ext4_find_dest_de(struct inode *dir,
3982 -+ void ext4_insert_dentry(struct inode *inode,
3983 -+ struct ext4_dir_entry_2 *de,
3984 -+ int buf_size,
3985 -+- const char *name, int namelen)
3986 -++ const char *name, int namelen, void *data)
3987 -+ {
3988 -+
3989 -+ int nlen, rlen;
3990 -+
3991 -+- nlen = EXT4_DIR_REC_LEN(de->name_len);
3992 -++ nlen = EXT4_DIR_REC_LEN(de);
3993 -+ rlen = ext4_rec_len_from_disk(de->rec_len, buf_size);
3994 -+ if (de->inode) {
3995 -+ struct ext4_dir_entry_2 *de1 =
3996 -+@@ -1724,6 +1734,11 @@ void ext4_insert_dentry(struct inode *in
3997 -+ ext4_set_de_type(inode->i_sb, de, inode->i_mode);
3998 -+ de->name_len = namelen;
3999 -+ memcpy(de->name, name, namelen);
4000 -++ if (data) {
4001 -++ de->name[namelen] = 0;
4002 -++ memcpy(&de->name[namelen + 1], data, *(char *)data);
4003 -++ de->file_type |= EXT4_DIRENT_LUFID;
4004 -++ }
4005 -+ }
4006 -+ /*
4007 -+ * Add a new entry into a directory (leaf) block. If de is non-NULL,
4008 -+@@ -1743,15 +1758,21 @@ static int add_dirent_to_buf(handle_t *h
4009 -+ unsigned int blocksize = dir->i_sb->s_blocksize;
4010 -+ int csum_size = 0;
4011 -+ int err;
4012 -++ unsigned char *data;
4013 -+
4014 -++ data = ext4_dentry_get_data(inode->i_sb, (struct ext4_dentry_param *)
4015 -++ dentry->d_fsdata);
4016 -+ if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb,
4017 -+ EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
4018 -+ csum_size = sizeof(struct ext4_dir_entry_tail);
4019 -+
4020 -+ if (!de) {
4021 -++ int dlen = 0;
4022 -++ if (data)
4023 -++ dlen = (*data) + 1;
4024 -+ err = ext4_find_dest_de(dir, inode,
4025 -+ bh, bh->b_data, blocksize - csum_size,
4026 -+- name, namelen, &de);
4027 -++ name, namelen + (dlen << 16), &de);
4028 -+ if (err)
4029 -+ return err;
4030 -+ }
4031 -+@@ -1763,7 +1784,7 @@ static int add_dirent_to_buf(handle_t *h
4032 -+ }
4033 -+
4034 -+ /* By now the buffer is marked for journaling */
4035 -+- ext4_insert_dentry(inode, de, blocksize, name, namelen);
4036 -++ ext4_insert_dentry(inode, de, blocksize, name, namelen, data);
4037 -+
4038 -+ /*
4039 -+ * XXX shouldn't update any times until successful
4040 -+@@ -1874,7 +1895,8 @@ static int make_indexed_dir(handle_t *ha
4041 -+
4042 -+ dx_set_block(entries, 1);
4043 -+ dx_set_count(entries, 1);
4044 -+- dx_set_limit(entries, dx_root_limit(dir, sizeof(*dx_info)));
4045 -++ dx_set_limit(entries, dx_root_limit(dir,
4046 -++ dot_de, sizeof(*dx_info)));
4047 -+
4048 -+ /* Initialize as for dx_probe */
4049 -+ hinfo.hash_version = dx_info->hash_version;
4050 -+@@ -1917,6 +1939,8 @@ static int ext4_update_dotdot(handle_t *
4051 -+ struct buffer_head * dir_block;
4052 -+ struct ext4_dir_entry_2 * de;
4053 -+ int len, journal = 0, err = 0;
4054 -++ int dlen = 0;
4055 -++ char *data;
4056 -+
4057 -+ if (IS_ERR(handle))
4058 -+ return PTR_ERR(handle);
4059 -+@@ -1932,19 +1956,24 @@ static int ext4_update_dotdot(handle_t *
4060 -+ /* the first item must be "." */
4061 -+ assert(de->name_len == 1 && de->name[0] == '.');
4062 -+ len = le16_to_cpu(de->rec_len);
4063 -+- assert(len >= EXT4_DIR_REC_LEN(1));
4064 -+- if (len > EXT4_DIR_REC_LEN(1)) {
4065 -++ assert(len >= __EXT4_DIR_REC_LEN(1));
4066 -++ if (len > __EXT4_DIR_REC_LEN(1)) {
4067 -+ BUFFER_TRACE(dir_block, "get_write_access");
4068 -+ err = ext4_journal_get_write_access(handle, dir_block);
4069 -+ if (err)
4070 -+ goto out_journal;
4071 -+
4072 -+ journal = 1;
4073 -+- de->rec_len = cpu_to_le16(EXT4_DIR_REC_LEN(1));
4074 -++ de->rec_len = cpu_to_le16(EXT4_DIR_REC_LEN(de));
4075 -+ }
4076 -+
4077 -+- len -= EXT4_DIR_REC_LEN(1);
4078 -+- assert(len == 0 || len >= EXT4_DIR_REC_LEN(2));
4079 -++ len -= EXT4_DIR_REC_LEN(de);
4080 -++ data = ext4_dentry_get_data(dir->i_sb,
4081 -++ (struct ext4_dentry_param *) dentry->d_fsdata);
4082 -++ if (data)
4083 -++ dlen = *data + 1;
4084 -++ assert(len == 0 || len >= __EXT4_DIR_REC_LEN(2 + dlen));
4085 -++
4086 -+ de = (struct ext4_dir_entry_2 *)
4087 -+ ((char *) de + le16_to_cpu(de->rec_len));
4088 -+ if (!journal) {
4089 -+@@ -1958,10 +1987,15 @@ static int ext4_update_dotdot(handle_t *
4090 -+ if (len > 0)
4091 -+ de->rec_len = cpu_to_le16(len);
4092 -+ else
4093 -+- assert(le16_to_cpu(de->rec_len) >= EXT4_DIR_REC_LEN(2));
4094 -++ assert(le16_to_cpu(de->rec_len) >= __EXT4_DIR_REC_LEN(2));
4095 -+ de->name_len = 2;
4096 -+ strcpy (de->name, "..");
4097 -+- ext4_set_de_type(dir->i_sb, de, S_IFDIR);
4098 -++ if (data != NULL && ext4_get_dirent_data_len(de) >= dlen) {
4099 -++ de->name[2] = 0;
4100 -++ memcpy(&de->name[2 + 1], data, *data);
4101 -++ ext4_set_de_type(dir->i_sb, de, S_IFDIR);
4102 -++ de->file_type |= EXT4_DIRENT_LUFID;
4103 -++ }
4104 -+
4105 -+ out_journal:
4106 -+ if (journal) {
4107 -+@@ -2474,37 +2508,70 @@ err_drop_inode:
4108 -+ return err;
4109 -+ }
4110 -+
4111 -++struct tp_block {
4112 -++ struct inode *inode;
4113 -++ void *data1;
4114 -++ void *data2;
4115 -++};
4116 -++
4117 -+ struct ext4_dir_entry_2 *ext4_init_dot_dotdot(struct inode *inode,
4118 -+ struct ext4_dir_entry_2 *de,
4119 -+ int blocksize, int csum_size,
4120 -+ unsigned int parent_ino, int dotdot_real_len)
4121 -+ {
4122 -++ void *data1 = NULL, *data2 = NULL;
4123 -++ int dot_reclen = 0;
4124 -++
4125 -++ if (dotdot_real_len == 10) {
4126 -++ struct tp_block *tpb = (struct tp_block*)inode;
4127 -++ data1 = tpb->data1;
4128 -++ data2 = tpb->data2;
4129 -++ inode = tpb->inode;
4130 -++ dotdot_real_len = 0;
4131 -++ }
4132 -+ de->inode = cpu_to_le32(inode->i_ino);
4133 -+ de->name_len = 1;
4134 -+- de->rec_len = ext4_rec_len_to_disk(EXT4_DIR_REC_LEN(de->name_len),
4135 -+- blocksize);
4136 -+ strcpy(de->name, ".");
4137 -+ ext4_set_de_type(inode->i_sb, de, S_IFDIR);
4138 -+
4139 -++ /* get packed fid data*/
4140 -++ data1 = ext4_dentry_get_data(inode->i_sb,
4141 -++ (struct ext4_dentry_param *) data1);
4142 -++ if (data1) {
4143 -++ de->name[1] = 0;
4144 -++ memcpy(&de->name[2], data1, *(char *) data1);
4145 -++ de->file_type |= EXT4_DIRENT_LUFID;
4146 -++ }
4147 -++ de->rec_len = cpu_to_le16(EXT4_DIR_REC_LEN(de));
4148 -++ dot_reclen = cpu_to_le16(de->rec_len);
4149 -+ de = ext4_next_entry(de, blocksize);
4150 -+ de->inode = cpu_to_le32(parent_ino);
4151 -+ de->name_len = 2;
4152 -+ if (!dotdot_real_len)
4153 -+ de->rec_len = ext4_rec_len_to_disk(blocksize -
4154 -+- (csum_size + EXT4_DIR_REC_LEN(1)),
4155 -++ (csum_size + dot_reclen),
4156 -+ blocksize);
4157 -+ else
4158 -+ de->rec_len = ext4_rec_len_to_disk(
4159 -+- EXT4_DIR_REC_LEN(de->name_len), blocksize);
4160 -++ EXT4_DIR_REC_LEN(de), blocksize);
4161 -+ strcpy(de->name, "..");
4162 -+ ext4_set_de_type(inode->i_sb, de, S_IFDIR);
4163 -++ data2 = ext4_dentry_get_data(inode->i_sb,
4164 -++ (struct ext4_dentry_param *) data2);
4165 -++ if (data2) {
4166 -++ de->name[2] = 0;
4167 -++ memcpy(&de->name[3], data2, *(char *) data2);
4168 -++ de->file_type |= EXT4_DIRENT_LUFID;
4169 -++ }
4170 -+
4171 -+ return ext4_next_entry(de, blocksize);
4172 -+ }
4173 -+
4174 -+ static int ext4_init_new_dir(handle_t *handle, struct inode *dir,
4175 -+- struct inode *inode)
4176 -++ struct inode *inode,
4177 -++ const void *data1, const void *data2)
4178 -+ {
4179 -++ struct tp_block param;
4180 -+ struct buffer_head *dir_block = NULL;
4181 -+ struct ext4_dir_entry_2 *de;
4182 -+ struct ext4_dir_entry_tail *t;
4183 -+@@ -2534,7 +2601,11 @@ static int ext4_init_new_dir(handle_t *h
4184 -+ if (err)
4185 -+ goto out;
4186 -+ de = (struct ext4_dir_entry_2 *)dir_block->b_data;
4187 -+- ext4_init_dot_dotdot(inode, de, blocksize, csum_size, dir->i_ino, 0);
4188 -++ param.inode = inode;
4189 -++ param.data1 = (void *)data1;
4190 -++ param.data2 = (void *)data2;
4191 -++ ext4_init_dot_dotdot((struct inode *)(&param), de, blocksize,
4192 -++ csum_size, dir->i_ino, 10);
4193 -+ set_nlink(inode, 2);
4194 -+ if (csum_size) {
4195 -+ t = EXT4_DIRENT_TAIL(dir_block->b_data, blocksize);
4196 -+@@ -2554,7 +2625,8 @@ out:
4197 -+ /* Initialize @inode as a subdirectory of @dir, and add the
4198 -+ * "." and ".." entries into the first directory block. */
4199 -+ int ext4_add_dot_dotdot(handle_t *handle, struct inode * dir,
4200 -+- struct inode *inode)
4201 -++ struct inode *inode,
4202 -++ const void *data1, const void *data2)
4203 -+ {
4204 -+ if (IS_ERR(handle))
4205 -+ return PTR_ERR(handle);
4206 -+@@ -2564,7 +2636,7 @@ int ext4_add_dot_dotdot(handle_t *handle
4207 -+
4208 -+ inode->i_op = &ext4_dir_inode_operations;
4209 -+ inode->i_fop = &ext4_dir_operations;
4210 -+- return ext4_init_new_dir(handle, dir, inode);
4211 -++ return ext4_init_new_dir(handle, dir, inode, data1, data2);
4212 -+ }
4213 -+ EXPORT_SYMBOL(ext4_add_dot_dotdot);
4214 -+
4215 -+@@ -2592,7 +2664,7 @@ retry:
4216 -+
4217 -+ inode->i_op = &ext4_dir_inode_operations;
4218 -+ inode->i_fop = &ext4_dir_operations;
4219 -+- err = ext4_init_new_dir(handle, dir, inode);
4220 -++ err = ext4_init_new_dir(handle, dir, inode, NULL, NULL);
4221 -+ if (err)
4222 -+ goto out_clear_inode;
4223 -+ err = ext4_mark_inode_dirty(handle, inode);
4224 -+@@ -2644,7 +2716,7 @@ static int empty_dir(struct inode *inode
4225 -+ }
4226 -+
4227 -+ sb = inode->i_sb;
4228 -+- if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2)) {
4229 -++ if (inode->i_size < __EXT4_DIR_REC_LEN(1) + __EXT4_DIR_REC_LEN(2)) {
4230 -+ EXT4_ERROR_INODE(inode, "invalid size");
4231 -+ return 1;
4232 -+ }
4233 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/inline.c
4234 -+===================================================================
4235 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/inline.c
4236 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/inline.c
4237 -+@@ -998,7 +998,7 @@ static int ext4_add_dirent_to_inline(han
4238 -+ int err;
4239 -+ struct ext4_dir_entry_2 *de;
4240 -+
4241 -+- reclen = EXT4_DIR_REC_LEN(namelen);
4242 -++ reclen = __EXT4_DIR_REC_LEN(namelen);
4243 -+ err = ext4_find_dest_de(dir, inode, iloc->bh,
4244 -+ inline_start, inline_size,
4245 -+ name, namelen, &de);
4246 -+@@ -1008,7 +1008,7 @@ static int ext4_add_dirent_to_inline(han
4247 -+ err = ext4_journal_get_write_access(handle, iloc->bh);
4248 -+ if (err)
4249 -+ return err;
4250 -+- ext4_insert_dentry(inode, de, inline_size, name, namelen);
4251 -++ ext4_insert_dentry(inode, de, inline_size, name, namelen, NULL);
4252 -+
4253 -+ ext4_show_inline_dir(dir, iloc->bh, inline_start, inline_size);
4254 -+
4255 -+@@ -1078,7 +1078,7 @@ static int ext4_update_inline_dir(handle
4256 -+ int old_size = EXT4_I(dir)->i_inline_size - EXT4_MIN_INLINE_DATA_SIZE;
4257 -+ int new_size = get_max_inline_xattr_value_size(dir, iloc);
4258 -+
4259 -+- if (new_size - old_size <= EXT4_DIR_REC_LEN(1))
4260 -++ if (new_size - old_size <= __EXT4_DIR_REC_LEN(1))
4261 -+ return -ENOSPC;
4262 -+
4263 -+ ret = ext4_update_inline_data(handle, dir,
4264 -+@@ -1348,7 +1348,7 @@ int htree_inlinedir_to_tree(struct file
4265 -+ fake.name_len = 1;
4266 -+ strcpy(fake.name, ".");
4267 -+ fake.rec_len = ext4_rec_len_to_disk(
4268 -+- EXT4_DIR_REC_LEN(fake.name_len),
4269 -++ EXT4_DIR_REC_LEN(&fake),
4270 -+ inline_size);
4271 -+ ext4_set_de_type(inode->i_sb, &fake, S_IFDIR);
4272 -+ de = &fake;
4273 -+@@ -1358,7 +1358,7 @@ int htree_inlinedir_to_tree(struct file
4274 -+ fake.name_len = 2;
4275 -+ strcpy(fake.name, "..");
4276 -+ fake.rec_len = ext4_rec_len_to_disk(
4277 -+- EXT4_DIR_REC_LEN(fake.name_len),
4278 -++ EXT4_DIR_REC_LEN(&fake),
4279 -+ inline_size);
4280 -+ ext4_set_de_type(inode->i_sb, &fake, S_IFDIR);
4281 -+ de = &fake;
4282 -+@@ -1453,8 +1453,8 @@ int ext4_read_inline_dir(struct file *fi
4283 -+ * So we will use extra_offset and extra_size to indicate them
4284 -+ * during the inline dir iteration.
4285 -+ */
4286 -+- dotdot_offset = EXT4_DIR_REC_LEN(1);
4287 -+- dotdot_size = dotdot_offset + EXT4_DIR_REC_LEN(2);
4288 -++ dotdot_offset = __EXT4_DIR_REC_LEN(1);
4289 -++ dotdot_size = dotdot_offset + __EXT4_DIR_REC_LEN(2);
4290 -+ extra_offset = dotdot_size - EXT4_INLINE_DOTDOT_SIZE;
4291 -+ extra_size = extra_offset + inline_size;
4292 -+
4293 -+@@ -1489,7 +1489,7 @@ int ext4_read_inline_dir(struct file *fi
4294 -+ * failure will be detected in the
4295 -+ * dirent test below. */
4296 -+ if (ext4_rec_len_from_disk(de->rec_len, extra_size)
4297 -+- < EXT4_DIR_REC_LEN(1))
4298 -++ < __EXT4_DIR_REC_LEN(1))
4299 -+ break;
4300 -+ i += ext4_rec_len_from_disk(de->rec_len,
4301 -+ extra_size);
4302 -diff --git a/ldiskfs/kernel_patches/patches/fc19/ext4_pdirop.patch b/ldiskfs/kernel_patches/patches/fc19/ext4_pdirop.patch
4303 -new file mode 100644
4304 -index 0000000..3af9392
4305 ---- /dev/null
4306 -+++ b/ldiskfs/kernel_patches/patches/fc19/ext4_pdirop.patch
4307 -@@ -0,0 +1,2252 @@
4308 -+Index: linux-3.11.1-200.fc19.x86_64/include/linux/htree_lock.h
4309 -+===================================================================
4310 -+--- /dev/null
4311 -++++ linux-3.11.1-200.fc19.x86_64/include/linux/htree_lock.h
4312 -+@@ -0,0 +1,187 @@
4313 -++/*
4314 -++ * include/linux/htree_lock.h
4315 -++ *
4316 -++ * Copyright (c) 2011, 2012, Intel Corporation.
4317 -++ *
4318 -++ * Author: Liang Zhen <liang@×××××××××.com>
4319 -++ */
4320 -++
4321 -++/*
4322 -++ * htree lock
4323 -++ *
4324 -++ * htree_lock is an advanced lock, it can support five lock modes (concept is
4325 -++ * taken from DLM) and it's a sleeping lock.
4326 -++ *
4327 -++ * most common use case is:
4328 -++ * - create a htree_lock_head for data
4329 -++ * - each thread (contender) creates it's own htree_lock
4330 -++ * - contender needs to call htree_lock(lock_node, mode) to protect data and
4331 -++ * call htree_unlock to release lock
4332 -++ *
4333 -++ * Also, there is advanced use-case which is more complex, user can have
4334 -++ * PW/PR lock on particular key, it's mostly used while user holding shared
4335 -++ * lock on the htree (CW, CR)
4336 -++ *
4337 -++ * htree_lock(lock_node, HTREE_LOCK_CR); lock the htree with CR
4338 -++ * htree_node_lock(lock_node, HTREE_LOCK_PR, key...); lock @key with PR
4339 -++ * ...
4340 -++ * htree_node_unlock(lock_node);; unlock the key
4341 -++ *
4342 -++ * Another tip is, we can have N-levels of this kind of keys, all we need to
4343 -++ * do is specifying N-levels while creating htree_lock_head, then we can
4344 -++ * lock/unlock a specific level by:
4345 -++ * htree_node_lock(lock_node, mode1, key1, level1...);
4346 -++ * do something;
4347 -++ * htree_node_lock(lock_node, mode1, key2, level2...);
4348 -++ * do something;
4349 -++ * htree_node_unlock(lock_node, level2);
4350 -++ * htree_node_unlock(lock_node, level1);
4351 -++ *
4352 -++ * NB: for multi-level, should be careful about locking order to avoid deadlock
4353 -++ */
4354 -++
4355 -++#ifndef _LINUX_HTREE_LOCK_H
4356 -++#define _LINUX_HTREE_LOCK_H
4357 -++
4358 -++#include <linux/list.h>
4359 -++#include <linux/spinlock.h>
4360 -++#include <linux/sched.h>
4361 -++
4362 -++/*
4363 -++ * Lock Modes
4364 -++ * more details can be found here:
4365 -++ * http://en.wikipedia.org/wiki/Distributed_lock_manager
4366 -++ */
4367 -++typedef enum {
4368 -++ HTREE_LOCK_EX = 0, /* exclusive lock: incompatible with all others */
4369 -++ HTREE_LOCK_PW, /* protected write: allows only CR users */
4370 -++ HTREE_LOCK_PR, /* protected read: allow PR, CR users */
4371 -++ HTREE_LOCK_CW, /* concurrent write: allow CR, CW users */
4372 -++ HTREE_LOCK_CR, /* concurrent read: allow all but EX users */
4373 -++ HTREE_LOCK_MAX, /* number of lock modes */
4374 -++} htree_lock_mode_t;
4375 -++
4376 -++#define HTREE_LOCK_NL HTREE_LOCK_MAX
4377 -++#define HTREE_LOCK_INVAL 0xdead10c
4378 -++
4379 -++enum {
4380 -++ HTREE_HBITS_MIN = 2,
4381 -++ HTREE_HBITS_DEF = 14,
4382 -++ HTREE_HBITS_MAX = 32,
4383 -++};
4384 -++
4385 -++enum {
4386 -++ HTREE_EVENT_DISABLE = (0),
4387 -++ HTREE_EVENT_RD = (1 << HTREE_LOCK_PR),
4388 -++ HTREE_EVENT_WR = (1 << HTREE_LOCK_PW),
4389 -++ HTREE_EVENT_RDWR = (HTREE_EVENT_RD | HTREE_EVENT_WR),
4390 -++};
4391 -++
4392 -++struct htree_lock;
4393 -++
4394 -++typedef void (*htree_event_cb_t)(void *target, void *event);
4395 -++
4396 -++struct htree_lock_child {
4397 -++ struct list_head lc_list; /* granted list */
4398 -++ htree_event_cb_t lc_callback; /* event callback */
4399 -++ unsigned lc_events; /* event types */
4400 -++};
4401 -++
4402 -++struct htree_lock_head {
4403 -++ unsigned long lh_lock; /* bits lock */
4404 -++ /* blocked lock list (htree_lock) */
4405 -++ struct list_head lh_blocked_list;
4406 -++ /* # key levels */
4407 -++ u16 lh_depth;
4408 -++ /* hash bits for key and limit number of locks */
4409 -++ u16 lh_hbits;
4410 -++ /* counters for blocked locks */
4411 -++ u16 lh_nblocked[HTREE_LOCK_MAX];
4412 -++ /* counters for granted locks */
4413 -++ u16 lh_ngranted[HTREE_LOCK_MAX];
4414 -++ /* private data */
4415 -++ void *lh_private;
4416 -++ /* array of children locks */
4417 -++ struct htree_lock_child lh_children[0];
4418 -++};
4419 -++
4420 -++/* htree_lock_node_t is child-lock for a specific key (ln_value) */
4421 -++struct htree_lock_node {
4422 -++ htree_lock_mode_t ln_mode;
4423 -++ /* major hash key */
4424 -++ u16 ln_major_key;
4425 -++ /* minor hash key */
4426 -++ u16 ln_minor_key;
4427 -++ struct list_head ln_major_list;
4428 -++ struct list_head ln_minor_list;
4429 -++ /* alive list, all locks (granted, blocked, listening) are on it */
4430 -++ struct list_head ln_alive_list;
4431 -++ /* blocked list */
4432 -++ struct list_head ln_blocked_list;
4433 -++ /* granted list */
4434 -++ struct list_head ln_granted_list;
4435 -++ void *ln_ev_target;
4436 -++};
4437 -++
4438 -++struct htree_lock {
4439 -++ struct task_struct *lk_task;
4440 -++ struct htree_lock_head *lk_head;
4441 -++ void *lk_private;
4442 -++ unsigned lk_depth;
4443 -++ htree_lock_mode_t lk_mode;
4444 -++ struct list_head lk_blocked_list;
4445 -++ struct htree_lock_node lk_nodes[0];
4446 -++};
4447 -++
4448 -++/* create a lock head, which stands for a resource */
4449 -++struct htree_lock_head *htree_lock_head_alloc(unsigned depth,
4450 -++ unsigned hbits, unsigned priv);
4451 -++/* free a lock head */
4452 -++void htree_lock_head_free(struct htree_lock_head *lhead);
4453 -++/* register event callback for child lock at level @depth */
4454 -++void htree_lock_event_attach(struct htree_lock_head *lhead, unsigned depth,
4455 -++ unsigned events, htree_event_cb_t callback);
4456 -++/* create a lock handle, which stands for a thread */
4457 -++struct htree_lock *htree_lock_alloc(unsigned depth, unsigned pbytes);
4458 -++/* free a lock handle */
4459 -++void htree_lock_free(struct htree_lock *lck);
4460 -++/* lock htree, when @wait is true, 0 is returned if the lock can't
4461 -++ * be granted immediately */
4462 -++int htree_lock_try(struct htree_lock *lck, struct htree_lock_head *lhead,
4463 -++ htree_lock_mode_t mode, int wait);
4464 -++/* unlock htree */
4465 -++void htree_unlock(struct htree_lock *lck);
4466 -++/* unlock and relock htree with @new_mode */
4467 -++int htree_change_lock_try(struct htree_lock *lck,
4468 -++ htree_lock_mode_t new_mode, int wait);
4469 -++void htree_change_mode(struct htree_lock *lck, htree_lock_mode_t mode);
4470 -++/* require child lock (key) of htree at level @dep, @event will be sent to all
4471 -++ * listeners on this @key while lock being granted */
4472 -++int htree_node_lock_try(struct htree_lock *lck, htree_lock_mode_t mode,
4473 -++ u32 key, unsigned dep, int wait, void *event);
4474 -++/* release child lock at level @dep, this lock will listen on it's key
4475 -++ * if @event isn't NULL, event_cb will be called against @lck while granting
4476 -++ * any other lock at level @dep with the same key */
4477 -++void htree_node_unlock(struct htree_lock *lck, unsigned dep, void *event);
4478 -++/* stop listening on child lock at level @dep */
4479 -++void htree_node_stop_listen(struct htree_lock *lck, unsigned dep);
4480 -++/* for debug */
4481 -++void htree_lock_stat_print(int depth);
4482 -++void htree_lock_stat_reset(void);
4483 -++
4484 -++#define htree_lock(lck, lh, mode) htree_lock_try(lck, lh, mode, 1)
4485 -++#define htree_change_lock(lck, mode) htree_change_lock_try(lck, mode, 1)
4486 -++
4487 -++#define htree_lock_mode(lck) ((lck)->lk_mode)
4488 -++
4489 -++#define htree_node_lock(lck, mode, key, dep) \
4490 -++ htree_node_lock_try(lck, mode, key, dep, 1, NULL)
4491 -++/* this is only safe in thread context of lock owner */
4492 -++#define htree_node_is_granted(lck, dep) \
4493 -++ ((lck)->lk_nodes[dep].ln_mode != HTREE_LOCK_INVAL && \
4494 -++ (lck)->lk_nodes[dep].ln_mode != HTREE_LOCK_NL)
4495 -++/* this is only safe in thread context of lock owner */
4496 -++#define htree_node_is_listening(lck, dep) \
4497 -++ ((lck)->lk_nodes[dep].ln_mode == HTREE_LOCK_NL)
4498 -++
4499 -++#endif
4500 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/htree_lock.c
4501 -+===================================================================
4502 -+--- /dev/null
4503 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/htree_lock.c
4504 -+@@ -0,0 +1,880 @@
4505 -++/*
4506 -++ * fs/ext4/htree_lock.c
4507 -++ *
4508 -++ * Copyright (c) 2011, 2012, Intel Corporation.
4509 -++ *
4510 -++ * Author: Liang Zhen <liang@×××××××××.com>
4511 -++ */
4512 -++#include <linux/jbd2.h>
4513 -++#include <linux/hash.h>
4514 -++#include <linux/module.h>
4515 -++#include <linux/htree_lock.h>
4516 -++
4517 -++enum {
4518 -++ HTREE_LOCK_BIT_EX = (1 << HTREE_LOCK_EX),
4519 -++ HTREE_LOCK_BIT_PW = (1 << HTREE_LOCK_PW),
4520 -++ HTREE_LOCK_BIT_PR = (1 << HTREE_LOCK_PR),
4521 -++ HTREE_LOCK_BIT_CW = (1 << HTREE_LOCK_CW),
4522 -++ HTREE_LOCK_BIT_CR = (1 << HTREE_LOCK_CR),
4523 -++};
4524 -++
4525 -++enum {
4526 -++ HTREE_LOCK_COMPAT_EX = 0,
4527 -++ HTREE_LOCK_COMPAT_PW = HTREE_LOCK_COMPAT_EX | HTREE_LOCK_BIT_CR,
4528 -++ HTREE_LOCK_COMPAT_PR = HTREE_LOCK_COMPAT_PW | HTREE_LOCK_BIT_PR,
4529 -++ HTREE_LOCK_COMPAT_CW = HTREE_LOCK_COMPAT_PW | HTREE_LOCK_BIT_CW,
4530 -++ HTREE_LOCK_COMPAT_CR = HTREE_LOCK_COMPAT_CW | HTREE_LOCK_BIT_PR |
4531 -++ HTREE_LOCK_BIT_PW,
4532 -++};
4533 -++
4534 -++static int htree_lock_compat[] = {
4535 -++ [HTREE_LOCK_EX] HTREE_LOCK_COMPAT_EX,
4536 -++ [HTREE_LOCK_PW] HTREE_LOCK_COMPAT_PW,
4537 -++ [HTREE_LOCK_PR] HTREE_LOCK_COMPAT_PR,
4538 -++ [HTREE_LOCK_CW] HTREE_LOCK_COMPAT_CW,
4539 -++ [HTREE_LOCK_CR] HTREE_LOCK_COMPAT_CR,
4540 -++};
4541 -++
4542 -++/* max allowed htree-lock depth.
4543 -++ * We only need depth=3 for ext4 although user can have higher value. */
4544 -++#define HTREE_LOCK_DEP_MAX 16
4545 -++
4546 -++#ifdef HTREE_LOCK_DEBUG
4547 -++
4548 -++static char *hl_name[] = {
4549 -++ [HTREE_LOCK_EX] "EX",
4550 -++ [HTREE_LOCK_PW] "PW",
4551 -++ [HTREE_LOCK_PR] "PR",
4552 -++ [HTREE_LOCK_CW] "CW",
4553 -++ [HTREE_LOCK_CR] "CR",
4554 -++};
4555 -++
4556 -++/* lock stats */
4557 -++struct htree_lock_node_stats {
4558 -++ unsigned long long blocked[HTREE_LOCK_MAX];
4559 -++ unsigned long long granted[HTREE_LOCK_MAX];
4560 -++ unsigned long long retried[HTREE_LOCK_MAX];
4561 -++ unsigned long long events;
4562 -++};
4563 -++
4564 -++struct htree_lock_stats {
4565 -++ struct htree_lock_node_stats nodes[HTREE_LOCK_DEP_MAX];
4566 -++ unsigned long long granted[HTREE_LOCK_MAX];
4567 -++ unsigned long long blocked[HTREE_LOCK_MAX];
4568 -++};
4569 -++
4570 -++static struct htree_lock_stats hl_stats;
4571 -++
4572 -++void htree_lock_stat_reset(void)
4573 -++{
4574 -++ memset(&hl_stats, 0, sizeof(hl_stats));
4575 -++}
4576 -++
4577 -++void htree_lock_stat_print(int depth)
4578 -++{
4579 -++ int i;
4580 -++ int j;
4581 -++
4582 -++ printk(KERN_DEBUG "HTREE LOCK STATS:\n");
4583 -++ for (i = 0; i < HTREE_LOCK_MAX; i++) {
4584 -++ printk(KERN_DEBUG "[%s]: G [%10llu], B [%10llu]\n",
4585 -++ hl_name[i], hl_stats.granted[i], hl_stats.blocked[i]);
4586 -++ }
4587 -++ for (i = 0; i < depth; i++) {
4588 -++ printk(KERN_DEBUG "HTREE CHILD [%d] STATS:\n", i);
4589 -++ for (j = 0; j < HTREE_LOCK_MAX; j++) {
4590 -++ printk(KERN_DEBUG
4591 -++ "[%s]: G [%10llu], B [%10llu], R [%10llu]\n",
4592 -++ hl_name[j], hl_stats.nodes[i].granted[j],
4593 -++ hl_stats.nodes[i].blocked[j],
4594 -++ hl_stats.nodes[i].retried[j]);
4595 -++ }
4596 -++ }
4597 -++}
4598 -++
4599 -++#define lk_grant_inc(m) do { hl_stats.granted[m]++; } while (0)
4600 -++#define lk_block_inc(m) do { hl_stats.blocked[m]++; } while (0)
4601 -++#define ln_grant_inc(d, m) do { hl_stats.nodes[d].granted[m]++; } while (0)
4602 -++#define ln_block_inc(d, m) do { hl_stats.nodes[d].blocked[m]++; } while (0)
4603 -++#define ln_retry_inc(d, m) do { hl_stats.nodes[d].retried[m]++; } while (0)
4604 -++#define ln_event_inc(d) do { hl_stats.nodes[d].events++; } while (0)
4605 -++
4606 -++#else /* !DEBUG */
4607 -++
4608 -++void htree_lock_stat_reset(void) {}
4609 -++void htree_lock_stat_print(int depth) {}
4610 -++
4611 -++#define lk_grant_inc(m) do {} while (0)
4612 -++#define lk_block_inc(m) do {} while (0)
4613 -++#define ln_grant_inc(d, m) do {} while (0)
4614 -++#define ln_block_inc(d, m) do {} while (0)
4615 -++#define ln_retry_inc(d, m) do {} while (0)
4616 -++#define ln_event_inc(d) do {} while (0)
4617 -++
4618 -++#endif /* DEBUG */
4619 -++
4620 -++EXPORT_SYMBOL(htree_lock_stat_reset);
4621 -++EXPORT_SYMBOL(htree_lock_stat_print);
4622 -++
4623 -++#define HTREE_DEP_ROOT (-1)
4624 -++
4625 -++#define htree_spin_lock(lhead, dep) \
4626 -++ bit_spin_lock((dep) + 1, &(lhead)->lh_lock)
4627 -++#define htree_spin_unlock(lhead, dep) \
4628 -++ bit_spin_unlock((dep) + 1, &(lhead)->lh_lock)
4629 -++
4630 -++#define htree_key_event_ignore(child, ln) \
4631 -++ (!((child)->lc_events & (1 << (ln)->ln_mode)))
4632 -++
4633 -++static int
4634 -++htree_key_list_empty(struct htree_lock_node *ln)
4635 -++{
4636 -++ return list_empty(&ln->ln_major_list) && list_empty(&ln->ln_minor_list);
4637 -++}
4638 -++
4639 -++static void
4640 -++htree_key_list_del_init(struct htree_lock_node *ln)
4641 -++{
4642 -++ struct htree_lock_node *tmp = NULL;
4643 -++
4644 -++ if (!list_empty(&ln->ln_minor_list)) {
4645 -++ tmp = list_entry(ln->ln_minor_list.next,
4646 -++ struct htree_lock_node, ln_minor_list);
4647 -++ list_del_init(&ln->ln_minor_list);
4648 -++ }
4649 -++
4650 -++ if (list_empty(&ln->ln_major_list))
4651 -++ return;
4652 -++
4653 -++ if (tmp == NULL) { /* not on minor key list */
4654 -++ list_del_init(&ln->ln_major_list);
4655 -++ } else {
4656 -++ BUG_ON(!list_empty(&tmp->ln_major_list));
4657 -++ list_replace_init(&ln->ln_major_list, &tmp->ln_major_list);
4658 -++ }
4659 -++}
4660 -++
4661 -++static void
4662 -++htree_key_list_replace_init(struct htree_lock_node *old,
4663 -++ struct htree_lock_node *new)
4664 -++{
4665 -++ if (!list_empty(&old->ln_major_list))
4666 -++ list_replace_init(&old->ln_major_list, &new->ln_major_list);
4667 -++
4668 -++ if (!list_empty(&old->ln_minor_list))
4669 -++ list_replace_init(&old->ln_minor_list, &new->ln_minor_list);
4670 -++}
4671 -++
4672 -++static void
4673 -++htree_key_event_enqueue(struct htree_lock_child *child,
4674 -++ struct htree_lock_node *ln, int dep, void *event)
4675 -++{
4676 -++ struct htree_lock_node *tmp;
4677 -++
4678 -++ /* NB: ALWAYS called holding lhead::lh_lock(dep) */
4679 -++ BUG_ON(ln->ln_mode == HTREE_LOCK_NL);
4680 -++ if (event == NULL || htree_key_event_ignore(child, ln))
4681 -++ return;
4682 -++
4683 -++ /* shouldn't be a very long list */
4684 -++ list_for_each_entry(tmp, &ln->ln_alive_list, ln_alive_list) {
4685 -++ if (tmp->ln_mode == HTREE_LOCK_NL) {
4686 -++ ln_event_inc(dep);
4687 -++ if (child->lc_callback != NULL)
4688 -++ child->lc_callback(tmp->ln_ev_target, event);
4689 -++ }
4690 -++ }
4691 -++}
4692 -++
4693 -++static int
4694 -++htree_node_lock_enqueue(struct htree_lock *newlk, struct htree_lock *curlk,
4695 -++ unsigned dep, int wait, void *event)
4696 -++{
4697 -++ struct htree_lock_child *child = &newlk->lk_head->lh_children[dep];
4698 -++ struct htree_lock_node *newln = &newlk->lk_nodes[dep];
4699 -++ struct htree_lock_node *curln = &curlk->lk_nodes[dep];
4700 -++
4701 -++ /* NB: ALWAYS called holding lhead::lh_lock(dep) */
4702 -++ /* NB: we only expect PR/PW lock mode at here, only these two modes are
4703 -++ * allowed for htree_node_lock(asserted in htree_node_lock_internal),
4704 -++ * NL is only used for listener, user can't directly require NL mode */
4705 -++ if ((curln->ln_mode == HTREE_LOCK_NL) ||
4706 -++ (curln->ln_mode != HTREE_LOCK_PW &&
4707 -++ newln->ln_mode != HTREE_LOCK_PW)) {
4708 -++ /* no conflict, attach it on granted list of @curlk */
4709 -++ if (curln->ln_mode != HTREE_LOCK_NL) {
4710 -++ list_add(&newln->ln_granted_list,
4711 -++ &curln->ln_granted_list);
4712 -++ } else {
4713 -++ /* replace key owner */
4714 -++ htree_key_list_replace_init(curln, newln);
4715 -++ }
4716 -++
4717 -++ list_add(&newln->ln_alive_list, &curln->ln_alive_list);
4718 -++ htree_key_event_enqueue(child, newln, dep, event);
4719 -++ ln_grant_inc(dep, newln->ln_mode);
4720 -++ return 1; /* still hold lh_lock */
4721 -++ }
4722 -++
4723 -++ if (!wait) { /* can't grant and don't want to wait */
4724 -++ ln_retry_inc(dep, newln->ln_mode);
4725 -++ newln->ln_mode = HTREE_LOCK_INVAL;
4726 -++ return -1; /* don't wait and just return -1 */
4727 -++ }
4728 -++
4729 -++ newlk->lk_task = current;
4730 -++ set_current_state(TASK_UNINTERRUPTIBLE);
4731 -++ /* conflict, attach it on blocked list of curlk */
4732 -++ list_add_tail(&newln->ln_blocked_list, &curln->ln_blocked_list);
4733 -++ list_add(&newln->ln_alive_list, &curln->ln_alive_list);
4734 -++ ln_block_inc(dep, newln->ln_mode);
4735 -++
4736 -++ htree_spin_unlock(newlk->lk_head, dep);
4737 -++ /* wait to be given the lock */
4738 -++ if (newlk->lk_task != NULL)
4739 -++ schedule();
4740 -++ /* granted, no doubt, wake up will set me RUNNING */
4741 -++ if (event == NULL || htree_key_event_ignore(child, newln))
4742 -++ return 0; /* granted without lh_lock */
4743 -++
4744 -++ htree_spin_lock(newlk->lk_head, dep);
4745 -++ htree_key_event_enqueue(child, newln, dep, event);
4746 -++ return 1; /* still hold lh_lock */
4747 -++}
4748 -++
4749 -++/*
4750 -++ * get PR/PW access to particular tree-node according to @dep and @key,
4751 -++ * it will return -1 if @wait is false and can't immediately grant this lock.
4752 -++ * All listeners(HTREE_LOCK_NL) on @dep and with the same @key will get
4753 -++ * @event if it's not NULL.
4754 -++ * NB: ALWAYS called holding lhead::lh_lock
4755 -++ */
4756 -++static int
4757 -++htree_node_lock_internal(struct htree_lock_head *lhead, struct htree_lock *lck,
4758 -++ htree_lock_mode_t mode, u32 key, unsigned dep,
4759 -++ int wait, void *event)
4760 -++{
4761 -++ LIST_HEAD (list);
4762 -++ struct htree_lock *tmp;
4763 -++ struct htree_lock *tmp2;
4764 -++ u16 major;
4765 -++ u16 minor;
4766 -++ u8 reverse;
4767 -++ u8 ma_bits;
4768 -++ u8 mi_bits;
4769 -++
4770 -++ BUG_ON(mode != HTREE_LOCK_PW && mode != HTREE_LOCK_PR);
4771 -++ BUG_ON(htree_node_is_granted(lck, dep));
4772 -++
4773 -++ key = hash_long(key, lhead->lh_hbits);
4774 -++
4775 -++ mi_bits = lhead->lh_hbits >> 1;
4776 -++ ma_bits = lhead->lh_hbits - mi_bits;
4777 -++
4778 -++ lck->lk_nodes[dep].ln_major_key = major = key & ((1U << ma_bits) - 1);
4779 -++ lck->lk_nodes[dep].ln_minor_key = minor = key >> ma_bits;
4780 -++ lck->lk_nodes[dep].ln_mode = mode;
4781 -++
4782 -++ /*
4783 -++ * The major key list is an ordered list, so searches are started
4784 -++ * at the end of the list that is numerically closer to major_key,
4785 -++ * so at most half of the list will be walked (for well-distributed
4786 -++ * keys). The list traversal aborts early if the expected key
4787 -++ * location is passed.
4788 -++ */
4789 -++ reverse = (major >= (1 << (ma_bits - 1)));
4790 -++
4791 -++ if (reverse) {
4792 -++ list_for_each_entry_reverse(tmp,
4793 -++ &lhead->lh_children[dep].lc_list,
4794 -++ lk_nodes[dep].ln_major_list) {
4795 -++ if (tmp->lk_nodes[dep].ln_major_key == major) {
4796 -++ goto search_minor;
4797 -++
4798 -++ } else if (tmp->lk_nodes[dep].ln_major_key < major) {
4799 -++ /* attach _after_ @tmp */
4800 -++ list_add(&lck->lk_nodes[dep].ln_major_list,
4801 -++ &tmp->lk_nodes[dep].ln_major_list);
4802 -++ goto out_grant_major;
4803 -++ }
4804 -++ }
4805 -++
4806 -++ list_add(&lck->lk_nodes[dep].ln_major_list,
4807 -++ &lhead->lh_children[dep].lc_list);
4808 -++ goto out_grant_major;
4809 -++
4810 -++ } else {
4811 -++ list_for_each_entry(tmp, &lhead->lh_children[dep].lc_list,
4812 -++ lk_nodes[dep].ln_major_list) {
4813 -++ if (tmp->lk_nodes[dep].ln_major_key == major) {
4814 -++ goto search_minor;
4815 -++
4816 -++ } else if (tmp->lk_nodes[dep].ln_major_key > major) {
4817 -++ /* insert _before_ @tmp */
4818 -++ list_add_tail(&lck->lk_nodes[dep].ln_major_list,
4819 -++ &tmp->lk_nodes[dep].ln_major_list);
4820 -++ goto out_grant_major;
4821 -++ }
4822 -++ }
4823 -++
4824 -++ list_add_tail(&lck->lk_nodes[dep].ln_major_list,
4825 -++ &lhead->lh_children[dep].lc_list);
4826 -++ goto out_grant_major;
4827 -++ }
4828 -++
4829 -++ search_minor:
4830 -++ /*
4831 -++ * NB: minor_key list doesn't have a "head", @list is just a
4832 -++ * temporary stub for helping list searching, make sure it's removed
4833 -++ * after searching.
4834 -++ * minor_key list is an ordered list too.
4835 -++ */
4836 -++ list_add_tail(&list, &tmp->lk_nodes[dep].ln_minor_list);
4837 -++
4838 -++ reverse = (minor >= (1 << (mi_bits - 1)));
4839 -++
4840 -++ if (reverse) {
4841 -++ list_for_each_entry_reverse(tmp2, &list,
4842 -++ lk_nodes[dep].ln_minor_list) {
4843 -++ if (tmp2->lk_nodes[dep].ln_minor_key == minor) {
4844 -++ goto out_enqueue;
4845 -++
4846 -++ } else if (tmp2->lk_nodes[dep].ln_minor_key < minor) {
4847 -++ /* attach _after_ @tmp2 */
4848 -++ list_add(&lck->lk_nodes[dep].ln_minor_list,
4849 -++ &tmp2->lk_nodes[dep].ln_minor_list);
4850 -++ goto out_grant_minor;
4851 -++ }
4852 -++ }
4853 -++
4854 -++ list_add(&lck->lk_nodes[dep].ln_minor_list, &list);
4855 -++
4856 -++ } else {
4857 -++ list_for_each_entry(tmp2, &list,
4858 -++ lk_nodes[dep].ln_minor_list) {
4859 -++ if (tmp2->lk_nodes[dep].ln_minor_key == minor) {
4860 -++ goto out_enqueue;
4861 -++
4862 -++ } else if (tmp2->lk_nodes[dep].ln_minor_key > minor) {
4863 -++ /* insert _before_ @tmp2 */
4864 -++ list_add_tail(&lck->lk_nodes[dep].ln_minor_list,
4865 -++ &tmp2->lk_nodes[dep].ln_minor_list);
4866 -++ goto out_grant_minor;
4867 -++ }
4868 -++ }
4869 -++
4870 -++ list_add_tail(&lck->lk_nodes[dep].ln_minor_list, &list);
4871 -++ }
4872 -++
4873 -++ out_grant_minor:
4874 -++ if (list.next == &lck->lk_nodes[dep].ln_minor_list) {
4875 -++ /* new lock @lck is the first one on minor_key list, which
4876 -++ * means it has the smallest minor_key and it should
4877 -++ * replace @tmp as minor_key owner */
4878 -++ list_replace_init(&tmp->lk_nodes[dep].ln_major_list,
4879 -++ &lck->lk_nodes[dep].ln_major_list);
4880 -++ }
4881 -++ /* remove the temporary head */
4882 -++ list_del(&list);
4883 -++
4884 -++ out_grant_major:
4885 -++ ln_grant_inc(dep, lck->lk_nodes[dep].ln_mode);
4886 -++ return 1; /* granted with holding lh_lock */
4887 -++
4888 -++ out_enqueue:
4889 -++ list_del(&list); /* remove temprary head */
4890 -++ return htree_node_lock_enqueue(lck, tmp2, dep, wait, event);
4891 -++}
4892 -++
4893 -++/*
4894 -++ * release the key of @lck at level @dep, and grant any blocked locks.
4895 -++ * caller will still listen on @key if @event is not NULL, which means
4896 -++ * caller can see a event (by event_cb) while granting any lock with
4897 -++ * the same key at level @dep.
4898 -++ * NB: ALWAYS called holding lhead::lh_lock
4899 -++ * NB: listener will not block anyone because listening mode is HTREE_LOCK_NL
4900 -++ */
4901 -++static void
4902 -++htree_node_unlock_internal(struct htree_lock_head *lhead,
4903 -++ struct htree_lock *curlk, unsigned dep, void *event)
4904 -++{
4905 -++ struct htree_lock_node *curln = &curlk->lk_nodes[dep];
4906 -++ struct htree_lock *grtlk = NULL;
4907 -++ struct htree_lock_node *grtln;
4908 -++ struct htree_lock *poslk;
4909 -++ struct htree_lock *tmplk;
4910 -++
4911 -++ if (!htree_node_is_granted(curlk, dep))
4912 -++ return;
4913 -++
4914 -++ if (!list_empty(&curln->ln_granted_list)) {
4915 -++ /* there is another granted lock */
4916 -++ grtlk = list_entry(curln->ln_granted_list.next,
4917 -++ struct htree_lock,
4918 -++ lk_nodes[dep].ln_granted_list);
4919 -++ list_del_init(&curln->ln_granted_list);
4920 -++ }
4921 -++
4922 -++ if (grtlk == NULL && !list_empty(&curln->ln_blocked_list)) {
4923 -++ /*
4924 -++ * @curlk is the only granted lock, so we confirmed:
4925 -++ * a) curln is key owner (attached on major/minor_list),
4926 -++ * so if there is any blocked lock, it should be attached
4927 -++ * on curln->ln_blocked_list
4928 -++ * b) we always can grant the first blocked lock
4929 -++ */
4930 -++ grtlk = list_entry(curln->ln_blocked_list.next,
4931 -++ struct htree_lock,
4932 -++ lk_nodes[dep].ln_blocked_list);
4933 -++ BUG_ON(grtlk->lk_task == NULL);
4934 -++ wake_up_process(grtlk->lk_task);
4935 -++ }
4936 -++
4937 -++ if (event != NULL &&
4938 -++ lhead->lh_children[dep].lc_events != HTREE_EVENT_DISABLE) {
4939 -++ curln->ln_ev_target = event;
4940 -++ curln->ln_mode = HTREE_LOCK_NL; /* listen! */
4941 -++ } else {
4942 -++ curln->ln_mode = HTREE_LOCK_INVAL;
4943 -++ }
4944 -++
4945 -++ if (grtlk == NULL) { /* I must be the only one locking this key */
4946 -++ struct htree_lock_node *tmpln;
4947 -++
4948 -++ BUG_ON(htree_key_list_empty(curln));
4949 -++
4950 -++ if (curln->ln_mode == HTREE_LOCK_NL) /* listening */
4951 -++ return;
4952 -++
4953 -++ /* not listening */
4954 -++ if (list_empty(&curln->ln_alive_list)) { /* no more listener */
4955 -++ htree_key_list_del_init(curln);
4956 -++ return;
4957 -++ }
4958 -++
4959 -++ tmpln = list_entry(curln->ln_alive_list.next,
4960 -++ struct htree_lock_node, ln_alive_list);
4961 -++
4962 -++ BUG_ON(tmpln->ln_mode != HTREE_LOCK_NL);
4963 -++
4964 -++ htree_key_list_replace_init(curln, tmpln);
4965 -++ list_del_init(&curln->ln_alive_list);
4966 -++
4967 -++ return;
4968 -++ }
4969 -++
4970 -++ /* have a granted lock */
4971 -++ grtln = &grtlk->lk_nodes[dep];
4972 -++ if (!list_empty(&curln->ln_blocked_list)) {
4973 -++ /* only key owner can be on both lists */
4974 -++ BUG_ON(htree_key_list_empty(curln));
4975 -++
4976 -++ if (list_empty(&grtln->ln_blocked_list)) {
4977 -++ list_add(&grtln->ln_blocked_list,
4978 -++ &curln->ln_blocked_list);
4979 -++ }
4980 -++ list_del_init(&curln->ln_blocked_list);
4981 -++ }
4982 -++ /*
4983 -++ * NB: this is the tricky part:
4984 -++ * We have only two modes for child-lock (PR and PW), also,
4985 -++ * only owner of the key (attached on major/minor_list) can be on
4986 -++ * both blocked_list and granted_list, so @grtlk must be one
4987 -++ * of these two cases:
4988 -++ *
4989 -++ * a) @grtlk is taken from granted_list, which means we've granted
4990 -++ * more than one lock so @grtlk has to be PR, the first blocked
4991 -++ * lock must be PW and we can't grant it at all.
4992 -++ * So even @grtlk is not owner of the key (empty blocked_list),
4993 -++ * we don't care because we can't grant any lock.
4994 -++ * b) we just grant a new lock which is taken from head of blocked
4995 -++ * list, and it should be the first granted lock, and it should
4996 -++ * be the first one linked on blocked_list.
4997 -++ *
4998 -++ * Either way, we can get correct result by iterating blocked_list
4999 -++ * of @grtlk, and don't have to bother on how to find out
5000 -++ * owner of current key.
5001 -++ */
5002 -++ list_for_each_entry_safe(poslk, tmplk, &grtln->ln_blocked_list,
5003 -++ lk_nodes[dep].ln_blocked_list) {
5004 -++ if (grtlk->lk_nodes[dep].ln_mode == HTREE_LOCK_PW ||
5005 -++ poslk->lk_nodes[dep].ln_mode == HTREE_LOCK_PW)
5006 -++ break;
5007 -++ /* grant all readers */
5008 -++ list_del_init(&poslk->lk_nodes[dep].ln_blocked_list);
5009 -++ list_add(&poslk->lk_nodes[dep].ln_granted_list,
5010 -++ &grtln->ln_granted_list);
5011 -++
5012 -++ BUG_ON(poslk->lk_task == NULL);
5013 -++ wake_up_process(poslk->lk_task);
5014 -++ }
5015 -++
5016 -++ /* if @curln is the owner of this key, replace it with @grtln */
5017 -++ if (!htree_key_list_empty(curln))
5018 -++ htree_key_list_replace_init(curln, grtln);
5019 -++
5020 -++ if (curln->ln_mode == HTREE_LOCK_INVAL)
5021 -++ list_del_init(&curln->ln_alive_list);
5022 -++}
5023 -++
5024 -++/*
5025 -++ * it's just wrapper of htree_node_lock_internal, it returns 1 on granted
5026 -++ * and 0 only if @wait is false and can't grant it immediately
5027 -++ */
5028 -++int
5029 -++htree_node_lock_try(struct htree_lock *lck, htree_lock_mode_t mode,
5030 -++ u32 key, unsigned dep, int wait, void *event)
5031 -++{
5032 -++ struct htree_lock_head *lhead = lck->lk_head;
5033 -++ int rc;
5034 -++
5035 -++ BUG_ON(dep >= lck->lk_depth);
5036 -++ BUG_ON(lck->lk_mode == HTREE_LOCK_INVAL);
5037 -++
5038 -++ htree_spin_lock(lhead, dep);
5039 -++ rc = htree_node_lock_internal(lhead, lck, mode, key, dep, wait, event);
5040 -++ if (rc != 0)
5041 -++ htree_spin_unlock(lhead, dep);
5042 -++ return rc >= 0;
5043 -++}
5044 -++EXPORT_SYMBOL(htree_node_lock_try);
5045 -++
5046 -++/* it's wrapper of htree_node_unlock_internal */
5047 -++void
5048 -++htree_node_unlock(struct htree_lock *lck, unsigned dep, void *event)
5049 -++{
5050 -++ struct htree_lock_head *lhead = lck->lk_head;
5051 -++
5052 -++ BUG_ON(dep >= lck->lk_depth);
5053 -++ BUG_ON(lck->lk_mode == HTREE_LOCK_INVAL);
5054 -++
5055 -++ htree_spin_lock(lhead, dep);
5056 -++ htree_node_unlock_internal(lhead, lck, dep, event);
5057 -++ htree_spin_unlock(lhead, dep);
5058 -++}
5059 -++EXPORT_SYMBOL(htree_node_unlock);
5060 -++
5061 -++/* stop listening on child-lock level @dep */
5062 -++void
5063 -++htree_node_stop_listen(struct htree_lock *lck, unsigned dep)
5064 -++{
5065 -++ struct htree_lock_node *ln = &lck->lk_nodes[dep];
5066 -++ struct htree_lock_node *tmp;
5067 -++
5068 -++ BUG_ON(htree_node_is_granted(lck, dep));
5069 -++ BUG_ON(!list_empty(&ln->ln_blocked_list));
5070 -++ BUG_ON(!list_empty(&ln->ln_granted_list));
5071 -++
5072 -++ if (!htree_node_is_listening(lck, dep))
5073 -++ return;
5074 -++
5075 -++ htree_spin_lock(lck->lk_head, dep);
5076 -++ ln->ln_mode = HTREE_LOCK_INVAL;
5077 -++ ln->ln_ev_target = NULL;
5078 -++
5079 -++ if (htree_key_list_empty(ln)) { /* not owner */
5080 -++ list_del_init(&ln->ln_alive_list);
5081 -++ goto out;
5082 -++ }
5083 -++
5084 -++ /* I'm the owner... */
5085 -++ if (list_empty(&ln->ln_alive_list)) { /* no more listener */
5086 -++ htree_key_list_del_init(ln);
5087 -++ goto out;
5088 -++ }
5089 -++
5090 -++ tmp = list_entry(ln->ln_alive_list.next,
5091 -++ struct htree_lock_node, ln_alive_list);
5092 -++
5093 -++ BUG_ON(tmp->ln_mode != HTREE_LOCK_NL);
5094 -++ htree_key_list_replace_init(ln, tmp);
5095 -++ list_del_init(&ln->ln_alive_list);
5096 -++ out:
5097 -++ htree_spin_unlock(lck->lk_head, dep);
5098 -++}
5099 -++EXPORT_SYMBOL(htree_node_stop_listen);
5100 -++
5101 -++/* release all child-locks if we have any */
5102 -++static void
5103 -++htree_node_release_all(struct htree_lock *lck)
5104 -++{
5105 -++ int i;
5106 -++
5107 -++ for (i = 0; i < lck->lk_depth; i++) {
5108 -++ if (htree_node_is_granted(lck, i))
5109 -++ htree_node_unlock(lck, i, NULL);
5110 -++ else if (htree_node_is_listening(lck, i))
5111 -++ htree_node_stop_listen(lck, i);
5112 -++ }
5113 -++}
5114 -++
5115 -++/*
5116 -++ * obtain htree lock, it could be blocked inside if there's conflict
5117 -++ * with any granted or blocked lock and @wait is true.
5118 -++ * NB: ALWAYS called holding lhead::lh_lock
5119 -++ */
5120 -++static int
5121 -++htree_lock_internal(struct htree_lock *lck, int wait)
5122 -++{
5123 -++ struct htree_lock_head *lhead = lck->lk_head;
5124 -++ int granted = 0;
5125 -++ int blocked = 0;
5126 -++ int i;
5127 -++
5128 -++ for (i = 0; i < HTREE_LOCK_MAX; i++) {
5129 -++ if (lhead->lh_ngranted[i] != 0)
5130 -++ granted |= 1 << i;
5131 -++ if (lhead->lh_nblocked[i] != 0)
5132 -++ blocked |= 1 << i;
5133 -++ }
5134 -++ if ((htree_lock_compat[lck->lk_mode] & granted) != granted ||
5135 -++ (htree_lock_compat[lck->lk_mode] & blocked) != blocked) {
5136 -++ /* will block current lock even it just conflicts with any
5137 -++ * other blocked lock, so lock like EX wouldn't starve */
5138 -++ if (!wait)
5139 -++ return -1;
5140 -++ lhead->lh_nblocked[lck->lk_mode]++;
5141 -++ lk_block_inc(lck->lk_mode);
5142 -++
5143 -++ lck->lk_task = current;
5144 -++ list_add_tail(&lck->lk_blocked_list, &lhead->lh_blocked_list);
5145 -++
5146 -++ set_current_state(TASK_UNINTERRUPTIBLE);
5147 -++ htree_spin_unlock(lhead, HTREE_DEP_ROOT);
5148 -++ /* wait to be given the lock */
5149 -++ if (lck->lk_task != NULL)
5150 -++ schedule();
5151 -++ /* granted, no doubt. wake up will set me RUNNING */
5152 -++ return 0; /* without lh_lock */
5153 -++ }
5154 -++ lhead->lh_ngranted[lck->lk_mode]++;
5155 -++ lk_grant_inc(lck->lk_mode);
5156 -++ return 1;
5157 -++}
5158 -++
5159 -++/* release htree lock. NB: ALWAYS called holding lhead::lh_lock */
5160 -++static void
5161 -++htree_unlock_internal(struct htree_lock *lck)
5162 -++{
5163 -++ struct htree_lock_head *lhead = lck->lk_head;
5164 -++ struct htree_lock *tmp;
5165 -++ struct htree_lock *tmp2;
5166 -++ int granted = 0;
5167 -++ int i;
5168 -++
5169 -++ BUG_ON(lhead->lh_ngranted[lck->lk_mode] == 0);
5170 -++
5171 -++ lhead->lh_ngranted[lck->lk_mode]--;
5172 -++ lck->lk_mode = HTREE_LOCK_INVAL;
5173 -++
5174 -++ for (i = 0; i < HTREE_LOCK_MAX; i++) {
5175 -++ if (lhead->lh_ngranted[i] != 0)
5176 -++ granted |= 1 << i;
5177 -++ }
5178 -++ list_for_each_entry_safe(tmp, tmp2,
5179 -++ &lhead->lh_blocked_list, lk_blocked_list) {
5180 -++ /* conflict with any granted lock? */
5181 -++ if ((htree_lock_compat[tmp->lk_mode] & granted) != granted)
5182 -++ break;
5183 -++
5184 -++ list_del_init(&tmp->lk_blocked_list);
5185 -++
5186 -++ BUG_ON(lhead->lh_nblocked[tmp->lk_mode] == 0);
5187 -++
5188 -++ lhead->lh_nblocked[tmp->lk_mode]--;
5189 -++ lhead->lh_ngranted[tmp->lk_mode]++;
5190 -++ granted |= 1 << tmp->lk_mode;
5191 -++
5192 -++ BUG_ON(tmp->lk_task == NULL);
5193 -++ wake_up_process(tmp->lk_task);
5194 -++ }
5195 -++}
5196 -++
5197 -++/* it's wrapper of htree_lock_internal and exported interface.
5198 -++ * It always return 1 with granted lock if @wait is true, it can return 0
5199 -++ * if @wait is false and locking request can't be granted immediately */
5200 -++int
5201 -++htree_lock_try(struct htree_lock *lck, struct htree_lock_head *lhead,
5202 -++ htree_lock_mode_t mode, int wait)
5203 -++{
5204 -++ int rc;
5205 -++
5206 -++ BUG_ON(lck->lk_depth > lhead->lh_depth);
5207 -++ BUG_ON(lck->lk_head != NULL);
5208 -++ BUG_ON(lck->lk_task != NULL);
5209 -++
5210 -++ lck->lk_head = lhead;
5211 -++ lck->lk_mode = mode;
5212 -++
5213 -++ htree_spin_lock(lhead, HTREE_DEP_ROOT);
5214 -++ rc = htree_lock_internal(lck, wait);
5215 -++ if (rc != 0)
5216 -++ htree_spin_unlock(lhead, HTREE_DEP_ROOT);
5217 -++ return rc >= 0;
5218 -++}
5219 -++EXPORT_SYMBOL(htree_lock_try);
5220 -++
5221 -++/* it's wrapper of htree_unlock_internal and exported interface.
5222 -++ * It will release all htree_node_locks and htree_lock */
5223 -++void
5224 -++htree_unlock(struct htree_lock *lck)
5225 -++{
5226 -++ BUG_ON(lck->lk_head == NULL);
5227 -++ BUG_ON(lck->lk_mode == HTREE_LOCK_INVAL);
5228 -++
5229 -++ htree_node_release_all(lck);
5230 -++
5231 -++ htree_spin_lock(lck->lk_head, HTREE_DEP_ROOT);
5232 -++ htree_unlock_internal(lck);
5233 -++ htree_spin_unlock(lck->lk_head, HTREE_DEP_ROOT);
5234 -++ lck->lk_head = NULL;
5235 -++ lck->lk_task = NULL;
5236 -++}
5237 -++EXPORT_SYMBOL(htree_unlock);
5238 -++
5239 -++/* change lock mode */
5240 -++void
5241 -++htree_change_mode(struct htree_lock *lck, htree_lock_mode_t mode)
5242 -++{
5243 -++ BUG_ON(lck->lk_mode == HTREE_LOCK_INVAL);
5244 -++ lck->lk_mode = mode;
5245 -++}
5246 -++EXPORT_SYMBOL(htree_change_mode);
5247 -++
5248 -++/* release htree lock, and lock it again with new mode.
5249 -++ * This function will first release all htree_node_locks and htree_lock,
5250 -++ * then try to gain htree_lock with new @mode.
5251 -++ * It always return 1 with granted lock if @wait is true, it can return 0
5252 -++ * if @wait is false and locking request can't be granted immediately */
5253 -++int
5254 -++htree_change_lock_try(struct htree_lock *lck, htree_lock_mode_t mode, int wait)
5255 -++{
5256 -++ struct htree_lock_head *lhead = lck->lk_head;
5257 -++ int rc;
5258 -++
5259 -++ BUG_ON(lhead == NULL);
5260 -++ BUG_ON(lck->lk_mode == mode);
5261 -++ BUG_ON(lck->lk_mode == HTREE_LOCK_INVAL || mode == HTREE_LOCK_INVAL);
5262 -++
5263 -++ htree_node_release_all(lck);
5264 -++
5265 -++ htree_spin_lock(lhead, HTREE_DEP_ROOT);
5266 -++ htree_unlock_internal(lck);
5267 -++ lck->lk_mode = mode;
5268 -++ rc = htree_lock_internal(lck, wait);
5269 -++ if (rc != 0)
5270 -++ htree_spin_unlock(lhead, HTREE_DEP_ROOT);
5271 -++ return rc >= 0;
5272 -++}
5273 -++EXPORT_SYMBOL(htree_change_lock_try);
5274 -++
5275 -++/* create a htree_lock head with @depth levels (number of child-locks),
5276 -++ * it is a per resoruce structure */
5277 -++struct htree_lock_head *
5278 -++htree_lock_head_alloc(unsigned depth, unsigned hbits, unsigned priv)
5279 -++{
5280 -++ struct htree_lock_head *lhead;
5281 -++ int i;
5282 -++
5283 -++ if (depth > HTREE_LOCK_DEP_MAX) {
5284 -++ printk(KERN_ERR "%d is larger than max htree_lock depth %d\n",
5285 -++ depth, HTREE_LOCK_DEP_MAX);
5286 -++ return NULL;
5287 -++ }
5288 -++
5289 -++ lhead = kzalloc(offsetof(struct htree_lock_head,
5290 -++ lh_children[depth]) + priv, GFP_NOFS);
5291 -++ if (lhead == NULL)
5292 -++ return NULL;
5293 -++
5294 -++ if (hbits < HTREE_HBITS_MIN)
5295 -++ lhead->lh_hbits = HTREE_HBITS_MIN;
5296 -++ else if (hbits > HTREE_HBITS_MAX)
5297 -++ lhead->lh_hbits = HTREE_HBITS_MAX;
5298 -++
5299 -++ lhead->lh_lock = 0;
5300 -++ lhead->lh_depth = depth;
5301 -++ INIT_LIST_HEAD(&lhead->lh_blocked_list);
5302 -++ if (priv > 0) {
5303 -++ lhead->lh_private = (void *)lhead +
5304 -++ offsetof(struct htree_lock_head, lh_children[depth]);
5305 -++ }
5306 -++
5307 -++ for (i = 0; i < depth; i++) {
5308 -++ INIT_LIST_HEAD(&lhead->lh_children[i].lc_list);
5309 -++ lhead->lh_children[i].lc_events = HTREE_EVENT_DISABLE;
5310 -++ }
5311 -++ return lhead;
5312 -++}
5313 -++EXPORT_SYMBOL(htree_lock_head_alloc);
5314 -++
5315 -++/* free the htree_lock head */
5316 -++void
5317 -++htree_lock_head_free(struct htree_lock_head *lhead)
5318 -++{
5319 -++ int i;
5320 -++
5321 -++ BUG_ON(!list_empty(&lhead->lh_blocked_list));
5322 -++ for (i = 0; i < lhead->lh_depth; i++)
5323 -++ BUG_ON(!list_empty(&lhead->lh_children[i].lc_list));
5324 -++ kfree(lhead);
5325 -++}
5326 -++EXPORT_SYMBOL(htree_lock_head_free);
5327 -++
5328 -++/* register event callback for @events of child-lock at level @dep */
5329 -++void
5330 -++htree_lock_event_attach(struct htree_lock_head *lhead, unsigned dep,
5331 -++ unsigned events, htree_event_cb_t callback)
5332 -++{
5333 -++ BUG_ON(lhead->lh_depth <= dep);
5334 -++ lhead->lh_children[dep].lc_events = events;
5335 -++ lhead->lh_children[dep].lc_callback = callback;
5336 -++}
5337 -++EXPORT_SYMBOL(htree_lock_event_attach);
5338 -++
5339 -++/* allocate a htree_lock, which is per-thread structure, @pbytes is some
5340 -++ * extra-bytes as private data for caller */
5341 -++struct htree_lock *
5342 -++htree_lock_alloc(unsigned depth, unsigned pbytes)
5343 -++{
5344 -++ struct htree_lock *lck;
5345 -++ int i = offsetof(struct htree_lock, lk_nodes[depth]);
5346 -++
5347 -++ if (depth > HTREE_LOCK_DEP_MAX) {
5348 -++ printk(KERN_ERR "%d is larger than max htree_lock depth %d\n",
5349 -++ depth, HTREE_LOCK_DEP_MAX);
5350 -++ return NULL;
5351 -++ }
5352 -++ lck = kzalloc(i + pbytes, GFP_NOFS);
5353 -++ if (lck == NULL)
5354 -++ return NULL;
5355 -++
5356 -++ if (pbytes != 0)
5357 -++ lck->lk_private = (void *)lck + i;
5358 -++ lck->lk_mode = HTREE_LOCK_INVAL;
5359 -++ lck->lk_depth = depth;
5360 -++ INIT_LIST_HEAD(&lck->lk_blocked_list);
5361 -++
5362 -++ for (i = 0; i < depth; i++) {
5363 -++ struct htree_lock_node *node = &lck->lk_nodes[i];
5364 -++
5365 -++ node->ln_mode = HTREE_LOCK_INVAL;
5366 -++ INIT_LIST_HEAD(&node->ln_major_list);
5367 -++ INIT_LIST_HEAD(&node->ln_minor_list);
5368 -++ INIT_LIST_HEAD(&node->ln_alive_list);
5369 -++ INIT_LIST_HEAD(&node->ln_blocked_list);
5370 -++ INIT_LIST_HEAD(&node->ln_granted_list);
5371 -++ }
5372 -++
5373 -++ return lck;
5374 -++}
5375 -++EXPORT_SYMBOL(htree_lock_alloc);
5376 -++
5377 -++/* free htree_lock node */
5378 -++void
5379 -++htree_lock_free(struct htree_lock *lck)
5380 -++{
5381 -++ BUG_ON(lck->lk_mode != HTREE_LOCK_INVAL);
5382 -++ kfree(lck);
5383 -++}
5384 -++EXPORT_SYMBOL(htree_lock_free);
5385 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
5386 -+===================================================================
5387 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/ext4.h
5388 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/ext4.h
5389 -+@@ -27,6 +27,7 @@
5390 -+ #include <linux/mutex.h>
5391 -+ #include <linux/timer.h>
5392 -+ #include <linux/wait.h>
5393 -++#include <linux/htree_lock.h>
5394 -+ #include <linux/blockgroup_lock.h>
5395 -+ #include <linux/percpu_counter.h>
5396 -+ #include <crypto/hash.h>
5397 -+@@ -1533,6 +1534,7 @@ static inline void ext4_clear_state_flag
5398 -+ EXT4_FEATURE_INCOMPAT_META_BG| \
5399 -+ EXT4_FEATURE_INCOMPAT_EXTENTS| \
5400 -+ EXT4_FEATURE_INCOMPAT_64BIT| \
5401 -++ EXT4_FEATURE_INCOMPAT_LARGEDIR|\
5402 -+ EXT4_FEATURE_INCOMPAT_FLEX_BG| \
5403 -+ EXT4_FEATURE_INCOMPAT_EA_INODE| \
5404 -+ EXT4_FEATURE_INCOMPAT_MMP | \
5405 -+@@ -1958,6 +1960,76 @@ struct mmpd_data {
5406 -+ # define NORET_TYPE /**/
5407 -+ # define ATTRIB_NORET __attribute__((noreturn))
5408 -+ # define NORET_AND noreturn,
5409 -++/* htree levels for ext4 */
5410 -++#define EXT4_HTREE_LEVEL_COMPAT 2
5411 -++#define EXT4_HTREE_LEVEL 3
5412 -++
5413 -++static inline int
5414 -++ext4_dir_htree_level(struct super_block *sb)
5415 -++{
5416 -++ return EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_LARGEDIR) ?
5417 -++ EXT4_HTREE_LEVEL : EXT4_HTREE_LEVEL_COMPAT;
5418 -++}
5419 -++
5420 -++/* assume name-hash is protected by upper layer */
5421 -++#define EXT4_HTREE_LOCK_HASH 0
5422 -++
5423 -++enum ext4_pdo_lk_types {
5424 -++#if EXT4_HTREE_LOCK_HASH
5425 -++ EXT4_LK_HASH,
5426 -++#endif
5427 -++ EXT4_LK_DX, /* index block */
5428 -++ EXT4_LK_DE, /* directory entry block */
5429 -++ EXT4_LK_SPIN, /* spinlock */
5430 -++ EXT4_LK_MAX,
5431 -++};
5432 -++
5433 -++/* read-only bit */
5434 -++#define EXT4_LB_RO(b) (1 << (b))
5435 -++/* read + write, high bits for writer */
5436 -++#define EXT4_LB_RW(b) ((1 << (b)) | (1 << (EXT4_LK_MAX + (b))))
5437 -++
5438 -++enum ext4_pdo_lock_bits {
5439 -++ /* DX lock bits */
5440 -++ EXT4_LB_DX_RO = EXT4_LB_RO(EXT4_LK_DX),
5441 -++ EXT4_LB_DX = EXT4_LB_RW(EXT4_LK_DX),
5442 -++ /* DE lock bits */
5443 -++ EXT4_LB_DE_RO = EXT4_LB_RO(EXT4_LK_DE),
5444 -++ EXT4_LB_DE = EXT4_LB_RW(EXT4_LK_DE),
5445 -++ /* DX spinlock bits */
5446 -++ EXT4_LB_SPIN_RO = EXT4_LB_RO(EXT4_LK_SPIN),
5447 -++ EXT4_LB_SPIN = EXT4_LB_RW(EXT4_LK_SPIN),
5448 -++ /* accurate searching */
5449 -++ EXT4_LB_EXACT = EXT4_LB_RO(EXT4_LK_MAX << 1),
5450 -++};
5451 -++
5452 -++enum ext4_pdo_lock_opc {
5453 -++ /* external */
5454 -++ EXT4_HLOCK_READDIR = (EXT4_LB_DE_RO | EXT4_LB_DX_RO),
5455 -++ EXT4_HLOCK_LOOKUP = (EXT4_LB_DE_RO | EXT4_LB_SPIN_RO |
5456 -++ EXT4_LB_EXACT),
5457 -++ EXT4_HLOCK_DEL = (EXT4_LB_DE | EXT4_LB_SPIN_RO |
5458 -++ EXT4_LB_EXACT),
5459 -++ EXT4_HLOCK_ADD = (EXT4_LB_DE | EXT4_LB_SPIN_RO),
5460 -++
5461 -++ /* internal */
5462 -++ EXT4_HLOCK_LOOKUP_SAFE = (EXT4_LB_DE_RO | EXT4_LB_DX_RO |
5463 -++ EXT4_LB_EXACT),
5464 -++ EXT4_HLOCK_DEL_SAFE = (EXT4_LB_DE | EXT4_LB_DX_RO | EXT4_LB_EXACT),
5465 -++ EXT4_HLOCK_SPLIT = (EXT4_LB_DE | EXT4_LB_DX | EXT4_LB_SPIN),
5466 -++};
5467 -++
5468 -++extern struct htree_lock_head *ext4_htree_lock_head_alloc(unsigned hbits);
5469 -++#define ext4_htree_lock_head_free(lhead) htree_lock_head_free(lhead)
5470 -++
5471 -++extern struct htree_lock *ext4_htree_lock_alloc(void);
5472 -++#define ext4_htree_lock_free(lck) htree_lock_free(lck)
5473 -++
5474 -++extern void ext4_htree_lock(struct htree_lock *lck,
5475 -++ struct htree_lock_head *lhead,
5476 -++ struct inode *dir, unsigned flags);
5477 -++#define ext4_htree_unlock(lck) htree_unlock(lck)
5478 -++
5479 -+
5480 -+ /* bitmap.c */
5481 -+ extern unsigned int ext4_count_free(char *bitmap, unsigned numchars);
5482 -+@@ -2050,9 +2122,17 @@ void ext4_insert_dentry(struct inode *in
5483 -+ const char *name, int namelen, void *data);
5484 -+ static inline void ext4_update_dx_flag(struct inode *inode)
5485 -+ {
5486 -++ /* Disable it for ldiskfs, because going from a DX directory to
5487 -++ * a non-DX directory while it is in use will completely break
5488 -++ * the htree-locking.
5489 -++ * If we really want to support this operation in the future,
5490 -++ * we need to exclusively lock the directory at here which will
5491 -++ * increase complexity of code */
5492 -++#if 0
5493 -+ if (!EXT4_HAS_COMPAT_FEATURE(inode->i_sb,
5494 -+ EXT4_FEATURE_COMPAT_DIR_INDEX))
5495 -+ ext4_clear_inode_flag(inode, EXT4_INODE_INDEX);
5496 -++#endif
5497 -+ }
5498 -+ static unsigned char ext4_filetype_table[] = {
5499 -+ DT_UNKNOWN, DT_REG, DT_DIR, DT_CHR, DT_BLK, DT_FIFO, DT_SOCK, DT_LNK
5500 -+@@ -2215,15 +2295,16 @@ extern int ext4_htree_fill_tree(struct f
5501 -+ extern struct inode *ext4_create_inode(handle_t *handle,
5502 -+ struct inode * dir, int mode);
5503 -+ extern int ext4_add_entry(handle_t *handle, struct dentry *dentry,
5504 -+- struct inode *inode);
5505 -++ struct inode *inode, struct htree_lock *lck);
5506 -+ extern int ext4_delete_entry(handle_t *handle, struct inode * dir,
5507 -+ struct ext4_dir_entry_2 * de_del,
5508 -+ struct buffer_head * bh);
5509 -+ extern struct buffer_head * ext4_find_entry(struct inode *dir,
5510 -+ const struct qstr *d_name,
5511 -+ struct ext4_dir_entry_2 ** res_dir,
5512 -+- int *inlined);
5513 -+-#define ll_ext4_find_entry(inode, dentry, res_dir) ext4_find_entry(inode, &(dentry)->d_name, res_dir, NULL)
5514 -++ int *inlined, struct htree_lock *lck);
5515 -++#define ll_ext4_find_entry(inode, dentry, res_dir, lck) \
5516 -++ ext4_find_entry(inode, &(dentry)->d_name, res_dir, NULL, lck)
5517 -+ extern struct buffer_head *ext4_append(handle_t *handle,
5518 -+ struct inode *inode,
5519 -+ ext4_lblk_t *block);
5520 -+@@ -2443,13 +2524,15 @@ static inline void ext4_r_blocks_count_s
5521 -+ es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
5522 -+ }
5523 -+
5524 -+-static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
5525 -++static inline loff_t ext4_isize(struct super_block *sb,
5526 -++ struct ext4_inode *raw_inode)
5527 -+ {
5528 -+- if (S_ISREG(le16_to_cpu(raw_inode->i_mode)))
5529 -++ if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_LARGEDIR) ||
5530 -++ S_ISREG(le16_to_cpu(raw_inode->i_mode)))
5531 -+ return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
5532 -+ le32_to_cpu(raw_inode->i_size_lo);
5533 -+- else
5534 -+- return (loff_t) le32_to_cpu(raw_inode->i_size_lo);
5535 -++
5536 -++ return (loff_t) le32_to_cpu(raw_inode->i_size_lo);
5537 -+ }
5538 -+
5539 -+ static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
5540 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
5541 -+===================================================================
5542 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/namei.c
5543 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/namei.c
5544 -+@@ -254,7 +254,7 @@ static struct dx_frame *dx_probe(const s
5545 -+ struct inode *dir,
5546 -+ struct dx_hash_info *hinfo,
5547 -+ struct dx_frame *frame,
5548 -+- int *err);
5549 -++ struct htree_lock *lck, int *err);
5550 -+ static void dx_release(struct dx_frame *frames);
5551 -+ static int dx_make_map(struct ext4_dir_entry_2 *de, unsigned blocksize,
5552 -+ struct dx_hash_info *hinfo, struct dx_map_entry map[]);
5553 -+@@ -267,13 +267,13 @@ static void dx_insert_block(struct dx_fr
5554 -+ static int ext4_htree_next_block(struct inode *dir, __u32 hash,
5555 -+ struct dx_frame *frame,
5556 -+ struct dx_frame *frames,
5557 -+- __u32 *start_hash);
5558 -++ __u32 *start_hash, struct htree_lock *lck);
5559 -+ static struct buffer_head * ext4_dx_find_entry(struct inode *dir,
5560 -+ const struct qstr *d_name,
5561 -+ struct ext4_dir_entry_2 **res_dir,
5562 -+- int *err);
5563 -++ struct htree_lock *lck, int *err);
5564 -+ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
5565 -+- struct inode *inode);
5566 -++ struct inode *inode, struct htree_lock *lck);
5567 -+
5568 -+ /* checksumming functions */
5569 -+ void initialize_dirent_tail(struct ext4_dir_entry_tail *t,
5570 -+@@ -525,7 +525,7 @@ struct dx_root_info * dx_get_dx_info(str
5571 -+
5572 -+ static inline ext4_lblk_t dx_get_block(struct dx_entry *entry)
5573 -+ {
5574 -+- return le32_to_cpu(entry->block) & 0x00ffffff;
5575 -++ return le32_to_cpu(entry->block) & 0x0fffffff;
5576 -+ }
5577 -+
5578 -+ static inline void dx_set_block(struct dx_entry *entry, ext4_lblk_t value)
5579 -+@@ -675,6 +675,223 @@ struct stats dx_show_entries(struct dx_h
5580 -+ }
5581 -+ #endif /* DX_DEBUG */
5582 -+
5583 -++/* private data for htree_lock */
5584 -++struct ext4_dir_lock_data {
5585 -++ unsigned ld_flags; /* bits-map for lock types */
5586 -++ unsigned ld_count; /* # entries of the last DX block */
5587 -++ struct dx_entry ld_at_entry; /* copy of leaf dx_entry */
5588 -++ struct dx_entry *ld_at; /* position of leaf dx_entry */
5589 -++};
5590 -++
5591 -++#define ext4_htree_lock_data(l) ((struct ext4_dir_lock_data *)(l)->lk_private)
5592 -++
5593 -++/* NB: ext4_lblk_t is 32 bits so we use high bits to identify invalid blk */
5594 -++#define EXT4_HTREE_NODE_CHANGED (0xcafeULL << 32)
5595 -++
5596 -++static void ext4_htree_event_cb(void *target, void *event)
5597 -++{
5598 -++ u64 *block = (u64 *)target;
5599 -++
5600 -++ if (*block == dx_get_block((struct dx_entry *)event))
5601 -++ *block = EXT4_HTREE_NODE_CHANGED;
5602 -++}
5603 -++
5604 -++struct htree_lock_head *ext4_htree_lock_head_alloc(unsigned hbits)
5605 -++{
5606 -++ struct htree_lock_head *lhead;
5607 -++
5608 -++ lhead = htree_lock_head_alloc(EXT4_LK_MAX, hbits, 0);
5609 -++ if (lhead != NULL) {
5610 -++ htree_lock_event_attach(lhead, EXT4_LK_SPIN, HTREE_EVENT_WR,
5611 -++ ext4_htree_event_cb);
5612 -++ }
5613 -++ return lhead;
5614 -++}
5615 -++EXPORT_SYMBOL(ext4_htree_lock_head_alloc);
5616 -++
5617 -++struct htree_lock *ext4_htree_lock_alloc(void)
5618 -++{
5619 -++ return htree_lock_alloc(EXT4_LK_MAX,
5620 -++ sizeof(struct ext4_dir_lock_data));
5621 -++}
5622 -++EXPORT_SYMBOL(ext4_htree_lock_alloc);
5623 -++
5624 -++static htree_lock_mode_t ext4_htree_mode(unsigned flags)
5625 -++{
5626 -++ switch (flags) {
5627 -++ default: /* 0 or unknown flags require EX lock */
5628 -++ return HTREE_LOCK_EX;
5629 -++ case EXT4_HLOCK_READDIR:
5630 -++ return HTREE_LOCK_PR;
5631 -++ case EXT4_HLOCK_LOOKUP:
5632 -++ return HTREE_LOCK_CR;
5633 -++ case EXT4_HLOCK_DEL:
5634 -++ case EXT4_HLOCK_ADD:
5635 -++ return HTREE_LOCK_CW;
5636 -++ }
5637 -++}
5638 -++
5639 -++/* return PR for read-only operations, otherwise return EX */
5640 -++static inline htree_lock_mode_t ext4_htree_safe_mode(unsigned flags)
5641 -++{
5642 -++ int writer = (flags & EXT4_LB_DE) == EXT4_LB_DE;
5643 -++
5644 -++ /* 0 requires EX lock */
5645 -++ return (flags == 0 || writer) ? HTREE_LOCK_EX : HTREE_LOCK_PR;
5646 -++}
5647 -++
5648 -++static int ext4_htree_safe_locked(struct htree_lock *lck)
5649 -++{
5650 -++ int writer;
5651 -++
5652 -++ if (lck == NULL || lck->lk_mode == HTREE_LOCK_EX)
5653 -++ return 1;
5654 -++
5655 -++ writer = (ext4_htree_lock_data(lck)->ld_flags & EXT4_LB_DE) ==
5656 -++ EXT4_LB_DE;
5657 -++ if (writer) /* all readers & writers are excluded? */
5658 -++ return lck->lk_mode == HTREE_LOCK_EX;
5659 -++
5660 -++ /* all writers are excluded? */
5661 -++ return lck->lk_mode == HTREE_LOCK_PR ||
5662 -++ lck->lk_mode == HTREE_LOCK_PW ||
5663 -++ lck->lk_mode == HTREE_LOCK_EX;
5664 -++}
5665 -++
5666 -++/* relock htree_lock with EX mode if it's change operation, otherwise
5667 -++ * relock it with PR mode. It's noop if PDO is disabled. */
5668 -++static void ext4_htree_safe_relock(struct htree_lock *lck)
5669 -++{
5670 -++ if (!ext4_htree_safe_locked(lck)) {
5671 -++ unsigned flags = ext4_htree_lock_data(lck)->ld_flags;
5672 -++
5673 -++ htree_change_lock(lck, ext4_htree_safe_mode(flags));
5674 -++ }
5675 -++}
5676 -++
5677 -++void ext4_htree_lock(struct htree_lock *lck, struct htree_lock_head *lhead,
5678 -++ struct inode *dir, unsigned flags)
5679 -++{
5680 -++ htree_lock_mode_t mode = is_dx(dir) ? ext4_htree_mode(flags) :
5681 -++ ext4_htree_safe_mode(flags);
5682 -++
5683 -++ ext4_htree_lock_data(lck)->ld_flags = flags;
5684 -++ htree_lock(lck, lhead, mode);
5685 -++ if (!is_dx(dir))
5686 -++ ext4_htree_safe_relock(lck); /* make sure it's safe locked */
5687 -++}
5688 -++EXPORT_SYMBOL(ext4_htree_lock);
5689 -++
5690 -++static int ext4_htree_node_lock(struct htree_lock *lck, struct dx_entry *at,
5691 -++ unsigned lmask, int wait, void *ev)
5692 -++{
5693 -++ u32 key = (at == NULL) ? 0 : dx_get_block(at);
5694 -++ u32 mode;
5695 -++
5696 -++ /* NOOP if htree is well protected or caller doesn't require the lock */
5697 -++ if (ext4_htree_safe_locked(lck) ||
5698 -++ !(ext4_htree_lock_data(lck)->ld_flags & lmask))
5699 -++ return 1;
5700 -++
5701 -++ mode = (ext4_htree_lock_data(lck)->ld_flags & lmask) == lmask ?
5702 -++ HTREE_LOCK_PW : HTREE_LOCK_PR;
5703 -++ while (1) {
5704 -++ if (htree_node_lock_try(lck, mode, key, ffz(~lmask), wait, ev))
5705 -++ return 1;
5706 -++ if (!(lmask & EXT4_LB_SPIN)) /* not a spinlock */
5707 -++ return 0;
5708 -++ cpu_relax(); /* spin until granted */
5709 -++ }
5710 -++}
5711 -++
5712 -++static int ext4_htree_node_locked(struct htree_lock *lck, unsigned lmask)
5713 -++{
5714 -++ return ext4_htree_safe_locked(lck) ||
5715 -++ htree_node_is_granted(lck, ffz(~lmask));
5716 -++}
5717 -++
5718 -++static void ext4_htree_node_unlock(struct htree_lock *lck,
5719 -++ unsigned lmask, void *buf)
5720 -++{
5721 -++ /* NB: it's safe to call mutiple times or even it's not locked */
5722 -++ if (!ext4_htree_safe_locked(lck) &&
5723 -++ htree_node_is_granted(lck, ffz(~lmask)))
5724 -++ htree_node_unlock(lck, ffz(~lmask), buf);
5725 -++}
5726 -++
5727 -++#define ext4_htree_dx_lock(lck, key) \
5728 -++ ext4_htree_node_lock(lck, key, EXT4_LB_DX, 1, NULL)
5729 -++#define ext4_htree_dx_lock_try(lck, key) \
5730 -++ ext4_htree_node_lock(lck, key, EXT4_LB_DX, 0, NULL)
5731 -++#define ext4_htree_dx_unlock(lck) \
5732 -++ ext4_htree_node_unlock(lck, EXT4_LB_DX, NULL)
5733 -++#define ext4_htree_dx_locked(lck) \
5734 -++ ext4_htree_node_locked(lck, EXT4_LB_DX)
5735 -++
5736 -++static void ext4_htree_dx_need_lock(struct htree_lock *lck)
5737 -++{
5738 -++ struct ext4_dir_lock_data *ld;
5739 -++
5740 -++ if (ext4_htree_safe_locked(lck))
5741 -++ return;
5742 -++
5743 -++ ld = ext4_htree_lock_data(lck);
5744 -++ switch (ld->ld_flags) {
5745 -++ default:
5746 -++ return;
5747 -++ case EXT4_HLOCK_LOOKUP:
5748 -++ ld->ld_flags = EXT4_HLOCK_LOOKUP_SAFE;
5749 -++ return;
5750 -++ case EXT4_HLOCK_DEL:
5751 -++ ld->ld_flags = EXT4_HLOCK_DEL_SAFE;
5752 -++ return;
5753 -++ case EXT4_HLOCK_ADD:
5754 -++ ld->ld_flags = EXT4_HLOCK_SPLIT;
5755 -++ return;
5756 -++ }
5757 -++}
5758 -++
5759 -++#define ext4_htree_de_lock(lck, key) \
5760 -++ ext4_htree_node_lock(lck, key, EXT4_LB_DE, 1, NULL)
5761 -++#define ext4_htree_de_unlock(lck) \
5762 -++ ext4_htree_node_unlock(lck, EXT4_LB_DE, NULL)
5763 -++
5764 -++#define ext4_htree_spin_lock(lck, key, event) \
5765 -++ ext4_htree_node_lock(lck, key, EXT4_LB_SPIN, 0, event)
5766 -++#define ext4_htree_spin_unlock(lck) \
5767 -++ ext4_htree_node_unlock(lck, EXT4_LB_SPIN, NULL)
5768 -++#define ext4_htree_spin_unlock_listen(lck, p) \
5769 -++ ext4_htree_node_unlock(lck, EXT4_LB_SPIN, p)
5770 -++
5771 -++static void ext4_htree_spin_stop_listen(struct htree_lock *lck)
5772 -++{
5773 -++ if (!ext4_htree_safe_locked(lck) &&
5774 -++ htree_node_is_listening(lck, ffz(~EXT4_LB_SPIN)))
5775 -++ htree_node_stop_listen(lck, ffz(~EXT4_LB_SPIN));
5776 -++}
5777 -++
5778 -++enum {
5779 -++ DX_HASH_COL_IGNORE, /* ignore collision while probing frames */
5780 -++ DX_HASH_COL_YES, /* there is collision and it does matter */
5781 -++ DX_HASH_COL_NO, /* there is no collision */
5782 -++};
5783 -++
5784 -++static int dx_probe_hash_collision(struct htree_lock *lck,
5785 -++ struct dx_entry *entries,
5786 -++ struct dx_entry *at, u32 hash)
5787 -++{
5788 -++ if (!(ext4_htree_lock_data(lck)->ld_flags & EXT4_LB_EXACT)) {
5789 -++ return DX_HASH_COL_IGNORE; /* don't care about collision */
5790 -++
5791 -++ } else if (at == entries + dx_get_count(entries) - 1) {
5792 -++ return DX_HASH_COL_IGNORE; /* not in any leaf of this DX */
5793 -++
5794 -++ } else { /* hash collision? */
5795 -++ return ((dx_get_hash(at + 1) & ~1) == hash) ?
5796 -++ DX_HASH_COL_YES : DX_HASH_COL_NO;
5797 -++ }
5798 -++}
5799 -++
5800 -+ /*
5801 -+ * Probe for a directory leaf block to search.
5802 -+ *
5803 -+@@ -686,16 +903,17 @@ struct stats dx_show_entries(struct dx_h
5804 -+ */
5805 -+ static struct dx_frame *
5806 -+ dx_probe(const struct qstr *d_name, struct inode *dir,
5807 -+- struct dx_hash_info *hinfo, struct dx_frame *frame_in, int *err)
5808 -++ struct dx_hash_info *hinfo, struct dx_frame *frame_in,
5809 -++ struct htree_lock *lck, int *err)
5810 -+ {
5811 -+ unsigned count, indirect;
5812 -+- struct dx_entry *at, *entries, *p, *q, *m;
5813 -++ struct dx_entry *at, *entries, *p, *q, *m, *dx = NULL;
5814 -+ struct dx_root_info * info;
5815 -+ struct buffer_head *bh;
5816 -+ struct dx_frame *frame = frame_in;
5817 -+ u32 hash;
5818 -+
5819 -+- frame->bh = NULL;
5820 -++ memset(frame_in, 0, EXT4_HTREE_LEVEL * sizeof(frame_in[0]));
5821 -+ bh = ext4_read_dirblock(dir, 0, INDEX);
5822 -+ if (IS_ERR(bh)) {
5823 -+ *err = PTR_ERR(bh);
5824 -+@@ -728,9 +946,16 @@ dx_probe(const struct qstr *d_name, stru
5825 -+ goto fail;
5826 -+ }
5827 -+
5828 -+- if ((indirect = info->indirect_levels) > 1) {
5829 -+- ext4_warning(dir->i_sb, "Unimplemented inode hash depth: %#06x",
5830 -+- info->indirect_levels);
5831 -++ indirect = info->indirect_levels;
5832 -++ if (indirect >= ext4_dir_htree_level(dir->i_sb)) {
5833 -++ ext4_warning(dir->i_sb,
5834 -++ "Directory (ino: %lu) htree depth %#06x exceed "
5835 -++ "supported value", dir->i_ino,
5836 -++ ext4_dir_htree_level(dir->i_sb));
5837 -++ if (ext4_dir_htree_level(dir->i_sb) < EXT4_HTREE_LEVEL) {
5838 -++ ext4_warning(dir->i_sb, "Enable large directory "
5839 -++ "feature to access it");
5840 -++ }
5841 -+ brelse(bh);
5842 -+ *err = ERR_BAD_DX_DIR;
5843 -+ goto fail;
5844 -+@@ -750,8 +975,15 @@ dx_probe(const struct qstr *d_name, stru
5845 -+ dxtrace(printk("Look up %x", hash));
5846 -+ while (1)
5847 -+ {
5848 -++ if (indirect == 0) { /* the last index level */
5849 -++ /* NB: ext4_htree_dx_lock() could be noop if
5850 -++ * DX-lock flag is not set for current operation */
5851 -++ ext4_htree_dx_lock(lck, dx);
5852 -++ ext4_htree_spin_lock(lck, dx, NULL);
5853 -++ }
5854 -+ count = dx_get_count(entries);
5855 -+- if (!count || count > dx_get_limit(entries)) {
5856 -++ if (count == 0 || count > dx_get_limit(entries)) {
5857 -++ ext4_htree_spin_unlock(lck); /* release spin */
5858 -+ ext4_warning(dir->i_sb,
5859 -+ "dx entry: no count or count > limit");
5860 -+ brelse(bh);
5861 -+@@ -792,7 +1024,70 @@ dx_probe(const struct qstr *d_name, stru
5862 -+ frame->bh = bh;
5863 -+ frame->entries = entries;
5864 -+ frame->at = at;
5865 -+- if (!indirect--) return frame;
5866 -++
5867 -++ if (indirect == 0) { /* the last index level */
5868 -++ struct ext4_dir_lock_data *ld;
5869 -++ u64 myblock;
5870 -++
5871 -++ /* By default we only lock DE-block, however, we will
5872 -++ * also lock the last level DX-block if:
5873 -++ * a) there is hash collision
5874 -++ * we will set DX-lock flag (a few lines below)
5875 -++ * and redo to lock DX-block
5876 -++ * see detail in dx_probe_hash_collision()
5877 -++ * b) it's a retry from splitting
5878 -++ * we need to lock the last level DX-block so nobody
5879 -++ * else can split any leaf blocks under the same
5880 -++ * DX-block, see detail in ext4_dx_add_entry()
5881 -++ */
5882 -++ if (ext4_htree_dx_locked(lck)) {
5883 -++ /* DX-block is locked, just lock DE-block
5884 -++ * and return */
5885 -++ ext4_htree_spin_unlock(lck);
5886 -++ if (!ext4_htree_safe_locked(lck))
5887 -++ ext4_htree_de_lock(lck, frame->at);
5888 -++ return frame;
5889 -++ }
5890 -++ /* it's pdirop and no DX lock */
5891 -++ if (dx_probe_hash_collision(lck, entries, at, hash) ==
5892 -++ DX_HASH_COL_YES) {
5893 -++ /* found hash collision, set DX-lock flag
5894 -++ * and retry to abtain DX-lock */
5895 -++ ext4_htree_spin_unlock(lck);
5896 -++ ext4_htree_dx_need_lock(lck);
5897 -++ continue;
5898 -++ }
5899 -++ ld = ext4_htree_lock_data(lck);
5900 -++ /* because I don't lock DX, so @at can't be trusted
5901 -++ * after I release spinlock so I have to save it */
5902 -++ ld->ld_at = at;
5903 -++ ld->ld_at_entry = *at;
5904 -++ ld->ld_count = dx_get_count(entries);
5905 -++
5906 -++ frame->at = &ld->ld_at_entry;
5907 -++ myblock = dx_get_block(at);
5908 -++
5909 -++ /* NB: ordering locking */
5910 -++ ext4_htree_spin_unlock_listen(lck, &myblock);
5911 -++ /* other thread can split this DE-block because:
5912 -++ * a) I don't have lock for the DE-block yet
5913 -++ * b) I released spinlock on DX-block
5914 -++ * if it happened I can detect it by listening
5915 -++ * splitting event on this DE-block */
5916 -++ ext4_htree_de_lock(lck, frame->at);
5917 -++ ext4_htree_spin_stop_listen(lck);
5918 -++
5919 -++ if (myblock == EXT4_HTREE_NODE_CHANGED) {
5920 -++ /* someone split this DE-block before
5921 -++ * I locked it, I need to retry and lock
5922 -++ * valid DE-block */
5923 -++ ext4_htree_de_unlock(lck);
5924 -++ continue;
5925 -++ }
5926 -++ return frame;
5927 -++ }
5928 -++ dx = at;
5929 -++ indirect--;
5930 -+ bh = ext4_read_dirblock(dir, dx_get_block(at), INDEX);
5931 -+ if (IS_ERR(bh)) {
5932 -+ *err = PTR_ERR(bh);
5933 -+@@ -826,13 +1121,18 @@ fail:
5934 -+ static void dx_release (struct dx_frame *frames)
5935 -+ {
5936 -+ struct dx_root_info *info;
5937 -++ int i;
5938 -++
5939 -+ if (frames[0].bh == NULL)
5940 -+ return;
5941 -+
5942 -+ info = dx_get_dx_info((struct ext4_dir_entry_2*)frames[0].bh->b_data);
5943 -+- if (info->indirect_levels)
5944 -+- brelse(frames[1].bh);
5945 -+- brelse(frames[0].bh);
5946 -++ for (i = 0; i <= info->indirect_levels; i++) {
5947 -++ if (frames[i].bh == NULL)
5948 -++ break;
5949 -++ brelse(frames[i].bh);
5950 -++ frames[i].bh = NULL;
5951 -++ }
5952 -+ }
5953 -+
5954 -+ /*
5955 -+@@ -855,7 +1155,7 @@ static void dx_release (struct dx_frame
5956 -+ static int ext4_htree_next_block(struct inode *dir, __u32 hash,
5957 -+ struct dx_frame *frame,
5958 -+ struct dx_frame *frames,
5959 -+- __u32 *start_hash)
5960 -++ __u32 *start_hash, struct htree_lock *lck)
5961 -+ {
5962 -+ struct dx_frame *p;
5963 -+ struct buffer_head *bh;
5964 -+@@ -870,12 +1170,22 @@ static int ext4_htree_next_block(struct
5965 -+ * this loop, num_frames indicates the number of interior
5966 -+ * nodes need to be read.
5967 -+ */
5968 -++ ext4_htree_de_unlock(lck);
5969 -+ while (1) {
5970 -+- if (++(p->at) < p->entries + dx_get_count(p->entries))
5971 -+- break;
5972 -++ if (num_frames > 0 || ext4_htree_dx_locked(lck)) {
5973 -++ /* num_frames > 0 :
5974 -++ * DX block
5975 -++ * ext4_htree_dx_locked:
5976 -++ * frame->at is reliable pointer returned by dx_probe,
5977 -++ * otherwise dx_probe already knew no collision */
5978 -++ if (++(p->at) < p->entries + dx_get_count(p->entries))
5979 -++ break;
5980 -++ }
5981 -+ if (p == frames)
5982 -+ return 0;
5983 -+ num_frames++;
5984 -++ if (num_frames == 1)
5985 -++ ext4_htree_dx_unlock(lck);
5986 -+ p--;
5987 -+ }
5988 -+
5989 -+@@ -898,6 +1208,13 @@ static int ext4_htree_next_block(struct
5990 -+ * block so no check is necessary
5991 -+ */
5992 -+ while (num_frames--) {
5993 -++ if (num_frames == 0) {
5994 -++ /* it's not always necessary, we just don't want to
5995 -++ * detect hash collision again */
5996 -++ ext4_htree_dx_need_lock(lck);
5997 -++ ext4_htree_dx_lock(lck, p->at);
5998 -++ }
5999 -++
6000 -+ bh = ext4_read_dirblock(dir, dx_get_block(p->at), INDEX);
6001 -+ if (IS_ERR(bh))
6002 -+ return PTR_ERR(bh);
6003 -+@@ -906,6 +1223,7 @@ static int ext4_htree_next_block(struct
6004 -+ p->bh = bh;
6005 -+ p->at = p->entries = ((struct dx_node *) bh->b_data)->entries;
6006 -+ }
6007 -++ ext4_htree_de_lock(lck, p->at);
6008 -+ return 1;
6009 -+ }
6010 -+
6011 -+@@ -974,7 +1292,7 @@ int ext4_htree_fill_tree(struct file *di
6012 -+ {
6013 -+ struct dx_hash_info hinfo;
6014 -+ struct ext4_dir_entry_2 *de;
6015 -+- struct dx_frame frames[2], *frame;
6016 -++ struct dx_frame frames[EXT4_HTREE_LEVEL], *frame;
6017 -+ struct inode *dir;
6018 -+ ext4_lblk_t block;
6019 -+ int count = 0;
6020 -+@@ -1008,10 +1326,10 @@ int ext4_htree_fill_tree(struct file *di
6021 -+ }
6022 -+ hinfo.hash = start_hash;
6023 -+ hinfo.minor_hash = 0;
6024 -+- frame = dx_probe(NULL, dir, &hinfo, frames, &err);
6025 -++ /* assume it's PR locked */
6026 -++ frame = dx_probe(NULL, dir, &hinfo, frames, NULL, &err);
6027 -+ if (!frame)
6028 -+ return err;
6029 -+-
6030 -+ /* Add '.' and '..' from the htree header */
6031 -+ if (!start_hash && !start_minor_hash) {
6032 -+ de = (struct ext4_dir_entry_2 *) frames[0].bh->b_data;
6033 -+@@ -1038,7 +1356,7 @@ int ext4_htree_fill_tree(struct file *di
6034 -+ count += ret;
6035 -+ hashval = ~0;
6036 -+ ret = ext4_htree_next_block(dir, HASH_NB_ALWAYS,
6037 -+- frame, frames, &hashval);
6038 -++ frame, frames, &hashval, NULL);
6039 -+ *next_hash = hashval;
6040 -+ if (ret < 0) {
6041 -+ err = ret;
6042 -+@@ -1234,7 +1552,7 @@ static int is_dx_internal_node(struct in
6043 -+ struct buffer_head * ext4_find_entry(struct inode *dir,
6044 -+ const struct qstr *d_name,
6045 -+ struct ext4_dir_entry_2 **res_dir,
6046 -+- int *inlined)
6047 -++ int *inlined, struct htree_lock *lck)
6048 -+ {
6049 -+ struct super_block *sb;
6050 -+ struct buffer_head *bh_use[NAMEI_RA_SIZE];
6051 -+@@ -1278,7 +1596,7 @@ struct buffer_head * ext4_find_entry(str
6052 -+ goto restart;
6053 -+ }
6054 -+ if (is_dx(dir)) {
6055 -+- bh = ext4_dx_find_entry(dir, d_name, res_dir, &err);
6056 -++ bh = ext4_dx_find_entry(dir, d_name, res_dir, lck, &err);
6057 -+ /*
6058 -+ * On success, or if the error was file not found,
6059 -+ * return. Otherwise, fall back to doing a search the
6060 -+@@ -1288,6 +1606,7 @@ struct buffer_head * ext4_find_entry(str
6061 -+ return bh;
6062 -+ dxtrace(printk(KERN_DEBUG "ext4_find_entry: dx failed, "
6063 -+ "falling back\n"));
6064 -++ ext4_htree_safe_relock(lck);
6065 -+ }
6066 -+ nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb);
6067 -+ start = EXT4_I(dir)->i_dir_start_lookup;
6068 -+@@ -1377,17 +1696,19 @@ cleanup_and_exit:
6069 -+ }
6070 -+ EXPORT_SYMBOL(ext4_find_entry);
6071 -+
6072 -+-static struct buffer_head * ext4_dx_find_entry(struct inode *dir, const struct qstr *d_name,
6073 -+- struct ext4_dir_entry_2 **res_dir, int *err)
6074 -++static struct buffer_head * ext4_dx_find_entry(struct inode *dir,
6075 -++ const struct qstr *d_name,
6076 -++ struct ext4_dir_entry_2 **res_dir,
6077 -++ struct htree_lock *lck, int *err)
6078 -+ {
6079 -+ struct super_block * sb = dir->i_sb;
6080 -+ struct dx_hash_info hinfo;
6081 -+- struct dx_frame frames[2], *frame;
6082 -++ struct dx_frame frames[EXT4_HTREE_LEVEL], *frame;
6083 -+ struct buffer_head *bh;
6084 -+ ext4_lblk_t block;
6085 -+ int retval;
6086 -+
6087 -+- if (!(frame = dx_probe(d_name, dir, &hinfo, frames, err)))
6088 -++ if (!(frame = dx_probe(d_name, dir, &hinfo, frames, lck, err)))
6089 -+ return NULL;
6090 -+ do {
6091 -+ block = dx_get_block(frame->at);
6092 -+@@ -1411,7 +1732,7 @@ static struct buffer_head * ext4_dx_find
6093 -+
6094 -+ /* Check to see if we should continue to search */
6095 -+ retval = ext4_htree_next_block(dir, hinfo.hash, frame,
6096 -+- frames, NULL);
6097 -++ frames, NULL, lck);
6098 -+ if (retval < 0) {
6099 -+ ext4_warning(sb,
6100 -+ "error reading index page in directory #%lu",
6101 -+@@ -1437,7 +1758,7 @@ static struct dentry *ext4_lookup(struct
6102 -+ if (dentry->d_name.len > EXT4_NAME_LEN)
6103 -+ return ERR_PTR(-ENAMETOOLONG);
6104 -+
6105 -+- bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL);
6106 -++ bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL, NULL);
6107 -+ inode = NULL;
6108 -+ if (bh) {
6109 -+ __u32 ino = le32_to_cpu(de->inode);
6110 -+@@ -1497,7 +1818,7 @@ struct dentry *ext4_get_parent(struct de
6111 -+ struct ext4_dir_entry_2 * de;
6112 -+ struct buffer_head *bh;
6113 -+
6114 -+- bh = ext4_find_entry(child->d_inode, &dotdot, &de, NULL);
6115 -++ bh = ext4_find_entry(child->d_inode, &dotdot, &de, NULL, NULL);
6116 -+ if (!bh)
6117 -+ return ERR_PTR(-ENOENT);
6118 -+ ino = le32_to_cpu(de->inode);
6119 -+@@ -1567,8 +1888,9 @@ static struct ext4_dir_entry_2* dx_pack_
6120 -+ * Returns pointer to de in block into which the new entry will be inserted.
6121 -+ */
6122 -+ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
6123 -+- struct buffer_head **bh,struct dx_frame *frame,
6124 -+- struct dx_hash_info *hinfo, int *error)
6125 -++ struct buffer_head **bh, struct dx_frame *frames,
6126 -++ struct dx_frame *frame, struct dx_hash_info *hinfo,
6127 -++ struct htree_lock *lck, int *error)
6128 -+ {
6129 -+ unsigned blocksize = dir->i_sb->s_blocksize;
6130 -+ unsigned count, continued;
6131 -+@@ -1632,7 +1954,14 @@ static struct ext4_dir_entry_2 *do_split
6132 -+ hash2, split, count-split));
6133 -+
6134 -+ /* Fancy dance to stay within two buffers */
6135 -+- de2 = dx_move_dirents(data1, data2, map + split, count - split, blocksize);
6136 -++ if (hinfo->hash < hash2) {
6137 -++ de2 = dx_move_dirents(data1, data2, map + split,
6138 -++ count - split, blocksize);
6139 -++ } else {
6140 -++ /* make sure we will add entry to the same block which
6141 -++ * we have already locked */
6142 -++ de2 = dx_move_dirents(data1, data2, map, split, blocksize);
6143 -++ }
6144 -+ de = dx_pack_dirents(data1, blocksize);
6145 -+ de->rec_len = ext4_rec_len_to_disk(data1 + (blocksize - csum_size) -
6146 -+ (char *) de,
6147 -+@@ -1651,13 +1980,21 @@ static struct ext4_dir_entry_2 *do_split
6148 -+ dxtrace(dx_show_leaf (hinfo, (struct ext4_dir_entry_2 *) data1, blocksize, 1));
6149 -+ dxtrace(dx_show_leaf (hinfo, (struct ext4_dir_entry_2 *) data2, blocksize, 1));
6150 -+
6151 -+- /* Which block gets the new entry? */
6152 -+- if (hinfo->hash >= hash2)
6153 -+- {
6154 -+- swap(*bh, bh2);
6155 -+- de = de2;
6156 -++ ext4_htree_spin_lock(lck, frame > frames ? (frame - 1)->at : NULL,
6157 -++ frame->at); /* notify block is being split */
6158 -++ if (hinfo->hash < hash2) {
6159 -++ dx_insert_block(frame, hash2 + continued, newblock);
6160 -++
6161 -++ } else {
6162 -++ /* switch block number */
6163 -++ dx_insert_block(frame, hash2 + continued,
6164 -++ dx_get_block(frame->at));
6165 -++ dx_set_block(frame->at, newblock);
6166 -++ (frame->at)++;
6167 -+ }
6168 -+- dx_insert_block(frame, hash2 + continued, newblock);
6169 -++ ext4_htree_spin_unlock(lck);
6170 -++ ext4_htree_dx_unlock(lck);
6171 -++
6172 -+ err = ext4_handle_dirty_dirent_node(handle, dir, bh2);
6173 -+ if (err)
6174 -+ goto journal_error;
6175 -+@@ -1800,7 +2137,7 @@ static int add_dirent_to_buf(handle_t *h
6176 -+ if (!IS_NOCMTIME(dir))
6177 -+ dir->i_mtime = dir->i_ctime = ext4_current_time(dir);
6178 -+ ext4_update_dx_flag(dir);
6179 -+- dir->i_version++;
6180 -++ inode_inc_iversion(dir);
6181 -+ ext4_mark_inode_dirty(handle, dir);
6182 -+ BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
6183 -+ err = ext4_handle_dirty_dirent_node(handle, dir, bh);
6184 -+@@ -1820,7 +2157,7 @@ static int make_indexed_dir(handle_t *ha
6185 -+ const char *name = dentry->d_name.name;
6186 -+ int namelen = dentry->d_name.len;
6187 -+ struct buffer_head *bh2;
6188 -+- struct dx_frame frames[2], *frame;
6189 -++ struct dx_frame frames[EXT4_HTREE_LEVEL], *frame;
6190 -+ struct dx_entry *entries;
6191 -+ struct ext4_dir_entry_2 *de, *de2, *dot_de, *dotdot_de;
6192 -+ struct ext4_dir_entry_tail *t;
6193 -+@@ -1914,7 +2251,7 @@ static int make_indexed_dir(handle_t *ha
6194 -+ ext4_handle_dirty_dx_node(handle, dir, frame->bh);
6195 -+ ext4_handle_dirty_dirent_node(handle, dir, bh);
6196 -+
6197 -+- de = do_split(handle,dir, &bh, frame, &hinfo, &retval);
6198 -++ de = do_split(handle,dir, &bh, frames, frame, &hinfo, NULL, &retval);
6199 -+ if (!de) {
6200 -+ /*
6201 -+ * Even if the block split failed, we have to properly write
6202 -+@@ -2021,7 +2358,7 @@ out:
6203 -+ * the entry, as someone else might have used it while you slept.
6204 -+ */
6205 -+ int ext4_add_entry(handle_t *handle, struct dentry *dentry,
6206 -+- struct inode *inode)
6207 -++ struct inode *inode, struct htree_lock *lck)
6208 -+ {
6209 -+ struct inode *dir = dentry->d_parent->d_inode;
6210 -+ struct buffer_head *bh;
6211 -+@@ -2057,9 +2394,10 @@ int ext4_add_entry(handle_t *handle, str
6212 -+ if (dentry->d_name.len == 2 &&
6213 -+ memcmp(dentry->d_name.name, "..", 2) == 0)
6214 -+ return ext4_update_dotdot(handle, dentry, inode);
6215 -+- retval = ext4_dx_add_entry(handle, dentry, inode);
6216 -++ retval = ext4_dx_add_entry(handle, dentry, inode, lck);
6217 -+ if (!retval || (retval != ERR_BAD_DX_DIR))
6218 -+ return retval;
6219 -++ ext4_htree_safe_relock(lck);
6220 -+ ext4_clear_inode_flag(dir, EXT4_INODE_INDEX);
6221 -+ dx_fallback++;
6222 -+ ext4_mark_inode_dirty(handle, dir);
6223 -+@@ -2105,18 +2443,21 @@ EXPORT_SYMBOL(ext4_add_entry);
6224 -+ * Returns 0 for success, or a negative error value
6225 -+ */
6226 -+ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
6227 -+- struct inode *inode)
6228 -++ struct inode *inode, struct htree_lock *lck)
6229 -+ {
6230 -+- struct dx_frame frames[2], *frame;
6231 -++ struct dx_frame frames[EXT4_HTREE_LEVEL], *frame;
6232 -+ struct dx_entry *entries, *at;
6233 -+ struct dx_hash_info hinfo;
6234 -+ struct buffer_head *bh;
6235 -+ struct inode *dir = dentry->d_parent->d_inode;
6236 -+ struct super_block *sb = dir->i_sb;
6237 -+ struct ext4_dir_entry_2 *de;
6238 -++ int restart;
6239 -+ int err;
6240 -+
6241 -+- frame = dx_probe(&dentry->d_name, dir, &hinfo, frames, &err);
6242 -++again:
6243 -++ restart = 0;
6244 -++ frame = dx_probe(&dentry->d_name, dir, &hinfo, frames, lck, &err);
6245 -+ if (!frame)
6246 -+ return err;
6247 -+ entries = frame->entries;
6248 -+@@ -2128,33 +2469,53 @@ static int ext4_dx_add_entry(handle_t *h
6249 -+ goto cleanup;
6250 -+ }
6251 -+
6252 -+- BUFFER_TRACE(bh, "get_write_access");
6253 -+- err = ext4_journal_get_write_access(handle, bh);
6254 -+- if (err)
6255 -+- goto journal_error;
6256 -+-
6257 -+ err = add_dirent_to_buf(handle, dentry, inode, NULL, bh);
6258 -+ if (err != -ENOSPC)
6259 -+ goto cleanup;
6260 -+
6261 -++ err = 0;
6262 -+ /* Block full, should compress but for now just split */
6263 -+ dxtrace(printk(KERN_DEBUG "using %u of %u node entries\n",
6264 -+ dx_get_count(entries), dx_get_limit(entries)));
6265 -+ /* Need to split index? */
6266 -+ if (dx_get_count(entries) == dx_get_limit(entries)) {
6267 -+ ext4_lblk_t newblock;
6268 -+- unsigned icount = dx_get_count(entries);
6269 -+- int levels = frame - frames;
6270 -++ int levels = frame - frames + 1;
6271 -++ unsigned icount;
6272 -++ int add_level = 1;
6273 -+ struct dx_entry *entries2;
6274 -+ struct dx_node *node2;
6275 -+ struct buffer_head *bh2;
6276 -+
6277 -+- if (levels && (dx_get_count(frames->entries) ==
6278 -+- dx_get_limit(frames->entries))) {
6279 -+- ext4_warning(sb, "Directory index full!");
6280 -++ if (!ext4_htree_safe_locked(lck)) { /* retry with EX lock */
6281 -++ ext4_htree_safe_relock(lck);
6282 -++ restart = 1;
6283 -++ goto cleanup;
6284 -++ }
6285 -++ while (frame > frames) {
6286 -++ if (dx_get_count((frame - 1)->entries) <
6287 -++ dx_get_limit((frame - 1)->entries)) {
6288 -++ add_level = 0;
6289 -++ break;
6290 -++ }
6291 -++ frame--; /* split higher index block */
6292 -++ at = frame->at;
6293 -++ entries = frame->entries;
6294 -++ restart = 1;
6295 -++ }
6296 -++ if (add_level && levels == ext4_dir_htree_level(sb)) {
6297 -++ ext4_warning(sb, "Directory (ino: %lu) index full, "
6298 -++ "reach max htree level :%d",
6299 -++ dir->i_ino, levels);
6300 -++ if (ext4_dir_htree_level(sb) < EXT4_HTREE_LEVEL) {
6301 -++ ext4_warning(sb, "Large directory feature is"
6302 -++ "not enabled on this "
6303 -++ "filesystem");
6304 -++ }
6305 -+ err = -ENOSPC;
6306 -+ goto cleanup;
6307 -+ }
6308 -++ icount = dx_get_count(entries);
6309 -+ bh2 = ext4_append(handle, dir, &newblock);
6310 -+ if (IS_ERR(bh2)) {
6311 -+ err = PTR_ERR(bh2);
6312 -+@@ -2169,7 +2530,7 @@ static int ext4_dx_add_entry(handle_t *h
6313 -+ err = ext4_journal_get_write_access(handle, frame->bh);
6314 -+ if (err)
6315 -+ goto journal_error;
6316 -+- if (levels) {
6317 -++ if (!add_level) {
6318 -+ unsigned icount1 = icount/2, icount2 = icount - icount1;
6319 -+ unsigned hash2 = dx_get_hash(entries + icount1);
6320 -+ dxtrace(printk(KERN_DEBUG "Split index %i/%i\n",
6321 -+@@ -2177,7 +2538,7 @@ static int ext4_dx_add_entry(handle_t *h
6322 -+
6323 -+ BUFFER_TRACE(frame->bh, "get_write_access"); /* index root */
6324 -+ err = ext4_journal_get_write_access(handle,
6325 -+- frames[0].bh);
6326 -++ (frame - 1)->bh);
6327 -+ if (err)
6328 -+ goto journal_error;
6329 -+
6330 -+@@ -2193,18 +2554,24 @@ static int ext4_dx_add_entry(handle_t *h
6331 -+ frame->entries = entries = entries2;
6332 -+ swap(frame->bh, bh2);
6333 -+ }
6334 -+- dx_insert_block(frames + 0, hash2, newblock);
6335 -+- dxtrace(dx_show_index("node", frames[1].entries));
6336 -++ dx_insert_block((frame - 1), hash2, newblock);
6337 -++ dxtrace(dx_show_index("node", frame->entries));
6338 -+ dxtrace(dx_show_index("node",
6339 -+ ((struct dx_node *) bh2->b_data)->entries));
6340 -+ err = ext4_handle_dirty_dx_node(handle, dir, bh2);
6341 -+ if (err)
6342 -+ goto journal_error;
6343 -+ brelse (bh2);
6344 -++ ext4_handle_dirty_metadata(handle, inode,
6345 -++ (frame - 1)->bh);
6346 -++ if (restart) {
6347 -++ ext4_handle_dirty_metadata(handle, inode,
6348 -++ frame->bh);
6349 -++ goto cleanup;
6350 -++ }
6351 -+ } else {
6352 -+ struct dx_root_info * info;
6353 -+- dxtrace(printk(KERN_DEBUG
6354 -+- "Creating second level index...\n"));
6355 -++
6356 -+ memcpy((char *) entries2, (char *) entries,
6357 -+ icount * sizeof(struct dx_entry));
6358 -+ dx_set_limit(entries2, dx_node_limit(dir));
6359 -+@@ -2214,35 +2581,63 @@ static int ext4_dx_add_entry(handle_t *h
6360 -+ dx_set_block(entries + 0, newblock);
6361 -+ info = dx_get_dx_info((struct ext4_dir_entry_2*)
6362 -+ frames[0].bh->b_data);
6363 -+- info->indirect_levels = 1;
6364 -++ info->indirect_levels += 1;
6365 -++ dxtrace(printk(KERN_DEBUG
6366 -++ "Creating %d level index...\n",
6367 -++ info->indirect_levels));
6368 -++ ext4_handle_dirty_metadata(handle, inode, frame->bh);
6369 -++ ext4_handle_dirty_metadata(handle, inode, bh2);
6370 -++ brelse(bh2);
6371 -++ restart = 1;
6372 -++ goto cleanup;
6373 -++ }
6374 -++ } else if (!ext4_htree_dx_locked(lck)) {
6375 -++ struct ext4_dir_lock_data *ld = ext4_htree_lock_data(lck);
6376 -+
6377 -+- /* Add new access path frame */
6378 -+- frame = frames + 1;
6379 -+- frame->at = at = at - entries + entries2;
6380 -+- frame->entries = entries = entries2;
6381 -+- frame->bh = bh2;
6382 -+- err = ext4_journal_get_write_access(handle,
6383 -+- frame->bh);
6384 -+- if (err)
6385 -+- goto journal_error;
6386 -++ /* not well protected, require DX lock */
6387 -++ ext4_htree_dx_need_lock(lck);
6388 -++ at = frame > frames ? (frame - 1)->at : NULL;
6389 -++
6390 -++ /* NB: no risk of deadlock because it's just a try.
6391 -++ *
6392 -++ * NB: we check ld_count for twice, the first time before
6393 -++ * having DX lock, the second time after holding DX lock.
6394 -++ *
6395 -++ * NB: We never free blocks for directory so far, which
6396 -++ * means value returned by dx_get_count() should equal to
6397 -++ * ld->ld_count if nobody split any DE-block under @at,
6398 -++ * and ld->ld_at still points to valid dx_entry. */
6399 -++ if ((ld->ld_count != dx_get_count(entries)) ||
6400 -++ !ext4_htree_dx_lock_try(lck, at) ||
6401 -++ (ld->ld_count != dx_get_count(entries))) {
6402 -++ restart = 1;
6403 -++ goto cleanup;
6404 -+ }
6405 -+- err = ext4_handle_dirty_dx_node(handle, dir, frames[0].bh);
6406 -++ /* OK, I've got DX lock and nothing changed */
6407 -++ frame->at = ld->ld_at;
6408 -+ if (err) {
6409 -+ ext4_std_error(inode->i_sb, err);
6410 -+ goto cleanup;
6411 -+ }
6412 -+ }
6413 -+- de = do_split(handle, dir, &bh, frame, &hinfo, &err);
6414 -++ de = do_split(handle, dir, &bh, frames, frame, &hinfo, lck, &err);
6415 -+ if (!de)
6416 -+ goto cleanup;
6417 -++
6418 -+ err = add_dirent_to_buf(handle, dentry, inode, de, bh);
6419 -+ goto cleanup;
6420 -+
6421 -+ journal_error:
6422 -+ ext4_std_error(dir->i_sb, err);
6423 -+ cleanup:
6424 -++ ext4_htree_dx_unlock(lck);
6425 -++ ext4_htree_de_unlock(lck);
6426 -+ brelse(bh);
6427 -+ dx_release(frames);
6428 -++ /* @restart is true means htree-path has been changed, we need to
6429 -++ * repeat dx_probe() to find out valid htree-path */
6430 -++ if (restart && err == 0)
6431 -++ goto again;
6432 -+ return err;
6433 -+ }
6434 -+
6435 -+@@ -2279,7 +2674,7 @@ int ext4_generic_delete_entry(handle_t *
6436 -+ blocksize);
6437 -+ else
6438 -+ de->inode = 0;
6439 -+- dir->i_version++;
6440 -++ inode_inc_iversion(dir);
6441 -+ return 0;
6442 -+ }
6443 -+ i += ext4_rec_len_from_disk(de->rec_len, blocksize);
6444 -+@@ -2364,7 +2759,7 @@ EXPORT_SYMBOL(ext4_dec_count);
6445 -+ static int ext4_add_nondir(handle_t *handle,
6446 -+ struct dentry *dentry, struct inode *inode)
6447 -+ {
6448 -+- int err = ext4_add_entry(handle, dentry, inode);
6449 -++ int err = ext4_add_entry(handle, dentry, inode, NULL);
6450 -+ if (!err) {
6451 -+ ext4_mark_inode_dirty(handle, inode);
6452 -+ unlock_new_inode(inode);
6453 -+@@ -2670,7 +3065,7 @@ retry:
6454 -+ goto out_clear_inode;
6455 -+ err = ext4_mark_inode_dirty(handle, inode);
6456 -+ if (!err)
6457 -+- err = ext4_add_entry(handle, dentry, inode);
6458 -++ err = ext4_add_entry(handle, dentry, inode, NULL);
6459 -+ if (err) {
6460 -+ out_clear_inode:
6461 -+ clear_nlink(inode);
6462 -+@@ -2936,7 +3331,7 @@ static int ext4_rmdir(struct inode *dir,
6463 -+ dquot_initialize(dentry->d_inode);
6464 -+
6465 -+ retval = -ENOENT;
6466 -+- bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL);
6467 -++ bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL, NULL);
6468 -+ if (!bh)
6469 -+ goto end_rmdir;
6470 -+
6471 -+@@ -3003,7 +3398,7 @@ static int ext4_unlink(struct inode *dir
6472 -+ dquot_initialize(dentry->d_inode);
6473 -+
6474 -+ retval = -ENOENT;
6475 -+- bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL);
6476 -++ bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL, NULL);
6477 -+ if (!bh)
6478 -+ goto end_unlink;
6479 -+
6480 -+@@ -3182,7 +3577,7 @@ retry:
6481 -+ ext4_inc_count(handle, inode);
6482 -+ ihold(inode);
6483 -+
6484 -+- err = ext4_add_entry(handle, dentry, inode);
6485 -++ err = ext4_add_entry(handle, dentry, inode, NULL);
6486 -+ if (!err) {
6487 -+ ext4_mark_inode_dirty(handle, inode);
6488 -+ /* this can happen only for tmpfile being
6489 -+@@ -3264,7 +3659,7 @@ static int ext4_rename(struct inode *old
6490 -+ if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
6491 -+ ext4_handle_sync(handle);
6492 -+
6493 -+- old_bh = ext4_find_entry(old_dir, &old_dentry->d_name, &old_de, NULL);
6494 -++ old_bh = ext4_find_entry(old_dir, &old_dentry->d_name, &old_de, NULL, NULL);
6495 -+ /*
6496 -+ * Check for inode number is _not_ due to possible IO errors.
6497 -+ * We might rmdir the source, keep it as pwd of some process
6498 -+@@ -3278,7 +3673,7 @@ static int ext4_rename(struct inode *old
6499 -+
6500 -+ new_inode = new_dentry->d_inode;
6501 -+ new_bh = ext4_find_entry(new_dir, &new_dentry->d_name,
6502 -+- &new_de, &new_inlined);
6503 -++ &new_de, &new_inlined, NULL);
6504 -+ if (new_bh) {
6505 -+ if (!new_inode) {
6506 -+ brelse(new_bh);
6507 -+@@ -3309,7 +3704,7 @@ static int ext4_rename(struct inode *old
6508 -+ goto end_rename;
6509 -+ }
6510 -+ if (!new_bh) {
6511 -+- retval = ext4_add_entry(handle, new_dentry, old_inode);
6512 -++ retval = ext4_add_entry(handle, new_dentry, old_inode, NULL);
6513 -+ if (retval)
6514 -+ goto end_rename;
6515 -+ } else {
6516 -+@@ -3361,7 +3756,7 @@ static int ext4_rename(struct inode *old
6517 -+ struct ext4_dir_entry_2 *old_de2;
6518 -+
6519 -+ old_bh2 = ext4_find_entry(old_dir, &old_dentry->d_name,
6520 -+- &old_de2, NULL);
6521 -++ &old_de2, NULL, NULL);
6522 -+ if (old_bh2) {
6523 -+ retval = ext4_delete_entry(handle, old_dir,
6524 -+ old_de2, old_bh2);
6525 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/inode.c
6526 -+===================================================================
6527 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/inode.c
6528 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/inode.c
6529 -+@@ -4091,7 +4091,7 @@ struct inode *ext4_iget(struct super_blo
6530 -+ if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT))
6531 -+ ei->i_file_acl |=
6532 -+ ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32;
6533 -+- inode->i_size = ext4_isize(raw_inode);
6534 -++ inode->i_size = ext4_isize(sb, raw_inode);
6535 -+ ei->i_disksize = inode->i_size;
6536 -+ #ifdef CONFIG_QUOTA
6537 -+ ei->i_reserved_quota = 0;
6538 -+@@ -4329,7 +4329,7 @@ static int ext4_do_update_inode(handle_t
6539 -+ raw_inode->i_file_acl_high =
6540 -+ cpu_to_le16(ei->i_file_acl >> 32);
6541 -+ raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl);
6542 -+- if (ei->i_disksize != ext4_isize(raw_inode)) {
6543 -++ if (ei->i_disksize != ext4_isize(inode->i_sb, raw_inode)) {
6544 -+ ext4_isize_set(raw_inode, ei->i_disksize);
6545 -+ need_datasync = 1;
6546 -+ }
6547 -+Index: linux-3.11.1-200.fc19.x86_64/fs/ext4/Makefile
6548 -+===================================================================
6549 -+--- linux-3.11.1-200.fc19.x86_64.orig/fs/ext4/Makefile
6550 -++++ linux-3.11.1-200.fc19.x86_64/fs/ext4/Makefile
6551 -+@@ -8,7 +8,7 @@ ext4-y := balloc.o bitmap.o dir.o file.o
6552 -+ ioctl.o namei.o super.o symlink.o hash.o resize.o extents.o \
6553 -+ ext4_jbd2.o migrate.o mballoc.o block_validity.o move_extent.o \
6554 -+ mmp.o indirect.o extents_status.o xattr.o xattr_user.o \
6555 -+- xattr_trusted.o inline.o
6556 -++ xattr_trusted.o inline.o htree_lock.o
6557 -+
6558 -+ ext4-$(CONFIG_EXT4_FS_POSIX_ACL) += acl.o
6559 -+ ext4-$(CONFIG_EXT4_FS_SECURITY) += xattr_security.o
6560 -diff --git a/ldiskfs/kernel_patches/series/ldiskfs-3.x-fc19.series b/ldiskfs/kernel_patches/series/ldiskfs-3.x-fc19.series
6561 -new file mode 100644
6562 -index 0000000..5d0d7b0
6563 ---- /dev/null
6564 -+++ b/ldiskfs/kernel_patches/series/ldiskfs-3.x-fc19.series
6565 -@@ -0,0 +1,22 @@
6566 -+fc19/ext4-inode-version.patch
6567 -+fc19/ext4-lookup-dotdot.patch
6568 -+rhel6.3/ext4-print-inum-in-htree-warning.patch
6569 -+fc19/ext4-prealloc.patch
6570 -+fc19/ext4-mballoc-extra-checks.patch
6571 -+fc19/ext4-misc.patch
6572 -+fc19/ext4-force_over_128tb.patch
6573 -+fc19/ext4-pdir-fix.patch
6574 -+fc19/ext4-osd-iop-common.patch
6575 -+fc19/ext4-osd-iam-exports.patch
6576 -+rhel6.3/ext4-hash-indexed-dir-dotdot-update.patch
6577 -+fc19/ext4-kill-dx_root.patch
6578 -+fc19/ext4-fiemap.patch
6579 -+fc19/ext4-mballoc-pa_free-mismatch.patch
6580 -+fc19/ext4_data_in_dirent.patch
6581 -+fc19/ext4-large-eas.patch
6582 -+fc19/ext4-disable-mb-cache.patch
6583 -+fc19/ext4-nocmtime.patch
6584 -+fc19/ext4_pdirop.patch
6585 -+rhel6.3/ext4-not-discard-preallocation-umount.patch
6586 -+fc19/ext4-change-entry-avoid-conflict.patch
6587 -+fc19/ext4-max-dir-size.patch
6588 ---
6589 -1.8.5.1
6590 -
6591
6592 diff --git a/sys-cluster/lustre/files/0003-LU-3319-procfs-fix-symlink-handling.patch b/sys-cluster/lustre/files/0003-LU-3319-procfs-fix-symlink-handling.patch
6593 new file mode 100644
6594 index 0000000..8d1a0df
6595 --- /dev/null
6596 +++ b/sys-cluster/lustre/files/0003-LU-3319-procfs-fix-symlink-handling.patch
6597 @@ -0,0 +1,358 @@
6598 +From ce693d2759e274a114a668e477264d1af8181159 Mon Sep 17 00:00:00 2001
6599 +From: James Simmons <uja.ornl@×××××.com>
6600 +Date: Fri, 31 Jan 2014 11:37:53 -0500
6601 +Subject: [PATCH 03/13] LU-3319 procfs: fix symlink handling
6602 +
6603 +While working on symlink handling for seq files I noticed a
6604 +long outstanding bug. Code was developed to link osc obds
6605 +to target_obds of the lov layer. The target_obds directory
6606 +was never created for the symlinks. This patches enables
6607 +this long forgotten feature. Also addressed is the race
6608 +condition experinced with server side code ported to
6609 +seq_files that used symlinks. To avoid the race the handle
6610 +obd_proc_private was moved from struct obd_device to
6611 +struct obd_type which now allows earlier registeration that
6612 +only happens once.
6613 +
6614 +Change-Id: Ib158ec4444ed7abc0f3c3e820ee4a333631a58d1
6615 +Signed-off-by: James Simmons <uja.ornl@×××××.com>
6616 +---
6617 + lustre/include/obd.h | 17 ++++----
6618 + lustre/lmv/lmv_obd.c | 49 +++++++++--------------
6619 + lustre/lov/lov_obd.c | 100 +++++++++++++++++++++++++++--------------------
6620 + lustre/obdclass/genops.c | 3 ++
6621 + 4 files changed, 87 insertions(+), 82 deletions(-)
6622 +
6623 +diff --git a/lustre/include/obd.h b/lustre/include/obd.h
6624 +index c18052b..8fd2ce7 100644
6625 +--- a/lustre/include/obd.h
6626 ++++ b/lustre/include/obd.h
6627 +@@ -183,13 +183,15 @@ struct obd_info {
6628 + };
6629 +
6630 + struct obd_type {
6631 +- cfs_list_t typ_chain;
6632 +- struct obd_ops *typ_dt_ops;
6633 +- struct md_ops *typ_md_ops;
6634 +- cfs_proc_dir_entry_t *typ_procroot;
6635 +- char *typ_name;
6636 +- int typ_refcnt;
6637 +- struct lu_device_type *typ_lu;
6638 ++ struct list_head typ_chain;
6639 ++ struct obd_ops *typ_dt_ops;
6640 ++ struct md_ops *typ_md_ops;
6641 ++ cfs_proc_dir_entry_t *typ_procroot;
6642 ++ cfs_proc_dir_entry_t *typ_procsym;
6643 ++ __u32 typ_sym_filter;
6644 ++ char *typ_name;
6645 ++ int typ_refcnt;
6646 ++ struct lu_device_type *typ_lu;
6647 + spinlock_t obd_type_lock;
6648 + };
6649 +
6650 +@@ -825,7 +827,6 @@ struct obd_device {
6651 +
6652 + struct proc_dir_entry *obd_proc_entry;
6653 + struct proc_dir_entry *obd_proc_exports_entry;
6654 +- void *obd_proc_private; /* type private PDEs */
6655 + struct proc_dir_entry *obd_svc_procroot;
6656 + struct lprocfs_stats *obd_svc_stats;
6657 + struct lprocfs_seq_vars *obd_vars;
6658 +diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c
6659 +index e0941c9..7e1738e 100644
6660 +--- a/lustre/lmv/lmv_obd.c
6661 ++++ b/lustre/lmv/lmv_obd.c
6662 +@@ -242,9 +242,6 @@ static int lmv_connect(const struct lu_env *env,
6663 + struct obd_uuid *cluuid, struct obd_connect_data *data,
6664 + void *localdata)
6665 + {
6666 +-#ifdef __KERNEL__
6667 +- struct proc_dir_entry *lmv_proc_dir;
6668 +-#endif
6669 + struct lmv_obd *lmv = &obd->u.lmv;
6670 + struct lustre_handle conn = { 0 };
6671 + int rc = 0;
6672 +@@ -277,18 +274,15 @@ static int lmv_connect(const struct lu_env *env,
6673 + lmv->conn_data = *data;
6674 +
6675 + #ifdef __KERNEL__
6676 +- if (obd->obd_proc_private != NULL) {
6677 +- lmv_proc_dir = obd->obd_proc_private;
6678 +- } else {
6679 +- lmv_proc_dir = lprocfs_seq_register("target_obds",
6680 +- obd->obd_proc_entry,
6681 +- NULL, NULL);
6682 +- if (IS_ERR(lmv_proc_dir)) {
6683 ++ if (obd->obd_type->typ_procsym == NULL) {
6684 ++ obd->obd_type->typ_procsym = lprocfs_seq_register("target_obds",
6685 ++ obd->obd_proc_entry,
6686 ++ NULL, NULL);
6687 ++ if (IS_ERR(obd->obd_type->typ_procsym)) {
6688 + CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.",
6689 + obd->obd_type->typ_name, obd->obd_name);
6690 +- lmv_proc_dir = NULL;
6691 ++ obd->obd_type->typ_procsym = NULL;
6692 + }
6693 +- obd->obd_proc_private = lmv_proc_dir;
6694 + }
6695 + #endif
6696 +
6697 +@@ -302,9 +296,9 @@ static int lmv_connect(const struct lu_env *env,
6698 + rc = lmv_check_connect(obd);
6699 +
6700 + #ifdef __KERNEL__
6701 +- if (rc && lmv_proc_dir) {
6702 +- lprocfs_remove(&lmv_proc_dir);
6703 +- obd->obd_proc_private = NULL;
6704 ++ if (rc && obd->obd_type->typ_procsym != NULL) {
6705 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
6706 ++ obd->obd_type->typ_procsym = NULL;
6707 + }
6708 + #endif
6709 + RETURN(rc);
6710 +@@ -384,9 +378,6 @@ static int lmv_init_ea_size(struct obd_export *exp, int easize,
6711 +
6712 + int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
6713 + {
6714 +-#ifdef __KERNEL__
6715 +- struct proc_dir_entry *lmv_proc_dir;
6716 +-#endif
6717 + struct lmv_obd *lmv = &obd->u.lmv;
6718 + struct obd_uuid *cluuid = &lmv->cluuid;
6719 + struct obd_uuid lmv_mdc_uuid = { "LMV_MDC_UUID" };
6720 +@@ -466,14 +457,13 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
6721 + cfs_atomic_read(&obd->obd_refcount));
6722 +
6723 + #ifdef __KERNEL__
6724 +- lmv_proc_dir = obd->obd_proc_private;
6725 +- if (lmv_proc_dir) {
6726 ++ if (obd->obd_type->typ_procsym != NULL) {
6727 + struct proc_dir_entry *mdc_symlink;
6728 +
6729 + LASSERT(mdc_obd->obd_type != NULL);
6730 + LASSERT(mdc_obd->obd_type->typ_name != NULL);
6731 + mdc_symlink = lprocfs_add_symlink(mdc_obd->obd_name,
6732 +- lmv_proc_dir,
6733 ++ obd->obd_type->typ_procsym,
6734 + "../../../%s/%s",
6735 + mdc_obd->obd_type->typ_name,
6736 + mdc_obd->obd_name);
6737 +@@ -482,8 +472,8 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
6738 + "/proc/fs/lustre/%s/%s/target_obds/%s.",
6739 + obd->obd_type->typ_name, obd->obd_name,
6740 + mdc_obd->obd_name);
6741 +- lprocfs_remove(&lmv_proc_dir);
6742 +- obd->obd_proc_private = NULL;
6743 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
6744 ++ obd->obd_type->typ_procsym = NULL;
6745 + }
6746 + }
6747 + #endif
6748 +@@ -675,9 +665,6 @@ int lmv_check_connect(struct obd_device *obd)
6749 +
6750 + static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
6751 + {
6752 +-#ifdef __KERNEL__
6753 +- struct proc_dir_entry *lmv_proc_dir;
6754 +-#endif
6755 + struct lmv_obd *lmv = &obd->u.lmv;
6756 + struct obd_device *mdc_obd;
6757 + int rc;
6758 +@@ -695,9 +682,9 @@ static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
6759 + }
6760 +
6761 + #ifdef __KERNEL__
6762 +- lmv_proc_dir = obd->obd_proc_private;
6763 +- if (lmv_proc_dir)
6764 +- lprocfs_remove_proc_entry(mdc_obd->obd_name, lmv_proc_dir);
6765 ++ if (obd->obd_type->typ_procsym != NULL)
6766 ++ lprocfs_remove_proc_entry(mdc_obd->obd_name,
6767 ++ obd->obd_type->typ_procsym);
6768 + #endif
6769 + rc = obd_fid_fini(tgt->ltd_exp->exp_obd);
6770 + if (rc)
6771 +@@ -747,8 +734,8 @@ static int lmv_disconnect(struct obd_export *exp)
6772 + }
6773 +
6774 + #ifdef __KERNEL__
6775 +- if (obd->obd_proc_private)
6776 +- lprocfs_remove((struct proc_dir_entry **)&obd->obd_proc_private);
6777 ++ if (obd->obd_type->typ_procsym != NULL)
6778 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
6779 + else
6780 + CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n",
6781 + obd->obd_type->typ_name, obd->obd_name);
6782 +diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c
6783 +index 286cd15..b52a263 100644
6784 +--- a/lustre/lov/lov_obd.c
6785 ++++ b/lustre/lov/lov_obd.c
6786 +@@ -127,19 +127,16 @@ static int lov_notify(struct obd_device *obd, struct obd_device *watched,
6787 + int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
6788 + struct obd_connect_data *data)
6789 + {
6790 +- struct lov_obd *lov = &obd->u.lov;
6791 +- struct obd_uuid *tgt_uuid;
6792 +- struct obd_device *tgt_obd;
6793 +- static struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
6794 +- struct obd_import *imp;
6795 +-#ifdef __KERNEL__
6796 +- struct proc_dir_entry *lov_proc_dir;
6797 +-#endif
6798 +- int rc;
6799 +- ENTRY;
6800 ++ struct lov_obd *lov = &obd->u.lov;
6801 ++ struct obd_uuid *tgt_uuid;
6802 ++ struct obd_device *tgt_obd;
6803 ++ static struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
6804 ++ struct obd_import *imp;
6805 ++ int rc;
6806 ++ ENTRY;
6807 +
6808 +- if (!lov->lov_tgts[index])
6809 +- RETURN(-EINVAL);
6810 ++ if (lov->lov_tgts[index] == NULL)
6811 ++ RETURN(-EINVAL);
6812 +
6813 + tgt_uuid = &lov->lov_tgts[index]->ltd_uuid;
6814 + tgt_obd = lov->lov_tgts[index]->ltd_obd;
6815 +@@ -195,27 +192,26 @@ int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
6816 + obd_uuid2str(tgt_uuid), tgt_obd->obd_name, activate ? "":"in");
6817 +
6818 + #ifdef __KERNEL__
6819 +- lov_proc_dir = obd->obd_proc_private;
6820 +- if (lov_proc_dir) {
6821 +- struct obd_device *osc_obd = lov->lov_tgts[index]->ltd_exp->exp_obd;
6822 ++ if (obd->obd_type->typ_procsym != NULL) {
6823 ++ struct obd_device *osc_obd = lov->lov_tgts[index]->ltd_exp->exp_obd;
6824 + struct proc_dir_entry *osc_symlink;
6825 +
6826 +- LASSERT(osc_obd != NULL);
6827 +- LASSERT(osc_obd->obd_magic == OBD_DEVICE_MAGIC);
6828 +- LASSERT(osc_obd->obd_type->typ_name != NULL);
6829 +-
6830 +- osc_symlink = lprocfs_add_symlink(osc_obd->obd_name,
6831 +- lov_proc_dir,
6832 +- "../../../%s/%s",
6833 +- osc_obd->obd_type->typ_name,
6834 +- osc_obd->obd_name);
6835 +- if (osc_symlink == NULL) {
6836 +- CERROR("could not register LOV target "
6837 +- "/proc/fs/lustre/%s/%s/target_obds/%s.",
6838 +- obd->obd_type->typ_name, obd->obd_name,
6839 +- osc_obd->obd_name);
6840 +- lprocfs_remove(&lov_proc_dir);
6841 +- obd->obd_proc_private = NULL;
6842 ++ LASSERT(osc_obd != NULL);
6843 ++ LASSERT(osc_obd->obd_magic == OBD_DEVICE_MAGIC);
6844 ++ LASSERT(osc_obd->obd_type->typ_name != NULL);
6845 ++
6846 ++ osc_symlink = lprocfs_add_symlink(osc_obd->obd_name,
6847 ++ obd->obd_type->typ_procsym,
6848 ++ "../../../%s/%s",
6849 ++ osc_obd->obd_type->typ_name,
6850 ++ osc_obd->obd_name);
6851 ++ if (osc_symlink == NULL) {
6852 ++ CERROR("could not register LOV target "
6853 ++ "/proc/fs/lustre/%s/%s/target_obds/%s.",
6854 ++ obd->obd_type->typ_name, obd->obd_name,
6855 ++ osc_obd->obd_name);
6856 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
6857 ++ obd->obd_type->typ_procsym = NULL;
6858 + }
6859 + }
6860 + #endif
6861 +@@ -250,6 +246,17 @@ static int lov_connect(const struct lu_env *env,
6862 + if (data)
6863 + lov->lov_ocd = *data;
6864 +
6865 ++#ifdef __KERNEL__
6866 ++ obd->obd_type->typ_procsym = lprocfs_seq_register("target_obds",
6867 ++ obd->obd_proc_entry,
6868 ++ NULL, NULL);
6869 ++ if (IS_ERR(obd->obd_type->typ_procsym)) {
6870 ++ CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.",
6871 ++ obd->obd_type->typ_name, obd->obd_name);
6872 ++ obd->obd_type->typ_procsym = NULL;
6873 ++ }
6874 ++#endif
6875 ++
6876 + obd_getref(obd);
6877 + for (i = 0; i < lov->desc.ld_tgt_count; i++) {
6878 + tgt = lov->lov_tgts[i];
6879 +@@ -280,7 +287,6 @@ static int lov_connect(const struct lu_env *env,
6880 +
6881 + static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
6882 + {
6883 +- struct proc_dir_entry *lov_proc_dir;
6884 + struct lov_obd *lov = &obd->u.lov;
6885 + struct obd_device *osc_obd;
6886 + int rc;
6887 +@@ -296,18 +302,18 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
6888 + tgt->ltd_exp->exp_obd->obd_inactive = 1;
6889 + }
6890 +
6891 +- lov_proc_dir = obd->obd_proc_private;
6892 +- if (lov_proc_dir)
6893 +- lprocfs_remove_proc_entry(osc_obd->obd_name, lov_proc_dir);
6894 ++ if (obd->obd_type->typ_procsym)
6895 ++ lprocfs_remove_proc_entry(osc_obd->obd_name,
6896 ++ obd->obd_type->typ_procsym);
6897 +
6898 +- if (osc_obd) {
6899 +- /* Pass it on to our clients.
6900 +- * XXX This should be an argument to disconnect,
6901 +- * XXX not a back-door flag on the OBD. Ah well.
6902 +- */
6903 +- osc_obd->obd_force = obd->obd_force;
6904 +- osc_obd->obd_fail = obd->obd_fail;
6905 +- osc_obd->obd_no_recov = obd->obd_no_recov;
6906 ++ if (osc_obd) {
6907 ++ /* Pass it on to our clients.
6908 ++ * XXX This should be an argument to disconnect,
6909 ++ * XXX not a back-door flag on the OBD. Ah well.
6910 ++ */
6911 ++ osc_obd->obd_force = obd->obd_force;
6912 ++ osc_obd->obd_fail = obd->obd_fail;
6913 ++ osc_obd->obd_no_recov = obd->obd_no_recov;
6914 + }
6915 +
6916 + obd_register_observer(osc_obd, NULL);
6917 +@@ -353,6 +359,14 @@ static int lov_disconnect(struct obd_export *exp)
6918 + }
6919 + obd_putref(obd);
6920 +
6921 ++#ifdef __KERNEL__
6922 ++ if (obd->obd_type->typ_procsym)
6923 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
6924 ++ else
6925 ++ CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n",
6926 ++ obd->obd_type->typ_name, obd->obd_name);
6927 ++#endif
6928 ++
6929 + out:
6930 + rc = class_disconnect(exp); /* bz 9811 */
6931 + RETURN(rc);
6932 +diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c
6933 +index c9d8a4e..b9606bb 100644
6934 +--- a/lustre/obdclass/genops.c
6935 ++++ b/lustre/obdclass/genops.c
6936 +@@ -220,6 +220,7 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
6937 + type->typ_procroot = NULL;
6938 + GOTO (failed, rc);
6939 + }
6940 ++ type->typ_procsym = NULL;
6941 + #endif
6942 + if (ldt != NULL) {
6943 + type->typ_lu = ldt;
6944 +@@ -242,6 +243,8 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
6945 + if (type->typ_dt_ops != NULL)
6946 + OBD_FREE_PTR(type->typ_dt_ops);
6947 + #ifdef LPROCFS
6948 ++ if (type->typ_procsym != NULL)
6949 ++ lprocfs_remove(&type->typ_procsym);
6950 + #ifndef HAVE_ONLY_PROCFS_SEQ
6951 + lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root);
6952 + #else
6953 +--
6954 +1.8.5.3
6955 +
6956
6957 diff --git a/sys-cluster/lustre/files/0003-LU-3974-llite-dentry-d_compare-changes-in-3.11.patch b/sys-cluster/lustre/files/0003-LU-3974-llite-dentry-d_compare-changes-in-3.11.patch
6958 deleted file mode 100644
6959 index 6873a22..0000000
6960 --- a/sys-cluster/lustre/files/0003-LU-3974-llite-dentry-d_compare-changes-in-3.11.patch
6961 +++ /dev/null
6962 @@ -1,132 +0,0 @@
6963 -From 18cfd561fae3b2eac663b51f8e5147b59c711af7 Mon Sep 17 00:00:00 2001
6964 -From: James Simmons <uja.ornl@×××××.com>
6965 -Date: Wed, 11 Dec 2013 10:29:41 -0500
6966 -Subject: [PATCH 03/18] LU-3974 llite: dentry d_compare changes in 3.11
6967 -
6968 -In the linux 3.11 kernel the d_compare function has
6969 -removed passing in any struct inode arguments. This
6970 -patch provides support to handle this case.
6971 -
6972 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
6973 -Change-Id: I363057e4d0a119ad43a9907ec26e7e0079f7c305
6974 ----
6975 - lustre/autoconf/lustre-core.m4 | 19 +++++++++++++++++++
6976 - lustre/llite/dcache.c | 27 +++++++++++----------------
6977 - lustre/llite/llite_internal.h | 7 -------
6978 - 3 files changed, 30 insertions(+), 23 deletions(-)
6979 -
6980 -diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
6981 -index f47bc5f..7f9bb45 100644
6982 ---- a/lustre/autoconf/lustre-core.m4
6983 -+++ b/lustre/autoconf/lustre-core.m4
6984 -@@ -1287,6 +1287,24 @@ LB_LINUX_TRY_COMPILE([
6985 - ])
6986 -
6987 - #
6988 -+# 3.11 dentry_operations.d_compare() taken 5 arguments.
6989 -+#
6990 -+AC_DEFUN([LC_D_COMPARE_5ARGS],
6991 -+[AC_MSG_CHECKING([if d_compare taken 5 arguments])
6992 -+LB_LINUX_TRY_COMPILE([
6993 -+ #include <linux/dcache.h>
6994 -+],[
6995 -+ ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
6996 -+],[
6997 -+ AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
6998 -+ [d_compare need 5 arguments])
6999 -+ AC_MSG_RESULT([yes])
7000 -+],[
7001 -+ AC_MSG_RESULT([no])
7002 -+])
7003 -+])
7004 -+
7005 -+#
7006 - # 3.11 need to access d_count to get dentry reference count
7007 - #
7008 - AC_DEFUN([LC_HAVE_DCOUNT],
7009 -@@ -1405,6 +1423,7 @@ AC_DEFUN([LC_PROG_LINUX],
7010 - LC_BLKDEV_RELEASE_RETURN_INT
7011 -
7012 - # 3.11
7013 -+ LC_D_COMPARE_5ARGS
7014 - LC_HAVE_DCOUNT
7015 -
7016 - #
7017 -diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c
7018 -index 6fca4cb..8a8c100 100644
7019 ---- a/lustre/llite/dcache.c
7020 -+++ b/lustre/llite/dcache.c
7021 -@@ -89,11 +89,19 @@ static void ll_release(struct dentry *de)
7022 - int ll_dcompare(const struct dentry *parent, const struct inode *pinode,
7023 - const struct dentry *dentry, const struct inode *inode,
7024 - unsigned int len, const char *str, const struct qstr *name)
7025 -+#elif defined(HAVE_D_COMPARE_5ARGS)
7026 -+int ll_dcompare(const struct dentry *parent, const struct dentry *dentry,
7027 -+ unsigned int len, const char *str, const struct qstr *name)
7028 - #else
7029 - int ll_dcompare(struct dentry *parent, struct qstr *d_name, struct qstr *name)
7030 - #endif
7031 - {
7032 --#ifdef HAVE_D_COMPARE_7ARGS
7033 -+#if !defined(HAVE_D_COMPARE_7ARGS) && !defined(HAVE_D_COMPARE_5ARGS)
7034 -+ /* XXX: (ugh !) d_name must be in-dentry structure */
7035 -+ struct dentry *dentry = container_of(d_name, struct dentry, d_name);
7036 -+ unsigned int len = d_name->len;
7037 -+ const char *str = d_name->name;
7038 -+#endif
7039 - ENTRY;
7040 -
7041 - if (len != name->len)
7042 -@@ -101,19 +109,6 @@ int ll_dcompare(struct dentry *parent, struct qstr *d_name, struct qstr *name)
7043 -
7044 - if (memcmp(str, name->name, len))
7045 - RETURN(1);
7046 --#else
7047 -- struct dentry *dentry;
7048 -- ENTRY;
7049 --
7050 -- if (d_name->len != name->len)
7051 -- RETURN(1);
7052 --
7053 -- if (memcmp(d_name->name, name->name, name->len))
7054 -- RETURN(1);
7055 --
7056 -- /* XXX: d_name must be in-dentry structure */
7057 -- dentry = container_of(d_name, struct dentry, d_name); /* ugh */
7058 --#endif
7059 -
7060 - CDEBUG(D_DENTRY, "found name %.*s(%p) flags %#x refc %d\n",
7061 - name->len, name->name, dentry, dentry->d_flags,
7062 -@@ -124,9 +119,9 @@ int ll_dcompare(struct dentry *parent, struct qstr *d_name, struct qstr *name)
7063 - RETURN(0);
7064 -
7065 - if (d_lustre_invalid(dentry))
7066 -- RETURN(1);
7067 -+ RETURN(1);
7068 -
7069 -- RETURN(0);
7070 -+ RETURN(0);
7071 - }
7072 -
7073 - static inline int return_if_equal(struct ldlm_lock *lock, void *data)
7074 -diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
7075 -index daeac51..9da81ca 100644
7076 ---- a/lustre/llite/llite_internal.h
7077 -+++ b/lustre/llite/llite_internal.h
7078 -@@ -857,13 +857,6 @@ void ll_intent_release(struct lookup_intent *);
7079 - void ll_invalidate_aliases(struct inode *);
7080 - void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft);
7081 - void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry);
7082 --#ifdef HAVE_D_COMPARE_7ARGS
7083 --int ll_dcompare(const struct dentry *parent, const struct inode *pinode,
7084 -- const struct dentry *dentry, const struct inode *inode,
7085 -- unsigned int len, const char *str, const struct qstr *d_name);
7086 --#else
7087 --int ll_dcompare(struct dentry *parent, struct qstr *d_name, struct qstr *name);
7088 --#endif
7089 - int ll_revalidate_it_finish(struct ptlrpc_request *request,
7090 - struct lookup_intent *it, struct dentry *de);
7091 -
7092 ---
7093 -1.8.5.1
7094 -
7095
7096 diff --git a/sys-cluster/lustre/files/0012-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
7097 similarity index 89%
7098 rename from sys-cluster/lustre/files/0012-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch
7099 rename to sys-cluster/lustre/files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch
7100 index bc0b223..dd5e377 100644
7101 --- a/sys-cluster/lustre/files/0012-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch
7102 +++ b/sys-cluster/lustre/files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch
7103 @@ -1,7 +1,7 @@
7104 -From fa5fde4522b64dfc2e5695d88dca0ae99910cb1f Mon Sep 17 00:00:00 2001
7105 +From 223f07785cbb8d28ef563bfba382b101a064a928 Mon Sep 17 00:00:00 2001
7106 From: James Simmons <uja.ornl@×××××.com>
7107 -Date: Tue, 17 Dec 2013 12:24:40 -0500
7108 -Subject: [PATCH 12/18] LU-3319 procfs: move mgs proc handling to seq_files
7109 +Date: Fri, 3 Jan 2014 09:58:53 -0500
7110 +Subject: [PATCH 04/13] LU-3319 procfs: move mgs proc handling to seq_files
7111
7112 With 3.10 linux kernel and above proc handling now only
7113 uses struct seq_files. This patch migrates the mgs
7114 @@ -10,17 +10,17 @@ layer proc entries over to using seq_files.
7115 Signed-off-by: James Simmons <uja.ornl@×××××.com>
7116 Change-Id: I1a12dd9b1fc8f139116a8f3a684956a5ba88f055
7117 ---
7118 - lustre/mgs/lproc_mgs.c | 197 ++++++++++++++++++++++------------------------
7119 + lustre/mgs/lproc_mgs.c | 202 +++++++++++++++++++++++-----------------------
7120 lustre/mgs/mgs_handler.c | 5 +-
7121 lustre/mgs/mgs_internal.h | 13 +--
7122 lustre/mgs/mgs_nids.c | 11 ++-
7123 - 4 files changed, 105 insertions(+), 121 deletions(-)
7124 + 4 files changed, 110 insertions(+), 121 deletions(-)
7125
7126 diff --git a/lustre/mgs/lproc_mgs.c b/lustre/mgs/lproc_mgs.c
7127 -index ffa2d0d..746d1c1 100644
7128 +index ffa2d0d..f0ea956 100644
7129 --- a/lustre/mgs/lproc_mgs.c
7130 +++ b/lustre/mgs/lproc_mgs.c
7131 -@@ -126,19 +126,105 @@ static int mgsself_srpc_seq_show(struct seq_file *seq, void *v)
7132 +@@ -126,19 +126,110 @@ static int mgsself_srpc_seq_show(struct seq_file *seq, void *v)
7133
7134 return 0;
7135 }
7136 @@ -107,11 +107,16 @@ index ffa2d0d..746d1c1 100644
7137 +LPROC_SEQ_FOPS_RW_TYPE(mgs, ir_timeout);
7138 +
7139 +struct lprocfs_seq_vars lprocfs_mgs_obd_vars[] = {
7140 -+ { "uuid", &mgs_uuid_fops },
7141 -+ { "num_exports", &mgs_num_exports_fops },
7142 -+ { "hash_stats", &mgs_hash_fops },
7143 -+ { "evict_client", &mgs_evict_client_fops },
7144 -+ { "ir_timeout", &mgs_ir_timeout_fops },
7145 ++ { .name = "uuid",
7146 ++ .fops = &mgs_uuid_fops },
7147 ++ { .name = "num_exports",
7148 ++ .fops = &mgs_num_exports_fops },
7149 ++ { .name = "hash_stats",
7150 ++ .fops = &mgs_hash_fops },
7151 ++ { .name = "evict_client",
7152 ++ .fops = &mgs_evict_client_fops },
7153 ++ { .name = "ir_timeout",
7154 ++ .fops = &mgs_ir_timeout_fops },
7155 + { 0 }
7156 +};
7157 +
7158 @@ -130,7 +135,7 @@ index ffa2d0d..746d1c1 100644
7159 if (rc != 0)
7160 GOTO(out, rc);
7161
7162 -@@ -152,17 +238,17 @@ int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name)
7163 +@@ -152,17 +243,17 @@ int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name)
7164 if (rc != 0)
7165 GOTO(out, rc);
7166
7167 @@ -153,7 +158,7 @@ index ffa2d0d..746d1c1 100644
7168 if (IS_ERR(obd->obd_proc_exports_entry)) {
7169 rc = PTR_ERR(obd->obd_proc_exports_entry);
7170 obd->obd_proc_exports_entry = NULL;
7171 -@@ -215,7 +301,6 @@ void lproc_mgs_cleanup(struct mgs_device *mgs)
7172 +@@ -215,7 +306,6 @@ void lproc_mgs_cleanup(struct mgs_device *mgs)
7173
7174 if (mgs->mgs_proc_live != NULL) {
7175 /* Should be no live entries */
7176 @@ -161,7 +166,7 @@ index ffa2d0d..746d1c1 100644
7177 lprocfs_remove(&mgs->mgs_proc_live);
7178 mgs->mgs_proc_live = NULL;
7179 }
7180 -@@ -226,92 +311,6 @@ void lproc_mgs_cleanup(struct mgs_device *mgs)
7181 +@@ -226,92 +316,6 @@ void lproc_mgs_cleanup(struct mgs_device *mgs)
7182 lprocfs_free_md_stats(obd);
7183 }
7184
7185 @@ -254,7 +259,7 @@ index ffa2d0d..746d1c1 100644
7186 void mgs_counter_incr(struct obd_export *exp, int opcode)
7187 {
7188 lprocfs_counter_incr(exp->exp_obd->obd_stats, opcode);
7189 -@@ -329,10 +328,4 @@ void mgs_stats_counter_init(struct lprocfs_stats *stats)
7190 +@@ -329,10 +333,4 @@ void mgs_stats_counter_init(struct lprocfs_stats *stats)
7191 lprocfs_counter_init(stats, LPROC_MGS_TARGET_REG, 0, "tgtreg", "reqs");
7192 lprocfs_counter_init(stats, LPROC_MGS_TARGET_DEL, 0, "tgtdel", "reqs");
7193 }
7194 @@ -266,10 +271,10 @@ index ffa2d0d..746d1c1 100644
7195 -}
7196 #endif
7197 diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c
7198 -index 560dd19..a294237 100644
7199 +index 5be9040..4bb842c 100644
7200 --- a/lustre/mgs/mgs_handler.c
7201 +++ b/lustre/mgs/mgs_handler.c
7202 -@@ -1376,12 +1376,9 @@ static struct obd_ops mgs_obd_device_ops = {
7203 +@@ -1434,12 +1434,9 @@ static struct obd_ops mgs_obd_device_ops = {
7204
7205 static int __init mgs_init(void)
7206 {
7207 @@ -284,10 +289,10 @@ index 560dd19..a294237 100644
7208 LUSTRE_MGS_NAME, &mgs_device_type);
7209 }
7210 diff --git a/lustre/mgs/mgs_internal.h b/lustre/mgs/mgs_internal.h
7211 -index 514dc23..497ad9d 100644
7212 +index ca2846e..d3baacd 100644
7213 --- a/lustre/mgs/mgs_internal.h
7214 +++ b/lustre/mgs/mgs_internal.h
7215 -@@ -225,10 +225,10 @@ int mgs_get_ir_logs(struct ptlrpc_request *req);
7216 +@@ -229,10 +229,10 @@ int mgs_get_ir_logs(struct ptlrpc_request *req);
7217 int lprocfs_wr_ir_state(struct file *file, const char *buffer,
7218 unsigned long count, void *data);
7219 int lprocfs_rd_ir_state(struct seq_file *seq, void *data);
7220 @@ -302,7 +307,7 @@ index 514dc23..497ad9d 100644
7221 void mgs_fsc_cleanup(struct obd_export *exp);
7222 void mgs_fsc_cleanup_by_fsdb(struct fs_db *fsdb);
7223 int mgs_fsc_attach(const struct lu_env *env, struct obd_export *exp,
7224 -@@ -246,7 +246,6 @@ int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name);
7225 +@@ -250,7 +250,6 @@ int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name);
7226 void lproc_mgs_cleanup(struct mgs_device *mgs);
7227 int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb);
7228 int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb);
7229 @@ -310,7 +315,7 @@ index 514dc23..497ad9d 100644
7230 #else
7231 static inline int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name)
7232 {return 0;}
7233 -@@ -256,10 +255,6 @@ static inline int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb)
7234 +@@ -260,10 +259,6 @@ static inline int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb)
7235 {return 0;}
7236 static inline int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb)
7237 {return 0;}
7238 @@ -322,7 +327,7 @@ index 514dc23..497ad9d 100644
7239
7240 /* mgs/lproc_mgs.c */
7241 diff --git a/lustre/mgs/mgs_nids.c b/lustre/mgs/mgs_nids.c
7242 -index 4d53969..73a4576 100644
7243 +index a2bae59..3248387 100644
7244 --- a/lustre/mgs/mgs_nids.c
7245 +++ b/lustre/mgs/mgs_nids.c
7246 @@ -838,15 +838,14 @@ int lprocfs_rd_ir_state(struct seq_file *seq, void *data)
7247 @@ -347,5 +352,5 @@ index 4d53969..73a4576 100644
7248 return lprocfs_wr_uint(file, buffer, count, &ir_timeout);
7249 }
7250 --
7251 -1.8.5.1
7252 +1.8.5.3
7253
7254
7255 diff --git a/sys-cluster/lustre/files/0004-LU-3974-llite-use-new-struct-dir_context.patch b/sys-cluster/lustre/files/0004-LU-3974-llite-use-new-struct-dir_context.patch
7256 deleted file mode 100644
7257 index f79a30e..0000000
7258 --- a/sys-cluster/lustre/files/0004-LU-3974-llite-use-new-struct-dir_context.patch
7259 +++ /dev/null
7260 @@ -1,276 +0,0 @@
7261 -From 82f692de87cb6c7db8f050b3201d23f4852a404c Mon Sep 17 00:00:00 2001
7262 -From: James Simmons <uja.ornl@×××××.com>
7263 -Date: Mon, 2 Dec 2013 12:05:14 -0500
7264 -Subject: [PATCH 04/18] LU-3974 llite: use new struct dir_context
7265 -
7266 -The readdir and nfs code over time has added more
7267 -parameters to be passed to be processed. For the 3.11
7268 -kernel a new struct dir_context was introduced to
7269 -minimize the impact of future expansion. This patch
7270 -addresses this change.
7271 -
7272 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
7273 -Change-Id: Ib42bf8cb06635a2a64e63b294d79e66ac82a1a5b
7274 ----
7275 - lustre/autoconf/lustre-core.m4 | 20 ++++++++++
7276 - lustre/llite/dir.c | 86 +++++++++++++++++++++++++++++-------------
7277 - lustre/llite/llite_internal.h | 7 ++++
7278 - lustre/llite/llite_nfs.c | 33 ++++++++++------
7279 - 4 files changed, 107 insertions(+), 39 deletions(-)
7280 -
7281 -diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
7282 -index 7f9bb45..3ac55d6 100644
7283 ---- a/lustre/autoconf/lustre-core.m4
7284 -+++ b/lustre/autoconf/lustre-core.m4
7285 -@@ -1287,6 +1287,25 @@ LB_LINUX_TRY_COMPILE([
7286 - ])
7287 -
7288 - #
7289 -+# 3.11 readdir now takes the new struct dir_context
7290 -+#
7291 -+AC_DEFUN([LC_HAVE_DIR_CONTEXT],
7292 -+[AC_MSG_CHECKING([if dir_context exist])
7293 -+LB_LINUX_TRY_COMPILE([
7294 -+ #include <linux/fs.h>
7295 -+],[
7296 -+ struct dir_context ctx;
7297 -+
7298 -+ ctx.pos = 0;
7299 -+],[
7300 -+ AC_DEFINE(HAVE_DIR_CONTEXT, 1, [dir_context exist])
7301 -+ AC_MSG_RESULT([yes])
7302 -+],[
7303 -+ AC_MSG_RESULT([no])
7304 -+])
7305 -+])
7306 -+
7307 -+#
7308 - # 3.11 dentry_operations.d_compare() taken 5 arguments.
7309 - #
7310 - AC_DEFUN([LC_D_COMPARE_5ARGS],
7311 -@@ -1423,6 +1442,7 @@ AC_DEFUN([LC_PROG_LINUX],
7312 - LC_BLKDEV_RELEASE_RETURN_INT
7313 -
7314 - # 3.11
7315 -+ LC_HAVE_DIR_CONTEXT
7316 - LC_D_COMPARE_5ARGS
7317 - LC_HAVE_DCOUNT
7318 -
7319 -diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c
7320 -index 2021897..e2546cc 100644
7321 ---- a/lustre/llite/dir.c
7322 -+++ b/lustre/llite/dir.c
7323 -@@ -477,19 +477,25 @@ fail:
7324 - goto out_unlock;
7325 - }
7326 -
7327 -+#ifdef HAVE_DIR_CONTEXT
7328 -+int ll_dir_read(struct inode *inode, struct dir_context *ctx)
7329 -+{
7330 -+ __u64 pos = ctx->pos;
7331 -+#else
7332 - int ll_dir_read(struct inode *inode, __u64 *_pos, void *cookie,
7333 - filldir_t filldir)
7334 - {
7335 -- struct ll_inode_info *info = ll_i2info(inode);
7336 -- struct ll_sb_info *sbi = ll_i2sbi(inode);
7337 -- __u64 pos = *_pos;
7338 -- int api32 = ll_need_32bit_api(sbi);
7339 -- int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH;
7340 -- struct page *page;
7341 -- struct ll_dir_chain chain;
7342 -- int done = 0;
7343 -- int rc = 0;
7344 -- ENTRY;
7345 -+ __u64 pos = *_pos;
7346 -+#endif
7347 -+ struct ll_inode_info *info = ll_i2info(inode);
7348 -+ struct ll_sb_info *sbi = ll_i2sbi(inode);
7349 -+ int api32 = ll_need_32bit_api(sbi);
7350 -+ int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH;
7351 -+ struct page *page;
7352 -+ struct ll_dir_chain chain;
7353 -+ int done = 0;
7354 -+ int rc = 0;
7355 -+ ENTRY;
7356 -
7357 - ll_dir_chain_init(&chain);
7358 -
7359 -@@ -542,12 +548,18 @@ int ll_dir_read(struct inode *inode, __u64 *_pos, void *cookie,
7360 - fid_le_to_cpu(&fid, &ent->lde_fid);
7361 - ino = cl_fid_build_ino(&fid, api32);
7362 - type = ll_dirent_type_get(ent);
7363 -- /* For 'll_nfs_get_name_filldir()', it will try
7364 -- * to access the 'ent' through its 'lde_name',
7365 -- * so the parameter 'name' for 'filldir()' must
7366 -- * be part of the 'ent'. */
7367 -- done = filldir(cookie, ent->lde_name, namelen,
7368 -- lhash, ino, type);
7369 -+#ifdef HAVE_DIR_CONTEXT
7370 -+ ctx->pos = lhash;
7371 -+ /* For 'll_nfs_get_name_filldir()', it will try
7372 -+ * to access the 'ent' through its 'lde_name',
7373 -+ * so the parameter 'name' for 'filldir()' must
7374 -+ * be part of the 'ent'. */
7375 -+ done = !dir_emit(ctx, ent->lde_name,
7376 -+ namelen, ino, type);
7377 -+#else
7378 -+ done = filldir(cookie, ent->lde_name, namelen,
7379 -+ lhash, ino, type);
7380 -+#endif
7381 - }
7382 - next = le64_to_cpu(dp->ldp_hash_end);
7383 - if (!done) {
7384 -@@ -588,12 +600,20 @@ int ll_dir_read(struct inode *inode, __u64 *_pos, void *cookie,
7385 - }
7386 - }
7387 -
7388 -+#ifdef HAVE_DIR_CONTEXT
7389 -+ ctx->pos = pos;
7390 -+#else
7391 - *_pos = pos;
7392 -+#endif
7393 - ll_dir_chain_fini(&chain);
7394 - RETURN(rc);
7395 - }
7396 -
7397 -+#ifdef HAVE_DIR_CONTEXT
7398 -+static int ll_iterate(struct file *filp, struct dir_context *ctx)
7399 -+#else
7400 - static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
7401 -+#endif
7402 - {
7403 - struct inode *inode = filp->f_dentry->d_inode;
7404 - struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp);
7405 -@@ -622,20 +642,28 @@ static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
7406 - */
7407 - GOTO(out, rc = 0);
7408 -
7409 -+#ifdef HAVE_DIR_CONTEXT
7410 -+ ctx->pos = pos;
7411 -+ rc = ll_dir_read(inode, ctx);
7412 -+ pos = ctx->pos;
7413 -+#else
7414 - rc = ll_dir_read(inode, &pos, cookie, filldir);
7415 -+#endif
7416 - if (lfd != NULL)
7417 - lfd->lfd_pos = pos;
7418 -- if (pos == MDS_DIR_END_OFF) {
7419 -- if (api32)
7420 -- filp->f_pos = LL_DIR_END_OFF_32BIT;
7421 -- else
7422 -- filp->f_pos = LL_DIR_END_OFF;
7423 -- } else {
7424 -- if (api32 && hash64)
7425 -- filp->f_pos = pos >> 32;
7426 -- else
7427 -- filp->f_pos = pos;
7428 -+ if (pos == MDS_DIR_END_OFF) {
7429 -+ if (api32)
7430 -+ pos = LL_DIR_END_OFF_32BIT;
7431 -+ else
7432 -+ pos = LL_DIR_END_OFF;
7433 -+ } else if (api32 && hash64) {
7434 -+ pos >>= 32;
7435 - }
7436 -+#ifdef HAVE_DIR_CONTEXT
7437 -+ ctx->pos = pos;
7438 -+#else
7439 -+ filp->f_pos = pos;
7440 -+#endif
7441 - filp->f_version = inode->i_version;
7442 - #ifdef HAVE_TOUCH_ATIME_1ARG
7443 - #ifdef HAVE_F_PATH_MNT
7444 -@@ -2020,7 +2048,11 @@ struct file_operations ll_dir_operations = {
7445 - .open = ll_dir_open,
7446 - .release = ll_dir_release,
7447 - .read = generic_read_dir,
7448 -- .readdir = ll_readdir,
7449 -+#ifdef HAVE_DIR_CONTEXT
7450 -+ .iterate = ll_iterate,
7451 -+#else
7452 -+ .readdir = ll_readdir,
7453 -+#endif
7454 - .unlocked_ioctl = ll_dir_ioctl,
7455 - .fsync = ll_fsync,
7456 - };
7457 -diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
7458 -index 9da81ca..283e106 100644
7459 ---- a/lustre/llite/llite_internal.h
7460 -+++ b/lustre/llite/llite_internal.h
7461 -@@ -91,6 +91,9 @@ extern struct file_operations ll_pgcache_seq_fops;
7462 - #define REMOTE_PERM_HASHSIZE 16
7463 -
7464 - struct ll_getname_data {
7465 -+#ifdef HAVE_DIR_CONTEXT
7466 -+ struct dir_context ctx;
7467 -+#endif
7468 - char *lgd_name; /* points to a buffer with NAME_MAX+1 size */
7469 - struct lu_fid lgd_fid; /* target fid we are looking for */
7470 - int lgd_found; /* inode matched? */
7471 -@@ -722,8 +725,12 @@ extern struct file_operations ll_dir_operations;
7472 - extern struct inode_operations ll_dir_inode_operations;
7473 - struct page *ll_get_dir_page(struct inode *dir, __u64 hash,
7474 - struct ll_dir_chain *chain);
7475 -+#ifdef HAVE_DIR_CONTEXT
7476 -+int ll_dir_read(struct inode *inode, struct dir_context *ctx);
7477 -+#else
7478 - int ll_dir_read(struct inode *inode, __u64 *_pos, void *cookie,
7479 - filldir_t filldir);
7480 -+#endif
7481 -
7482 - int ll_get_mdt_idx(struct inode *inode);
7483 - /* llite/namei.c */
7484 -diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c
7485 -index 2926caf..25b16e8 100644
7486 ---- a/lustre/llite/llite_nfs.c
7487 -+++ b/lustre/llite/llite_nfs.c
7488 -@@ -235,24 +235,33 @@ static int ll_nfs_get_name_filldir(void *cookie, const char *name, int namelen,
7489 - static int ll_get_name(struct dentry *dentry, char *name,
7490 - struct dentry *child)
7491 - {
7492 -- struct inode *dir = dentry->d_inode;
7493 -- struct ll_getname_data lgd;
7494 -+ struct inode *dir = dentry->d_inode;
7495 -+ struct ll_getname_data lgd = {
7496 -+ .lgd_name = name,
7497 -+ .lgd_fid = ll_i2info(child->d_inode)->lli_fid,
7498 -+#ifdef HAVE_DIR_CONTEXT
7499 -+ .ctx.actor = ll_nfs_get_name_filldir,
7500 -+ };
7501 -+#else
7502 -+ .lgd_found = 0,
7503 -+ };
7504 - __u64 offset = 0;
7505 -- int rc;
7506 -- ENTRY;
7507 --
7508 -- if (!dir || !S_ISDIR(dir->i_mode))
7509 -- GOTO(out, rc = -ENOTDIR);
7510 -+#endif
7511 -+ int rc;
7512 -+ ENTRY;
7513 -
7514 -- if (!dir->i_fop)
7515 -- GOTO(out, rc = -EINVAL);
7516 -+ if (!dir || !S_ISDIR(dir->i_mode))
7517 -+ GOTO(out, rc = -ENOTDIR);
7518 -
7519 -- lgd.lgd_name = name;
7520 -- lgd.lgd_fid = ll_i2info(child->d_inode)->lli_fid;
7521 -- lgd.lgd_found = 0;
7522 -+ if (!dir->i_fop)
7523 -+ GOTO(out, rc = -EINVAL);
7524 -
7525 - mutex_lock(&dir->i_mutex);
7526 -+#ifdef HAVE_DIR_CONTEXT
7527 -+ rc = ll_dir_read(dir, &lgd.ctx);
7528 -+#else
7529 - rc = ll_dir_read(dir, &offset, &lgd, ll_nfs_get_name_filldir);
7530 -+#endif
7531 - mutex_unlock(&dir->i_mutex);
7532 - if (!rc && !lgd.lgd_found)
7533 - rc = -ENOENT;
7534 ---
7535 -1.8.5.1
7536 -
7537
7538 diff --git a/sys-cluster/lustre/files/0011-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0005-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
7539 similarity index 70%
7540 rename from sys-cluster/lustre/files/0011-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
7541 rename to sys-cluster/lustre/files/0005-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
7542 index b3964cc..4d11be8 100644
7543 --- a/sys-cluster/lustre/files/0011-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
7544 +++ b/sys-cluster/lustre/files/0005-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
7545 @@ -1,23 +1,49 @@
7546 -From 45e9fffb84c0c272992232ed229586003ab99e5e Mon Sep 17 00:00:00 2001
7547 +From 3c08f9d074a2f89f71f41c8a99272706ad4450ea Mon Sep 17 00:00:00 2001
7548 From: James Simmons <uja.ornl@×××××.com>
7549 -Date: Thu, 14 Nov 2013 19:11:20 -0500
7550 -Subject: [PATCH 11/18] LU-3319 procfs: update zfs proc handling to seq_files
7551 +Date: Fri, 3 Jan 2014 09:55:26 -0500
7552 +Subject: [PATCH 05/13] LU-3319 procfs: update zfs proc handling to seq_files
7553
7554 Migrate all zfs proc handling to using strictly seq_files.
7555
7556 Signed-off-by: James Simmons <uja.ornl@×××××.com>
7557 Change-Id: I6dc7e65c3e74e7934a17939815ec3c334fac58c7
7558 ---
7559 - lustre/osd-zfs/osd_handler.c | 2 +-
7560 + lustre/osd-zfs/osd_handler.c | 13 ++++---
7561 lustre/osd-zfs/osd_internal.h | 3 --
7562 - lustre/osd-zfs/osd_lproc.c | 78 ++++++++++++++++++++++---------------------
7563 - 3 files changed, 41 insertions(+), 42 deletions(-)
7564 + lustre/osd-zfs/osd_lproc.c | 88 ++++++++++++++++++++++++-------------------
7565 + 3 files changed, 57 insertions(+), 47 deletions(-)
7566
7567 diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c
7568 -index 77f4799..b40d03d 100644
7569 +index d4193cd..36bf6a4 100644
7570 --- a/lustre/osd-zfs/osd_handler.c
7571 +++ b/lustre/osd-zfs/osd_handler.c
7572 -@@ -900,7 +900,7 @@ int __init osd_init(void)
7573 +@@ -745,6 +745,7 @@ static int osd_device_init(const struct lu_env *env, struct lu_device *d,
7574 + static int osd_process_config(const struct lu_env *env,
7575 + struct lu_device *d, struct lustre_cfg *cfg)
7576 + {
7577 ++ struct obd_device *obd = d->ld_obd;
7578 + struct osd_device *o = osd_dev(d);
7579 + int rc;
7580 + ENTRY;
7581 +@@ -758,12 +759,12 @@ static int osd_process_config(const struct lu_env *env,
7582 + break;
7583 + case LCFG_PARAM: {
7584 + LASSERT(&o->od_dt_dev);
7585 +- rc = class_process_proc_param(PARAM_OSD, lprocfs_osd_obd_vars,
7586 +- cfg, &o->od_dt_dev);
7587 ++ rc = class_process_proc_seq_param(PARAM_OSD, obd->obd_vars,
7588 ++ cfg, &o->od_dt_dev);
7589 + if (rc > 0 || rc == -ENOSYS)
7590 +- rc = class_process_proc_param(PARAM_OST,
7591 +- lprocfs_osd_obd_vars,
7592 +- cfg, &o->od_dt_dev);
7593 ++ rc = class_process_proc_seq_param(PARAM_OST,
7594 ++ obd->obd_vars, cfg,
7595 ++ &o->od_dt_dev);
7596 + break;
7597 + }
7598 + default:
7599 +@@ -911,7 +912,7 @@ int __init osd_init(void)
7600
7601 rc = class_register_type(&osd_obd_device_ops, NULL, NULL,
7602 #ifndef HAVE_ONLY_PROCFS_SEQ
7603 @@ -27,7 +53,7 @@ index 77f4799..b40d03d 100644
7604 LUSTRE_OSD_ZFS_NAME, &osd_device_type);
7605 if (rc)
7606 diff --git a/lustre/osd-zfs/osd_internal.h b/lustre/osd-zfs/osd_internal.h
7607 -index 0e202d2..fbad073 100644
7608 +index bc51cb1..77b118f 100644
7609 --- a/lustre/osd-zfs/osd_internal.h
7610 +++ b/lustre/osd-zfs/osd_internal.h
7611 @@ -402,9 +402,6 @@ enum {
7612 @@ -41,7 +67,7 @@ index 0e202d2..fbad073 100644
7613 int osd_procfs_fini(struct osd_device *osd);
7614
7615 diff --git a/lustre/osd-zfs/osd_lproc.c b/lustre/osd-zfs/osd_lproc.c
7616 -index 0854ce6..5a2bbac 100644
7617 +index 0854ce6..a7ce60d 100644
7618 --- a/lustre/osd-zfs/osd_lproc.c
7619 +++ b/lustre/osd-zfs/osd_lproc.c
7620 @@ -107,27 +107,26 @@ out:
7621 @@ -112,7 +138,7 @@ index 0854ce6..5a2bbac 100644
7622 int rc, val;
7623
7624 LASSERT(osd != NULL);
7625 -@@ -165,24 +165,26 @@ static int lprocfs_osd_wr_iused_est(struct file *file, const char *buffer,
7626 +@@ -165,24 +165,36 @@ static int lprocfs_osd_wr_iused_est(struct file *file, const char *buffer,
7627
7628 return count;
7629 }
7630 @@ -144,20 +170,30 @@ index 0854ce6..5a2bbac 100644
7631 +LPROC_SEQ_FOPS_RO_TYPE(zfs, dt_filesfree);
7632 +
7633 +struct lprocfs_seq_vars lprocfs_osd_obd_vars[] = {
7634 -+ { "blocksize", &zfs_dt_blksize_fops },
7635 -+ { "kbytestotal", &zfs_dt_kbytestotal_fops },
7636 -+ { "kbytesfree", &zfs_dt_kbytesfree_fops },
7637 -+ { "kbytesavail", &zfs_dt_kbytesavail_fops },
7638 -+ { "filestotal", &zfs_dt_filestotal_fops },
7639 -+ { "filesfree", &zfs_dt_filesfree_fops },
7640 -+ { "fstype", &zfs_osd_fstype_fops },
7641 -+ { "mntdev", &zfs_osd_mntdev_fops },
7642 -+ { "force_sync", &zfs_osd_force_sync_fops },
7643 -+ { "quota_iused_estimate",&zfs_osd_iused_est_fops },
7644 ++ { .name = "blocksize",
7645 ++ .fops = &zfs_dt_blksize_fops },
7646 ++ { .name = "kbytestotal",
7647 ++ .fops = &zfs_dt_kbytestotal_fops },
7648 ++ { .name = "kbytesfree",
7649 ++ .fops = &zfs_dt_kbytesfree_fops },
7650 ++ { .name = "kbytesavail",
7651 ++ .fops = &zfs_dt_kbytesavail_fops },
7652 ++ { .name = "filestotal",
7653 ++ .fops = &zfs_dt_filestotal_fops },
7654 ++ { .name = "filesfree",
7655 ++ .fops = &zfs_dt_filesfree_fops },
7656 ++ { .name = "fstype",
7657 ++ .fops = &zfs_osd_fstype_fops },
7658 ++ { .name = "mntdev",
7659 ++ .fops = &zfs_osd_mntdev_fops },
7660 ++ { .name = "force_sync",
7661 ++ .fops = &zfs_osd_force_sync_fops },
7662 ++ { .name = "quota_iused_estimate",
7663 ++ .fops = &zfs_osd_iused_est_fops },
7664 { 0 }
7665 };
7666
7667 -@@ -202,7 +204,7 @@ int osd_procfs_init(struct osd_device *osd, const char *name)
7668 +@@ -202,7 +214,7 @@ int osd_procfs_init(struct osd_device *osd, const char *name)
7669 LASSERT(name != NULL);
7670 LASSERT(type != NULL);
7671
7672 @@ -167,5 +203,5 @@ index 0854ce6..5a2bbac 100644
7673 if (IS_ERR(osd->od_proc_entry)) {
7674 rc = PTR_ERR(osd->od_proc_entry);
7675 --
7676 -1.8.5.1
7677 +1.8.5.3
7678
7679
7680 diff --git a/sys-cluster/lustre/files/0006-LU-3319-procfs-move-llite-proc-handling-over-to-seq_.patch b/sys-cluster/lustre/files/0006-LU-3319-procfs-move-llite-proc-handling-over-to-seq_.patch
7681 deleted file mode 100644
7682 index e56376a..0000000
7683 --- a/sys-cluster/lustre/files/0006-LU-3319-procfs-move-llite-proc-handling-over-to-seq_.patch
7684 +++ /dev/null
7685 @@ -1,1334 +0,0 @@
7686 -From 01ce737ef8bba37c904d79f3aabe88a4ead20b74 Mon Sep 17 00:00:00 2001
7687 -From: James Simmons <uja.ornl@×××××.com>
7688 -Date: Thu, 5 Dec 2013 13:53:37 -0500
7689 -Subject: [PATCH 06/18] LU-3319 procfs: move llite proc handling over to
7690 - seq_file
7691 -
7692 -For lustre clients a special abstract layer so a lustre
7693 -client can be mounted. In order to support 3.10+ kernels
7694 -this client code being the llite,vvp,and clio layers proc
7695 -proc handling has been ported to using seq_files only.
7696 -
7697 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
7698 -Change-Id: Id2ac0956dbdf586ab1200e2edb00d489c15c5d50
7699 ----
7700 - lustre/include/cl_object.h | 4 +-
7701 - lustre/include/lu_object.h | 1 +
7702 - lustre/llite/llite_internal.h | 7 +-
7703 - lustre/llite/llite_lib.c | 40 ++-
7704 - lustre/llite/lproc_llite.c | 611 +++++++++++++++++++++---------------------
7705 - lustre/llite/super25.c | 2 +-
7706 - lustre/llite/vvp_dev.c | 7 +-
7707 - lustre/obdclass/cl_object.c | 93 +++----
7708 - lustre/obdclass/lu_object.c | 22 ++
7709 - 9 files changed, 402 insertions(+), 385 deletions(-)
7710 -
7711 -diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h
7712 -index 0aedd62..9735671 100644
7713 ---- a/lustre/include/cl_object.h
7714 -+++ b/lustre/include/cl_object.h
7715 -@@ -2553,8 +2553,6 @@ struct cache_stats {
7716 -
7717 - /** These are not exported so far */
7718 - void cache_stats_init (struct cache_stats *cs, const char *name);
7719 --int cache_stats_print(const struct cache_stats *cs,
7720 -- char *page, int count, int header);
7721 -
7722 - /**
7723 - * Client-side site. This represents particular client stack. "Global"
7724 -@@ -2586,7 +2584,7 @@ void cl_stack_fini(const struct lu_env *env, struct cl_device *cl);
7725 - * Output client site statistical counters into a buffer. Suitable for
7726 - * ll_rd_*()-style functions.
7727 - */
7728 --int cl_site_stats_print(const struct cl_site *s, char *page, int count);
7729 -+int cl_site_stats_print(const struct cl_site *site, struct seq_file *m);
7730 -
7731 - /**
7732 - * \name helpers
7733 -diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h
7734 -index 94c0b47..103debd 100644
7735 ---- a/lustre/include/lu_object.h
7736 -+++ b/lustre/include/lu_object.h
7737 -@@ -1279,6 +1279,7 @@ int lu_env_refill_by_tags(struct lu_env *env, __u32 ctags, __u32 stags);
7738 - * Output site statistical counters into a buffer. Suitable for
7739 - * ll_rd_*()-style functions.
7740 - */
7741 -+int lu_site_stats_seq_print(const struct lu_site *s, struct seq_file *m);
7742 - int lu_site_stats_print(const struct lu_site *s, char *page, int count);
7743 -
7744 - /**
7745 -diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
7746 -index 283e106..44f6522 100644
7747 ---- a/lustre/llite/llite_internal.h
7748 -+++ b/lustre/llite/llite_internal.h
7749 -@@ -706,15 +706,16 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
7750 - struct super_block *sb, char *osc, char *mdc);
7751 - void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi);
7752 - void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count);
7753 --void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars);
7754 -+int ll_process_proc_param(struct lustre_cfg *lcfg, unsigned long *sb);
7755 - #else
7756 - static inline int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
7757 - struct super_block *sb, char *osc, char *mdc){return 0;}
7758 - static inline void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi) {}
7759 - static void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count) {}
7760 --static void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars)
7761 -+
7762 -+static int ll_process_proc_param(struct lustre_cfg *lcfg, unsigned long *sb)
7763 - {
7764 -- memset(lvars, 0, sizeof(*lvars));
7765 -+ return 0;
7766 - }
7767 - #endif
7768 -
7769 -diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
7770 -index 9d9e432..86f07c9 100644
7771 ---- a/lustre/llite/llite_lib.c
7772 -+++ b/lustre/llite/llite_lib.c
7773 -@@ -2277,31 +2277,23 @@ out_statfs:
7774 -
7775 - int ll_process_config(struct lustre_cfg *lcfg)
7776 - {
7777 -- char *ptr;
7778 -- void *sb;
7779 -- struct lprocfs_static_vars lvars;
7780 -- unsigned long x;
7781 -- int rc = 0;
7782 -+ struct super_block *sb;
7783 -+ unsigned long x;
7784 -+ char *ptr;
7785 -
7786 -- lprocfs_llite_init_vars(&lvars);
7787 --
7788 -- /* The instance name contains the sb: lustre-client-aacfe000 */
7789 -- ptr = strrchr(lustre_cfg_string(lcfg, 0), '-');
7790 -- if (!ptr || !*(++ptr))
7791 -- return -EINVAL;
7792 -- if (sscanf(ptr, "%lx", &x) != 1)
7793 -- return -EINVAL;
7794 -- sb = (void *)x;
7795 -- /* This better be a real Lustre superblock! */
7796 -- LASSERT(s2lsi((struct super_block *)sb)->lsi_lmd->lmd_magic == LMD_MAGIC);
7797 --
7798 -- /* Note we have not called client_common_fill_super yet, so
7799 -- proc fns must be able to handle that! */
7800 -- rc = class_process_proc_param(PARAM_LLITE, lvars.obd_vars,
7801 -- lcfg, sb);
7802 -- if (rc > 0)
7803 -- rc = 0;
7804 -- return(rc);
7805 -+ /* The instance name contains the sb: lustre-client-aacfe000 */
7806 -+ ptr = strrchr(lustre_cfg_string(lcfg, 0), '-');
7807 -+ if (!ptr || !*(++ptr))
7808 -+ return -EINVAL;
7809 -+ if (sscanf(ptr, "%lx", &x) != 1)
7810 -+ return -EINVAL;
7811 -+ sb = (struct super_block *)x;
7812 -+ /* This better be a real Lustre superblock! */
7813 -+ LASSERT(s2lsi(sb)->lsi_lmd->lmd_magic == LMD_MAGIC);
7814 -+
7815 -+ /* Note we have not called client_common_fill_super yet, so
7816 -+ proc fns must be able to handle that! */
7817 -+ return ll_process_proc_param(lcfg, &x);
7818 - }
7819 -
7820 - /* this function prepares md_op_data hint for passing ot down to MD stack. */
7821 -diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c
7822 -index 2686924..7793a63 100644
7823 ---- a/lustre/llite/lproc_llite.c
7824 -+++ b/lustre/llite/lproc_llite.c
7825 -@@ -37,8 +37,8 @@
7826 -
7827 - #include <linux/version.h>
7828 - #include <lustre_lite.h>
7829 -+#include <lustre_param.h>
7830 - #include <lprocfs_status.h>
7831 --#include <linux/seq_file.h>
7832 - #include <obd_support.h>
7833 -
7834 - #include "llite_internal.h"
7835 -@@ -52,10 +52,9 @@ struct file_operations ll_rw_extents_stats_fops;
7836 - struct file_operations ll_rw_extents_stats_pp_fops;
7837 - struct file_operations ll_rw_offset_stats_fops;
7838 -
7839 --static int ll_rd_blksize(char *page, char **start, off_t off, int count,
7840 -- int *eof, void *data)
7841 -+static int ll_blksize_seq_show(struct seq_file *m, void *v)
7842 - {
7843 -- struct super_block *sb = (struct super_block *)data;
7844 -+ struct super_block *sb = m->private;
7845 - struct obd_statfs osfs;
7846 - int rc;
7847 -
7848 -@@ -63,18 +62,15 @@ static int ll_rd_blksize(char *page, char **start, off_t off, int count,
7849 - rc = ll_statfs_internal(sb, &osfs,
7850 - cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
7851 - OBD_STATFS_NODELAY);
7852 -- if (!rc) {
7853 -- *eof = 1;
7854 -- rc = snprintf(page, count, "%u\n", osfs.os_bsize);
7855 -- }
7856 --
7857 -+ if (!rc)
7858 -+ rc = seq_printf(m, "%u\n", osfs.os_bsize);
7859 - return rc;
7860 - }
7861 -+LPROC_SEQ_FOPS_RO(ll_blksize);
7862 -
7863 --static int ll_rd_kbytestotal(char *page, char **start, off_t off, int count,
7864 -- int *eof, void *data)
7865 -+static int ll_kbytestotal_seq_show(struct seq_file *m, void *v)
7866 - {
7867 -- struct super_block *sb = (struct super_block *)data;
7868 -+ struct super_block *sb = m->private;
7869 - struct obd_statfs osfs;
7870 - int rc;
7871 -
7872 -@@ -89,17 +85,15 @@ static int ll_rd_kbytestotal(char *page, char **start, off_t off, int count,
7873 - while (blk_size >>= 1)
7874 - result <<= 1;
7875 -
7876 -- *eof = 1;
7877 -- rc = snprintf(page, count, LPU64"\n", result);
7878 -+ rc = seq_printf(m, LPU64"\n", result);
7879 - }
7880 - return rc;
7881 --
7882 - }
7883 -+LPROC_SEQ_FOPS_RO(ll_kbytestotal);
7884 -
7885 --static int ll_rd_kbytesfree(char *page, char **start, off_t off, int count,
7886 -- int *eof, void *data)
7887 -+static int ll_kbytesfree_seq_show(struct seq_file *m, void *v)
7888 - {
7889 -- struct super_block *sb = (struct super_block *)data;
7890 -+ struct super_block *sb = m->private;
7891 - struct obd_statfs osfs;
7892 - int rc;
7893 -
7894 -@@ -114,16 +108,15 @@ static int ll_rd_kbytesfree(char *page, char **start, off_t off, int count,
7895 - while (blk_size >>= 1)
7896 - result <<= 1;
7897 -
7898 -- *eof = 1;
7899 -- rc = snprintf(page, count, LPU64"\n", result);
7900 -+ rc = seq_printf(m, LPU64"\n", result);
7901 - }
7902 - return rc;
7903 - }
7904 -+LPROC_SEQ_FOPS_RO(ll_kbytesfree);
7905 -
7906 --static int ll_rd_kbytesavail(char *page, char **start, off_t off, int count,
7907 -- int *eof, void *data)
7908 -+static int ll_kbytesavail_seq_show(struct seq_file *m, void *v)
7909 - {
7910 -- struct super_block *sb = (struct super_block *)data;
7911 -+ struct super_block *sb = m->private;
7912 - struct obd_statfs osfs;
7913 - int rc;
7914 -
7915 -@@ -138,16 +131,15 @@ static int ll_rd_kbytesavail(char *page, char **start, off_t off, int count,
7916 - while (blk_size >>= 1)
7917 - result <<= 1;
7918 -
7919 -- *eof = 1;
7920 -- rc = snprintf(page, count, LPU64"\n", result);
7921 -+ rc = seq_printf(m, LPU64"\n", result);
7922 - }
7923 - return rc;
7924 - }
7925 -+LPROC_SEQ_FOPS_RO(ll_kbytesavail);
7926 -
7927 --static int ll_rd_filestotal(char *page, char **start, off_t off, int count,
7928 -- int *eof, void *data)
7929 -+static int ll_filestotal_seq_show(struct seq_file *m, void *v)
7930 - {
7931 -- struct super_block *sb = (struct super_block *)data;
7932 -+ struct super_block *sb = m->private;
7933 - struct obd_statfs osfs;
7934 - int rc;
7935 -
7936 -@@ -155,86 +147,73 @@ static int ll_rd_filestotal(char *page, char **start, off_t off, int count,
7937 - rc = ll_statfs_internal(sb, &osfs,
7938 - cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
7939 - OBD_STATFS_NODELAY);
7940 -- if (!rc) {
7941 -- *eof = 1;
7942 -- rc = snprintf(page, count, LPU64"\n", osfs.os_files);
7943 -- }
7944 -- return rc;
7945 -+ if (!rc)
7946 -+ rc = seq_printf(m, LPU64"\n", osfs.os_files);
7947 -+ return rc;
7948 - }
7949 -+LPROC_SEQ_FOPS_RO(ll_filestotal);
7950 -
7951 --static int ll_rd_filesfree(char *page, char **start, off_t off, int count,
7952 -- int *eof, void *data)
7953 -+static int ll_filesfree_seq_show(struct seq_file *m, void *v)
7954 - {
7955 -- struct super_block *sb = (struct super_block *)data;
7956 -- struct obd_statfs osfs;
7957 -- int rc;
7958 --
7959 -- LASSERT(sb != NULL);
7960 -- rc = ll_statfs_internal(sb, &osfs,
7961 -- cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
7962 -- OBD_STATFS_NODELAY);
7963 -- if (!rc) {
7964 -- *eof = 1;
7965 -- rc = snprintf(page, count, LPU64"\n", osfs.os_ffree);
7966 -- }
7967 -- return rc;
7968 -+ struct super_block *sb = m->private;
7969 -+ struct obd_statfs osfs;
7970 -+ int rc;
7971 -
7972 -+ LASSERT(sb != NULL);
7973 -+ rc = ll_statfs_internal(sb, &osfs,
7974 -+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
7975 -+ OBD_STATFS_NODELAY);
7976 -+ if (!rc)
7977 -+ rc = seq_printf(m, LPU64"\n", osfs.os_ffree);
7978 -+ return rc;
7979 - }
7980 -+LPROC_SEQ_FOPS_RO(ll_filesfree);
7981 -
7982 --static int ll_rd_client_type(char *page, char **start, off_t off, int count,
7983 -- int *eof, void *data)
7984 -+static int ll_client_type_seq_show(struct seq_file *m, void *v)
7985 - {
7986 -- struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)data);
7987 -- int rc;
7988 --
7989 -- LASSERT(sbi != NULL);
7990 -+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
7991 -+ int rc;
7992 -
7993 -- *eof = 1;
7994 -- if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
7995 -- rc = snprintf(page, count, "remote client\n");
7996 -- else
7997 -- rc = snprintf(page, count, "local client\n");
7998 -+ LASSERT(sbi != NULL);
7999 -
8000 -- return rc;
8001 -+ if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
8002 -+ rc = seq_printf(m, "remote client\n");
8003 -+ else
8004 -+ rc = seq_printf(m, "local client\n");
8005 -+ return rc;
8006 - }
8007 -+LPROC_SEQ_FOPS_RO(ll_client_type);
8008 -
8009 --static int ll_rd_fstype(char *page, char **start, off_t off, int count,
8010 -- int *eof, void *data)
8011 -+static int ll_fstype_seq_show(struct seq_file *m, void *v)
8012 - {
8013 -- struct super_block *sb = (struct super_block*)data;
8014 -+ struct super_block *sb = m->private;
8015 -
8016 -- LASSERT(sb != NULL);
8017 -- *eof = 1;
8018 -- return snprintf(page, count, "%s\n", sb->s_type->name);
8019 -+ LASSERT(sb != NULL);
8020 -+ return seq_printf(m, "%s\n", sb->s_type->name);
8021 - }
8022 -+LPROC_SEQ_FOPS_RO(ll_fstype);
8023 -
8024 --static int ll_rd_sb_uuid(char *page, char **start, off_t off, int count,
8025 -- int *eof, void *data)
8026 -+static int ll_sb_uuid_seq_show(struct seq_file *m, void *v)
8027 - {
8028 -- struct super_block *sb = (struct super_block *)data;
8029 -+ struct super_block *sb = m->private;
8030 -
8031 -- LASSERT(sb != NULL);
8032 -- *eof = 1;
8033 -- return snprintf(page, count, "%s\n", ll_s2sbi(sb)->ll_sb_uuid.uuid);
8034 -+ LASSERT(sb != NULL);
8035 -+ return seq_printf(m, "%s\n", ll_s2sbi(sb)->ll_sb_uuid.uuid);
8036 - }
8037 -+LPROC_SEQ_FOPS_RO(ll_sb_uuid);
8038 -
8039 --static int ll_rd_xattr_cache(char *page, char **start, off_t off,
8040 -- int count, int *eof, void *data)
8041 -+static int ll_xattr_cache_seq_show(struct seq_file *m, void *v)
8042 - {
8043 -- struct super_block *sb = (struct super_block *)data;
8044 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8045 -- int rc;
8046 --
8047 -- rc = snprintf(page, count, "%u\n", sbi->ll_xattr_cache_enabled);
8048 -+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
8049 -
8050 -- return rc;
8051 -+ return seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled);
8052 - }
8053 -
8054 --static int ll_wr_xattr_cache(struct file *file, const char *buffer,
8055 -- unsigned long count, void *data)
8056 -+static ssize_t ll_xattr_cache_seq_write(struct file *file, const char *buffer,
8057 -+ size_t count, loff_t *off)
8058 - {
8059 -- struct super_block *sb = (struct super_block *)data;
8060 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8061 -+ struct seq_file *m = file->private_data;
8062 -+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
8063 - int val, rc;
8064 -
8065 - rc = lprocfs_write_helper(buffer, count, &val);
8066 -@@ -251,24 +230,23 @@ static int ll_wr_xattr_cache(struct file *file, const char *buffer,
8067 -
8068 - return count;
8069 - }
8070 -+LPROC_SEQ_FOPS(ll_xattr_cache);
8071 -
8072 --static int ll_rd_site_stats(char *page, char **start, off_t off,
8073 -- int count, int *eof, void *data)
8074 -+static int ll_site_stats_seq_show(struct seq_file *m, void *v)
8075 - {
8076 -- struct super_block *sb = data;
8077 --
8078 -- /*
8079 -- * See description of statistical counters in struct cl_site, and
8080 -- * struct lu_site.
8081 -- */
8082 -- return cl_site_stats_print(lu2cl_site(ll_s2sbi(sb)->ll_site),
8083 -- page, count);
8084 -+ struct super_block *sb = m->private;
8085 -+
8086 -+ /*
8087 -+ * See description of statistical counters in struct cl_site, and
8088 -+ * struct lu_site.
8089 -+ */
8090 -+ return cl_site_stats_print(lu2cl_site(ll_s2sbi(sb)->ll_site), m);
8091 - }
8092 -+LPROC_SEQ_FOPS_RO(ll_site_stats);
8093 -
8094 --static int ll_rd_max_readahead_mb(char *page, char **start, off_t off,
8095 -- int count, int *eof, void *data)
8096 -+static int ll_max_readahead_mb_seq_show(struct seq_file *m, void *v)
8097 - {
8098 -- struct super_block *sb = data;
8099 -+ struct super_block *sb = m->private;
8100 - struct ll_sb_info *sbi = ll_s2sbi(sb);
8101 - long pages_number;
8102 - int mult;
8103 -@@ -278,14 +256,15 @@ static int ll_rd_max_readahead_mb(char *page, char **start, off_t off,
8104 - spin_unlock(&sbi->ll_lock);
8105 -
8106 - mult = 1 << (20 - PAGE_CACHE_SHIFT);
8107 -- return lprocfs_read_frac_helper(page, count, pages_number, mult);
8108 -+ return lprocfs_seq_read_frac_helper(m, pages_number, mult);
8109 - }
8110 -
8111 --static int ll_wr_max_readahead_mb(struct file *file, const char *buffer,
8112 -- unsigned long count, void *data)
8113 -+static ssize_t
8114 -+ll_max_readahead_mb_seq_write(struct file *file, const char *buffer,
8115 -+ size_t count, loff_t *off)
8116 - {
8117 -- struct super_block *sb = data;
8118 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8119 -+ struct seq_file *m = file->private_data;
8120 -+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
8121 - int mult, rc, pages_number;
8122 -
8123 - mult = 1 << (20 - PAGE_CACHE_SHIFT);
8124 -@@ -303,14 +282,13 @@ static int ll_wr_max_readahead_mb(struct file *file, const char *buffer,
8125 - spin_lock(&sbi->ll_lock);
8126 - sbi->ll_ra_info.ra_max_pages = pages_number;
8127 - spin_unlock(&sbi->ll_lock);
8128 --
8129 - return count;
8130 - }
8131 -+LPROC_SEQ_FOPS(ll_max_readahead_mb);
8132 -
8133 --static int ll_rd_max_readahead_per_file_mb(char *page, char **start, off_t off,
8134 -- int count, int *eof, void *data)
8135 -+static int ll_max_readahead_per_file_mb_seq_show(struct seq_file *m, void *v)
8136 - {
8137 -- struct super_block *sb = data;
8138 -+ struct super_block *sb = m->private;
8139 - struct ll_sb_info *sbi = ll_s2sbi(sb);
8140 - long pages_number;
8141 - int mult;
8142 -@@ -320,15 +298,16 @@ static int ll_rd_max_readahead_per_file_mb(char *page, char **start, off_t off,
8143 - spin_unlock(&sbi->ll_lock);
8144 -
8145 - mult = 1 << (20 - PAGE_CACHE_SHIFT);
8146 -- return lprocfs_read_frac_helper(page, count, pages_number, mult);
8147 -+ return lprocfs_seq_read_frac_helper(m, pages_number, mult);
8148 - }
8149 -
8150 --static int ll_wr_max_readahead_per_file_mb(struct file *file, const char *buffer,
8151 -- unsigned long count, void *data)
8152 -+static ssize_t
8153 -+ll_max_readahead_per_file_mb_seq_write(struct file *file, const char *buffer,
8154 -+ size_t count, loff_t *off)
8155 - {
8156 -- struct super_block *sb = data;
8157 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8158 -- int mult, rc, pages_number;
8159 -+ struct seq_file *m = file->private_data;
8160 -+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
8161 -+ int mult, rc, pages_number;
8162 -
8163 - mult = 1 << (20 - PAGE_CACHE_SHIFT);
8164 - rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
8165 -@@ -346,14 +325,13 @@ static int ll_wr_max_readahead_per_file_mb(struct file *file, const char *buffer
8166 - spin_lock(&sbi->ll_lock);
8167 - sbi->ll_ra_info.ra_max_pages_per_file = pages_number;
8168 - spin_unlock(&sbi->ll_lock);
8169 --
8170 - return count;
8171 - }
8172 -+LPROC_SEQ_FOPS(ll_max_readahead_per_file_mb);
8173 -
8174 --static int ll_rd_max_read_ahead_whole_mb(char *page, char **start, off_t off,
8175 -- int count, int *eof, void *data)
8176 -+static int ll_max_read_ahead_whole_mb_seq_show(struct seq_file *m, void *v)
8177 - {
8178 -- struct super_block *sb = data;
8179 -+ struct super_block *sb = m->private;
8180 - struct ll_sb_info *sbi = ll_s2sbi(sb);
8181 - long pages_number;
8182 - int mult;
8183 -@@ -363,14 +341,15 @@ static int ll_rd_max_read_ahead_whole_mb(char *page, char **start, off_t off,
8184 - spin_unlock(&sbi->ll_lock);
8185 -
8186 - mult = 1 << (20 - PAGE_CACHE_SHIFT);
8187 -- return lprocfs_read_frac_helper(page, count, pages_number, mult);
8188 -+ return lprocfs_seq_read_frac_helper(m, pages_number, mult);
8189 - }
8190 -
8191 --static int ll_wr_max_read_ahead_whole_mb(struct file *file, const char *buffer,
8192 -- unsigned long count, void *data)
8193 -+static ssize_t
8194 -+ll_max_read_ahead_whole_mb_seq_write(struct file *file, const char *buffer,
8195 -+ size_t count, loff_t *off)
8196 - {
8197 -- struct super_block *sb = data;
8198 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8199 -+ struct seq_file *m = file->private_data;
8200 -+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
8201 - int mult, rc, pages_number;
8202 -
8203 - mult = 1 << (20 - PAGE_CACHE_SHIFT);
8204 -@@ -392,24 +371,22 @@ static int ll_wr_max_read_ahead_whole_mb(struct file *file, const char *buffer,
8205 - spin_lock(&sbi->ll_lock);
8206 - sbi->ll_ra_info.ra_max_read_ahead_whole_pages = pages_number;
8207 - spin_unlock(&sbi->ll_lock);
8208 --
8209 - return count;
8210 - }
8211 -+LPROC_SEQ_FOPS(ll_max_read_ahead_whole_mb);
8212 -
8213 --static int ll_rd_max_cached_mb(char *page, char **start, off_t off,
8214 -- int count, int *eof, void *data)
8215 -+static int ll_max_cached_mb_seq_show(struct seq_file *m, void *v)
8216 - {
8217 -- struct super_block *sb = data;
8218 -+ struct super_block *sb = m->private;
8219 - struct ll_sb_info *sbi = ll_s2sbi(sb);
8220 - struct cl_client_cache *cache = &sbi->ll_cache;
8221 - int shift = 20 - PAGE_CACHE_SHIFT;
8222 - int max_cached_mb;
8223 - int unused_mb;
8224 -
8225 -- *eof = 1;
8226 - max_cached_mb = cache->ccc_lru_max >> shift;
8227 - unused_mb = cfs_atomic_read(&cache->ccc_lru_left) >> shift;
8228 -- return snprintf(page, count,
8229 -+ return seq_printf(m,
8230 - "users: %d\n"
8231 - "max_cached_mb: %d\n"
8232 - "used_mb: %d\n"
8233 -@@ -422,16 +399,17 @@ static int ll_rd_max_cached_mb(char *page, char **start, off_t off,
8234 - cache->ccc_lru_shrinkers);
8235 - }
8236 -
8237 --static int ll_wr_max_cached_mb(struct file *file, const char *buffer,
8238 -- unsigned long nob, void *data)
8239 -+static ssize_t
8240 -+ll_max_cached_mb_seq_write(struct file *file, const char *buffer,
8241 -+ size_t count, loff_t *off)
8242 - {
8243 -- struct super_block *sb = data;
8244 -+ struct seq_file *m = file->private_data;
8245 -+ struct super_block *sb = m->private;
8246 - struct ll_sb_info *sbi = ll_s2sbi(sb);
8247 - struct cl_client_cache *cache = &sbi->ll_cache;
8248 - struct lu_env *env;
8249 - int refcheck;
8250 - int mult, rc, pages_number;
8251 -- size_t count = nob;
8252 - int diff = 0;
8253 - int nrpages = 0;
8254 - ENTRY;
8255 -@@ -512,22 +490,21 @@ out:
8256 - }
8257 - return rc;
8258 - }
8259 -+LPROC_SEQ_FOPS(ll_max_cached_mb);
8260 -
8261 --static int ll_rd_checksum(char *page, char **start, off_t off,
8262 -- int count, int *eof, void *data)
8263 -+static int ll_checksum_seq_show(struct seq_file *m, void *v)
8264 - {
8265 -- struct super_block *sb = data;
8266 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8267 -+ struct super_block *sb = m->private;
8268 -+ struct ll_sb_info *sbi = ll_s2sbi(sb);
8269 -
8270 -- return snprintf(page, count, "%u\n",
8271 -- (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0);
8272 -+ return seq_printf(m, "%u\n", (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0);
8273 - }
8274 -
8275 --static int ll_wr_checksum(struct file *file, const char *buffer,
8276 -- unsigned long count, void *data)
8277 -+static ssize_t ll_checksum_seq_write(struct file *file, const char *buffer,
8278 -+ size_t count, loff_t *off)
8279 - {
8280 -- struct super_block *sb = data;
8281 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8282 -+ struct seq_file *m = file->private_data;
8283 -+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
8284 - int val, rc;
8285 -
8286 - if (!sbi->ll_dt_exp)
8287 -@@ -549,19 +526,20 @@ static int ll_wr_checksum(struct file *file, const char *buffer,
8288 -
8289 - return count;
8290 - }
8291 -+LPROC_SEQ_FOPS(ll_checksum);
8292 -
8293 --static int ll_rd_max_rw_chunk(char *page, char **start, off_t off,
8294 -- int count, int *eof, void *data)
8295 -+static int ll_max_rw_chunk_seq_show(struct seq_file *m, void *v)
8296 - {
8297 -- struct super_block *sb = data;
8298 -+ struct super_block *sb = m->private;
8299 -
8300 -- return snprintf(page, count, "%lu\n", ll_s2sbi(sb)->ll_max_rw_chunk);
8301 -+ return seq_printf(m, "%lu\n", ll_s2sbi(sb)->ll_max_rw_chunk);
8302 - }
8303 -
8304 --static int ll_wr_max_rw_chunk(struct file *file, const char *buffer,
8305 -- unsigned long count, void *data)
8306 -+static ssize_t ll_max_rw_chunk_seq_write(struct file *file, const char *buffer,
8307 -+ size_t count, loff_t *off)
8308 - {
8309 -- struct super_block *sb = data;
8310 -+ struct seq_file *m = file->private_data;
8311 -+ struct super_block *sb = m->private;
8312 - int rc, val;
8313 -
8314 - rc = lprocfs_write_helper(buffer, count, &val);
8315 -@@ -570,27 +548,26 @@ static int ll_wr_max_rw_chunk(struct file *file, const char *buffer,
8316 - ll_s2sbi(sb)->ll_max_rw_chunk = val;
8317 - return count;
8318 - }
8319 -+LPROC_SEQ_FOPS(ll_max_rw_chunk);
8320 -
8321 --static int ll_rd_track_id(char *page, int count, void *data,
8322 -- enum stats_track_type type)
8323 -+static int ll_rd_track_id(struct seq_file *m, enum stats_track_type type)
8324 - {
8325 -- struct super_block *sb = data;
8326 --
8327 -- if (ll_s2sbi(sb)->ll_stats_track_type == type) {
8328 -- return snprintf(page, count, "%d\n",
8329 -- ll_s2sbi(sb)->ll_stats_track_id);
8330 -+ struct super_block *sb = m->private;
8331 -
8332 -- } else if (ll_s2sbi(sb)->ll_stats_track_type == STATS_TRACK_ALL) {
8333 -- return snprintf(page, count, "0 (all)\n");
8334 -- } else {
8335 -- return snprintf(page, count, "untracked\n");
8336 -- }
8337 -+ if (ll_s2sbi(sb)->ll_stats_track_type == type) {
8338 -+ return seq_printf(m, "%d\n",
8339 -+ ll_s2sbi(sb)->ll_stats_track_id);
8340 -+ } else if (ll_s2sbi(sb)->ll_stats_track_type == STATS_TRACK_ALL) {
8341 -+ return seq_printf(m, "0 (all)\n");
8342 -+ } else {
8343 -+ return seq_printf(m, "untracked\n");
8344 -+ }
8345 - }
8346 -
8347 - static int ll_wr_track_id(const char *buffer, unsigned long count, void *data,
8348 -- enum stats_track_type type)
8349 -+ enum stats_track_type type)
8350 - {
8351 -- struct super_block *sb = data;
8352 -+ struct super_block *sb = data;
8353 - int rc, pid;
8354 -
8355 - rc = lprocfs_write_helper(buffer, count, &pid);
8356 -@@ -605,57 +582,59 @@ static int ll_wr_track_id(const char *buffer, unsigned long count, void *data,
8357 - return count;
8358 - }
8359 -
8360 --static int ll_rd_track_pid(char *page, char **start, off_t off,
8361 -- int count, int *eof, void *data)
8362 -+static int ll_track_pid_seq_show(struct seq_file *m, void *v)
8363 - {
8364 -- return (ll_rd_track_id(page, count, data, STATS_TRACK_PID));
8365 -+ return ll_rd_track_id(m, STATS_TRACK_PID);
8366 - }
8367 -
8368 --static int ll_wr_track_pid(struct file *file, const char *buffer,
8369 -- unsigned long count, void *data)
8370 -+static ssize_t ll_track_pid_seq_write(struct file *file, const char *buffer,
8371 -+ size_t count, loff_t *off)
8372 - {
8373 -- return (ll_wr_track_id(buffer, count, data, STATS_TRACK_PID));
8374 -+ struct seq_file *seq = file->private_data;
8375 -+ return ll_wr_track_id(buffer, count, seq->private, STATS_TRACK_PID);
8376 - }
8377 -+LPROC_SEQ_FOPS(ll_track_pid);
8378 -
8379 --static int ll_rd_track_ppid(char *page, char **start, off_t off,
8380 -- int count, int *eof, void *data)
8381 -+static int ll_track_ppid_seq_show(struct seq_file *m, void *v)
8382 - {
8383 -- return (ll_rd_track_id(page, count, data, STATS_TRACK_PPID));
8384 -+ return ll_rd_track_id(m, STATS_TRACK_PPID);
8385 - }
8386 -
8387 --static int ll_wr_track_ppid(struct file *file, const char *buffer,
8388 -- unsigned long count, void *data)
8389 -+static ssize_t ll_track_ppid_seq_write(struct file *file, const char *buffer,
8390 -+ size_t count, loff_t *off)
8391 - {
8392 -- return (ll_wr_track_id(buffer, count, data, STATS_TRACK_PPID));
8393 -+ struct seq_file *seq = file->private_data;
8394 -+ return ll_wr_track_id(buffer, count, seq->private, STATS_TRACK_PPID);
8395 - }
8396 -+LPROC_SEQ_FOPS(ll_track_ppid);
8397 -
8398 --static int ll_rd_track_gid(char *page, char **start, off_t off,
8399 -- int count, int *eof, void *data)
8400 -+static int ll_track_gid_seq_show(struct seq_file *m, void *v)
8401 - {
8402 -- return (ll_rd_track_id(page, count, data, STATS_TRACK_GID));
8403 -+ return ll_rd_track_id(m, STATS_TRACK_GID);
8404 - }
8405 -
8406 --static int ll_wr_track_gid(struct file *file, const char *buffer,
8407 -- unsigned long count, void *data)
8408 -+static ssize_t ll_track_gid_seq_write(struct file *file, const char *buffer,
8409 -+ size_t count, loff_t *off)
8410 - {
8411 -- return (ll_wr_track_id(buffer, count, data, STATS_TRACK_GID));
8412 -+ struct seq_file *seq = file->private_data;
8413 -+ return ll_wr_track_id(buffer, count, seq->private, STATS_TRACK_GID);
8414 - }
8415 -+LPROC_SEQ_FOPS(ll_track_gid);
8416 -
8417 --static int ll_rd_statahead_max(char *page, char **start, off_t off,
8418 -- int count, int *eof, void *data)
8419 -+static int ll_statahead_max_seq_show(struct seq_file *m, void *v)
8420 - {
8421 -- struct super_block *sb = data;
8422 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8423 -+ struct super_block *sb = m->private;
8424 -+ struct ll_sb_info *sbi = ll_s2sbi(sb);
8425 -
8426 -- return snprintf(page, count, "%u\n", sbi->ll_sa_max);
8427 -+ return seq_printf(m, "%u\n", sbi->ll_sa_max);
8428 - }
8429 -
8430 --static int ll_wr_statahead_max(struct file *file, const char *buffer,
8431 -- unsigned long count, void *data)
8432 -+static ssize_t ll_statahead_max_seq_write(struct file *file, const char *buffer,
8433 -+ size_t count, loff_t *off)
8434 - {
8435 -- struct super_block *sb = data;
8436 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8437 -- int val, rc;
8438 -+ struct seq_file *m = file->private_data;
8439 -+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
8440 -+ int val, rc;
8441 -
8442 - rc = lprocfs_write_helper(buffer, count, &val);
8443 - if (rc)
8444 -@@ -669,23 +648,23 @@ static int ll_wr_statahead_max(struct file *file, const char *buffer,
8445 -
8446 - return count;
8447 - }
8448 -+LPROC_SEQ_FOPS(ll_statahead_max);
8449 -
8450 --static int ll_rd_statahead_agl(char *page, char **start, off_t off,
8451 -- int count, int *eof, void *data)
8452 -+static int ll_statahead_agl_seq_show(struct seq_file *m, void *v)
8453 - {
8454 -- struct super_block *sb = data;
8455 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8456 -+ struct super_block *sb = m->private;
8457 -+ struct ll_sb_info *sbi = ll_s2sbi(sb);
8458 -
8459 -- return snprintf(page, count, "%u\n",
8460 -- sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0);
8461 -+ return seq_printf(m, "%u\n",
8462 -+ sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0);
8463 - }
8464 -
8465 --static int ll_wr_statahead_agl(struct file *file, const char *buffer,
8466 -- unsigned long count, void *data)
8467 -+static ssize_t ll_statahead_agl_seq_write(struct file *file, const char *buffer,
8468 -+ size_t count, loff_t *off)
8469 - {
8470 -- struct super_block *sb = data;
8471 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8472 -- int val, rc;
8473 -+ struct seq_file *m = file->private_data;
8474 -+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
8475 -+ int val, rc;
8476 -
8477 - rc = lprocfs_write_helper(buffer, count, &val);
8478 - if (rc)
8479 -@@ -698,14 +677,14 @@ static int ll_wr_statahead_agl(struct file *file, const char *buffer,
8480 -
8481 - return count;
8482 - }
8483 -+LPROC_SEQ_FOPS(ll_statahead_agl);
8484 -
8485 --static int ll_rd_statahead_stats(char *page, char **start, off_t off,
8486 -- int count, int *eof, void *data)
8487 -+static int ll_statahead_stats_seq_show(struct seq_file *m, void *v)
8488 - {
8489 -- struct super_block *sb = data;
8490 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8491 -+ struct super_block *sb = m->private;
8492 -+ struct ll_sb_info *sbi = ll_s2sbi(sb);
8493 -
8494 -- return snprintf(page, count,
8495 -+ return seq_printf(m,
8496 - "statahead total: %u\n"
8497 - "statahead wrong: %u\n"
8498 - "agl total: %u\n",
8499 -@@ -713,23 +692,23 @@ static int ll_rd_statahead_stats(char *page, char **start, off_t off,
8500 - atomic_read(&sbi->ll_sa_wrong),
8501 - atomic_read(&sbi->ll_agl_total));
8502 - }
8503 -+LPROC_SEQ_FOPS_RO(ll_statahead_stats);
8504 -
8505 --static int ll_rd_lazystatfs(char *page, char **start, off_t off,
8506 -- int count, int *eof, void *data)
8507 -+static int ll_lazystatfs_seq_show(struct seq_file *m, void *v)
8508 - {
8509 -- struct super_block *sb = data;
8510 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8511 -+ struct super_block *sb = m->private;
8512 -+ struct ll_sb_info *sbi = ll_s2sbi(sb);
8513 -
8514 -- return snprintf(page, count, "%u\n",
8515 -- (sbi->ll_flags & LL_SBI_LAZYSTATFS) ? 1 : 0);
8516 -+ return seq_printf(m, "%u\n",
8517 -+ (sbi->ll_flags & LL_SBI_LAZYSTATFS) ? 1 : 0);
8518 - }
8519 -
8520 --static int ll_wr_lazystatfs(struct file *file, const char *buffer,
8521 -- unsigned long count, void *data)
8522 -+static ssize_t ll_lazystatfs_seq_write(struct file *file, const char *buffer,
8523 -+ size_t count, loff_t *off)
8524 - {
8525 -- struct super_block *sb = data;
8526 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8527 -- int val, rc;
8528 -+ struct seq_file *m = file->private_data;
8529 -+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
8530 -+ int val, rc;
8531 -
8532 - rc = lprocfs_write_helper(buffer, count, &val);
8533 - if (rc)
8534 -@@ -742,30 +721,29 @@ static int ll_wr_lazystatfs(struct file *file, const char *buffer,
8535 -
8536 - return count;
8537 - }
8538 -+LPROC_SEQ_FOPS(ll_lazystatfs);
8539 -
8540 --static int ll_rd_maxea_size(char *page, char **start, off_t off,
8541 -- int count, int *eof, void *data)
8542 -+static int ll_maxea_size_seq_show(struct seq_file *m, void *v)
8543 - {
8544 -- struct super_block *sb = data;
8545 -- struct ll_sb_info *sbi = ll_s2sbi(sb);
8546 -- unsigned int ealen;
8547 -- int rc;
8548 -+ struct super_block *sb = m->private;
8549 -+ struct ll_sb_info *sbi = ll_s2sbi(sb);
8550 -+ unsigned int ealen;
8551 -+ int rc;
8552 -
8553 - rc = ll_get_max_mdsize(sbi, &ealen);
8554 - if (rc)
8555 - return rc;
8556 -
8557 -- return snprintf(page, count, "%u\n", ealen);
8558 -+ return seq_printf(m, "%u\n", ealen);
8559 - }
8560 -+LPROC_SEQ_FOPS_RO(ll_maxea_size);
8561 -
8562 --static int ll_rd_sbi_flags(char *page, char **start, off_t off,
8563 -- int count, int *eof, void *data)
8564 -+static int ll_sbi_flags_seq_show(struct seq_file *m, void *v)
8565 - {
8566 - const char *str[] = LL_SBI_FLAGS;
8567 -- struct super_block *sb = data;
8568 -+ struct super_block *sb = m->private;
8569 - int flags = ll_s2sbi(sb)->ll_flags;
8570 - int i = 0;
8571 -- int rc = 0;
8572 -
8573 - while (flags != 0) {
8574 - if (ARRAY_SIZE(str) <= i) {
8575 -@@ -775,66 +753,86 @@ static int ll_rd_sbi_flags(char *page, char **start, off_t off,
8576 - }
8577 -
8578 - if (flags & 0x1)
8579 -- rc += snprintf(page + rc, count - rc, "%s ", str[i]);
8580 -+ seq_printf(m, "%s ", str[i]);
8581 - flags >>= 1;
8582 - ++i;
8583 - }
8584 -- if (rc > 0)
8585 -- rc += snprintf(page + rc, count - rc, "\b\n");
8586 -- return rc;
8587 -+ seq_printf(m, "\b\n");
8588 -+ return 0;
8589 - }
8590 -+LPROC_SEQ_FOPS_RO(ll_sbi_flags);
8591 -
8592 --static int ll_rd_unstable_stats(char *page, char **start, off_t off,
8593 -- int count, int *eof, void *data)
8594 -+static int ll_unstable_stats_seq_show(struct seq_file *m, void *v)
8595 - {
8596 -- struct super_block *sb = data;
8597 -+ struct super_block *sb = m->private;
8598 - struct ll_sb_info *sbi = ll_s2sbi(sb);
8599 - struct cl_client_cache *cache = &sbi->ll_cache;
8600 -- int pages, mb, rc;
8601 -+ int pages, mb;
8602 -
8603 - pages = cfs_atomic_read(&cache->ccc_unstable_nr);
8604 - mb = (pages * PAGE_CACHE_SIZE) >> 20;
8605 -
8606 -- rc = snprintf(page, count, "unstable_pages: %8d\n"
8607 -- "unstable_mb: %8d\n", pages, mb);
8608 --
8609 -- return rc;
8610 -+ return seq_printf(m, "unstable_pages: %8d\n"
8611 -+ "unstable_mb: %8d\n", pages, mb);
8612 - }
8613 --
8614 --static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
8615 -- { "uuid", ll_rd_sb_uuid, 0, 0 },
8616 -- //{ "mntpt_path", ll_rd_path, 0, 0 },
8617 -- { "fstype", ll_rd_fstype, 0, 0 },
8618 -- { "site", ll_rd_site_stats, 0, 0 },
8619 -- { "blocksize", ll_rd_blksize, 0, 0 },
8620 -- { "kbytestotal", ll_rd_kbytestotal, 0, 0 },
8621 -- { "kbytesfree", ll_rd_kbytesfree, 0, 0 },
8622 -- { "kbytesavail", ll_rd_kbytesavail, 0, 0 },
8623 -- { "filestotal", ll_rd_filestotal, 0, 0 },
8624 -- { "filesfree", ll_rd_filesfree, 0, 0 },
8625 -- { "client_type", ll_rd_client_type, 0, 0 },
8626 -- //{ "filegroups", lprocfs_rd_filegroups, 0, 0 },
8627 -- { "max_read_ahead_mb", ll_rd_max_readahead_mb,
8628 -- ll_wr_max_readahead_mb, 0 },
8629 -- { "max_read_ahead_per_file_mb", ll_rd_max_readahead_per_file_mb,
8630 -- ll_wr_max_readahead_per_file_mb, 0 },
8631 -- { "max_read_ahead_whole_mb", ll_rd_max_read_ahead_whole_mb,
8632 -- ll_wr_max_read_ahead_whole_mb, 0 },
8633 -- { "max_cached_mb", ll_rd_max_cached_mb, ll_wr_max_cached_mb, 0 },
8634 -- { "checksum_pages", ll_rd_checksum, ll_wr_checksum, 0 },
8635 -- { "max_rw_chunk", ll_rd_max_rw_chunk, ll_wr_max_rw_chunk, 0 },
8636 -- { "stats_track_pid", ll_rd_track_pid, ll_wr_track_pid, 0 },
8637 -- { "stats_track_ppid", ll_rd_track_ppid, ll_wr_track_ppid, 0 },
8638 -- { "stats_track_gid", ll_rd_track_gid, ll_wr_track_gid, 0 },
8639 -- { "statahead_max", ll_rd_statahead_max, ll_wr_statahead_max, 0 },
8640 -- { "statahead_agl", ll_rd_statahead_agl, ll_wr_statahead_agl, 0 },
8641 -- { "statahead_stats", ll_rd_statahead_stats, 0, 0 },
8642 -- { "lazystatfs", ll_rd_lazystatfs, ll_wr_lazystatfs, 0 },
8643 -- { "max_easize", ll_rd_maxea_size, 0, 0 },
8644 -- { "sbi_flags", ll_rd_sbi_flags, 0, 0 },
8645 -- { "xattr_cache", ll_rd_xattr_cache, ll_wr_xattr_cache, 0 },
8646 -- { "unstable_stats", ll_rd_unstable_stats, 0, 0},
8647 -- { 0 }
8648 -+LPROC_SEQ_FOPS_RO(ll_unstable_stats);
8649 -+
8650 -+static struct lprocfs_seq_vars lprocfs_llite_obd_vars[] = {
8651 -+ { .name = "uuid",
8652 -+ .fops = &ll_sb_uuid_fops },
8653 -+ { .name = "fstype",
8654 -+ .fops = &ll_fstype_fops },
8655 -+ { .name = "site",
8656 -+ .fops = &ll_site_stats_fops },
8657 -+ { .name = "blocksize",
8658 -+ .fops = &ll_blksize_fops },
8659 -+ { .name = "kbytestotal",
8660 -+ .fops = &ll_kbytestotal_fops },
8661 -+ { .name = "kbytesfree",
8662 -+ .fops = &ll_kbytesfree_fops },
8663 -+ { .name = "kbytesavail",
8664 -+ .fops = &ll_kbytesavail_fops },
8665 -+ { .name = "filestotal",
8666 -+ .fops = &ll_filestotal_fops },
8667 -+ { .name = "filesfree",
8668 -+ .fops = &ll_filesfree_fops },
8669 -+ { .name = "client_type",
8670 -+ .fops = &ll_client_type_fops },
8671 -+ { .name = "max_read_ahead_mb",
8672 -+ .fops = &ll_max_readahead_mb_fops },
8673 -+ { .name = "max_read_ahead_per_file_mb",
8674 -+ .fops = &ll_max_readahead_per_file_mb_fops },
8675 -+ { .name = "max_read_ahead_whole_mb",
8676 -+ .fops = &ll_max_read_ahead_whole_mb_fops },
8677 -+ { .name = "max_cached_mb",
8678 -+ .fops = &ll_max_cached_mb_fops },
8679 -+ { .name = "checksum_pages",
8680 -+ .fops = &ll_checksum_fops },
8681 -+ { .name = "max_rw_chunk",
8682 -+ .fops = &ll_max_rw_chunk_fops },
8683 -+ { .name = "stats_track_pid",
8684 -+ .fops = &ll_track_pid_fops },
8685 -+ { .name = "stats_track_ppid",
8686 -+ .fops = &ll_track_ppid_fops },
8687 -+ { .name = "stats_track_gid",
8688 -+ .fops = &ll_track_gid_fops },
8689 -+ { .name = "statahead_max",
8690 -+ .fops = &ll_statahead_max_fops },
8691 -+ { .name = "statahead_agl",
8692 -+ .fops = &ll_statahead_agl_fops },
8693 -+ { .name = "statahead_stats",
8694 -+ .fops = &ll_statahead_stats_fops },
8695 -+ { .name = "lazystatfs",
8696 -+ .fops = &ll_lazystatfs_fops },
8697 -+ { .name = "max_easize",
8698 -+ .fops = &ll_maxea_size_fops },
8699 -+ { .name = "sbi_flags",
8700 -+ .fops = &ll_sbi_flags_fops },
8701 -+ { .name = "xattr_cache",
8702 -+ .fops = &ll_xattr_cache_fops },
8703 -+ { .name = "unstable_stats",
8704 -+ .fops = &ll_unstable_stats_fops },
8705 -+ { 0 }
8706 - };
8707 -
8708 - #define MAX_STRING_SIZE 128
8709 -@@ -924,14 +922,17 @@ static const char *ra_stat_string[] = {
8710 - [RA_STAT_WRONG_GRAB_PAGE] = "wrong page from grab_cache_page",
8711 - };
8712 -
8713 -+LPROC_SEQ_FOPS_RO_TYPE(llite, name);
8714 -+LPROC_SEQ_FOPS_RO_TYPE(llite, uuid);
8715 -
8716 - int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
8717 - struct super_block *sb, char *osc, char *mdc)
8718 - {
8719 -- struct lprocfs_vars lvars[2];
8720 -+ struct lprocfs_seq_vars lvars[2];
8721 - struct lustre_sb_info *lsi = s2lsi(sb);
8722 - struct ll_sb_info *sbi = ll_s2sbi(sb);
8723 - struct obd_device *obd;
8724 -+ struct proc_dir_entry *dir;
8725 - char name[MAX_STRING_SIZE + 1], *ptr;
8726 - int err, id, len, rc;
8727 - ENTRY;
8728 -@@ -955,7 +956,7 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
8729 - snprintf(name, MAX_STRING_SIZE, "%.*s-%p", len,
8730 - lsi->lsi_lmd->lmd_profile, sb);
8731 -
8732 -- sbi->ll_proc_root = lprocfs_register(name, parent, NULL, NULL);
8733 -+ sbi->ll_proc_root = lprocfs_seq_register(name, parent, NULL, NULL);
8734 - if (IS_ERR(sbi->ll_proc_root)) {
8735 - err = PTR_ERR(sbi->ll_proc_root);
8736 - sbi->ll_proc_root = NULL;
8737 -@@ -1020,7 +1021,7 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
8738 - GOTO(out, err);
8739 -
8740 -
8741 -- err = lprocfs_add_vars(sbi->ll_proc_root, lprocfs_llite_obd_vars, sb);
8742 -+ err = lprocfs_seq_add_vars(sbi->ll_proc_root, lprocfs_llite_obd_vars, sb);
8743 - if (err)
8744 - GOTO(out, err);
8745 -
8746 -@@ -1031,18 +1032,21 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
8747 - LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
8748 - LASSERT(obd->obd_type->typ_name != NULL);
8749 -
8750 -- snprintf(name, MAX_STRING_SIZE, "%s/common_name",
8751 -- obd->obd_type->typ_name);
8752 -- lvars[0].read_fptr = lprocfs_rd_name;
8753 -- err = lprocfs_add_vars(sbi->ll_proc_root, lvars, obd);
8754 -- if (err)
8755 -- GOTO(out, err);
8756 -+ dir = proc_mkdir(obd->obd_type->typ_name, sbi->ll_proc_root);
8757 -+ if (dir == NULL)
8758 -+ GOTO(out, err = -ENOMEM);
8759 -
8760 -- snprintf(name, MAX_STRING_SIZE, "%s/uuid", obd->obd_type->typ_name);
8761 -- lvars[0].read_fptr = lprocfs_rd_uuid;
8762 -- err = lprocfs_add_vars(sbi->ll_proc_root, lvars, obd);
8763 -- if (err)
8764 -- GOTO(out, err);
8765 -+ snprintf(name, MAX_STRING_SIZE, "common_name");
8766 -+ lvars[0].fops = &llite_name_fops;
8767 -+ err = lprocfs_seq_add_vars(dir, lvars, obd);
8768 -+ if (err)
8769 -+ GOTO(out, err);
8770 -+
8771 -+ snprintf(name, MAX_STRING_SIZE, "uuid");
8772 -+ lvars[0].fops = &llite_uuid_fops;
8773 -+ err = lprocfs_seq_add_vars(dir, lvars, obd);
8774 -+ if (err)
8775 -+ GOTO(out, err);
8776 -
8777 - /* OSC */
8778 - obd = class_name2obd(osc);
8779 -@@ -1051,16 +1055,19 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
8780 - LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
8781 - LASSERT(obd->obd_type->typ_name != NULL);
8782 -
8783 -- snprintf(name, MAX_STRING_SIZE, "%s/common_name",
8784 -- obd->obd_type->typ_name);
8785 -- lvars[0].read_fptr = lprocfs_rd_name;
8786 -- err = lprocfs_add_vars(sbi->ll_proc_root, lvars, obd);
8787 -- if (err)
8788 -- GOTO(out, err);
8789 -+ dir = proc_mkdir(obd->obd_type->typ_name, sbi->ll_proc_root);
8790 -+ if (dir == NULL)
8791 -+ GOTO(out, err = -ENOMEM);
8792 -+
8793 -+ snprintf(name, MAX_STRING_SIZE, "common_name");
8794 -+ lvars[0].fops = &llite_name_fops;
8795 -+ err = lprocfs_seq_add_vars(dir, lvars, obd);
8796 -+ if (err)
8797 -+ GOTO(out, err);
8798 -
8799 -- snprintf(name, MAX_STRING_SIZE, "%s/uuid", obd->obd_type->typ_name);
8800 -- lvars[0].read_fptr = lprocfs_rd_uuid;
8801 -- err = lprocfs_add_vars(sbi->ll_proc_root, lvars, obd);
8802 -+ snprintf(name, MAX_STRING_SIZE, "uuid");
8803 -+ lvars[0].fops = &llite_uuid_fops;
8804 -+ err = lprocfs_seq_add_vars(dir, lvars, obd);
8805 - out:
8806 - if (err) {
8807 - lprocfs_remove(&sbi->ll_proc_root);
8808 -@@ -1439,9 +1446,11 @@ static ssize_t ll_rw_offset_stats_seq_write(struct file *file, const char *buf,
8809 -
8810 - LPROC_SEQ_FOPS(ll_rw_offset_stats);
8811 -
8812 --void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars)
8813 -+int ll_process_proc_param(struct lustre_cfg *lcfg, unsigned long *sb)
8814 - {
8815 -- lvars->module_vars = NULL;
8816 -- lvars->obd_vars = lprocfs_llite_obd_vars;
8817 -+ int rc = class_process_proc_seq_param(PARAM_LLITE,
8818 -+ lprocfs_llite_obd_vars,
8819 -+ lcfg, (void *)sb);
8820 -+ return (rc > 0 ? 0 : rc);
8821 - }
8822 - #endif /* LPROCFS */
8823 -diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c
8824 -index 06b55fe..4692f6e 100644
8825 ---- a/lustre/llite/super25.c
8826 -+++ b/lustre/llite/super25.c
8827 -@@ -169,7 +169,7 @@ static int __init init_lustre_lite(void)
8828 - }
8829 -
8830 - proc_lustre_fs_root = proc_lustre_root ?
8831 -- lprocfs_register("llite", proc_lustre_root, NULL, NULL) : NULL;
8832 -+ lprocfs_seq_register("llite", proc_lustre_root, NULL, NULL) : NULL;
8833 -
8834 - lustre_register_client_fill_super(ll_fill_super);
8835 - lustre_register_kill_super_cb(ll_kill_super);
8836 -diff --git a/lustre/llite/vvp_dev.c b/lustre/llite/vvp_dev.c
8837 -index 2fdb613..fa124e2 100644
8838 ---- a/lustre/llite/vvp_dev.c
8839 -+++ b/lustre/llite/vvp_dev.c
8840 -@@ -530,10 +530,9 @@ static struct seq_operations vvp_pgcache_ops = {
8841 -
8842 - static int vvp_dump_pgcache_seq_open(struct inode *inode, struct file *filp)
8843 - {
8844 -- struct proc_dir_entry *dp = PDE(inode);
8845 -- struct ll_sb_info *sbi = dp->data;
8846 -- struct seq_file *seq;
8847 -- int result;
8848 -+ struct ll_sb_info *sbi = PDE_DATA(inode);
8849 -+ struct seq_file *seq;
8850 -+ int result;
8851 -
8852 - result = seq_open(filp, &vvp_pgcache_ops);
8853 - if (result == 0) {
8854 -diff --git a/lustre/obdclass/cl_object.c b/lustre/obdclass/cl_object.c
8855 -index 1984836..985cf0b 100644
8856 ---- a/lustre/obdclass/cl_object.c
8857 -+++ b/lustre/obdclass/cl_object.c
8858 -@@ -400,11 +400,10 @@ void cache_stats_init(struct cache_stats *cs, const char *name)
8859 - cfs_atomic_set(&cs->cs_stats[i], 0);
8860 - }
8861 -
8862 --int cache_stats_print(const struct cache_stats *cs,
8863 -- char *page, int count, int h)
8864 -+int cache_stats_print(const struct cache_stats *cs, struct seq_file *m, int h)
8865 - {
8866 -- int nob = 0;
8867 - int i;
8868 -+
8869 - /*
8870 - * lookup hit total cached create
8871 - * env: ...... ...... ...... ...... ......
8872 -@@ -412,18 +411,16 @@ int cache_stats_print(const struct cache_stats *cs,
8873 - if (h) {
8874 - const char *names[CS_NR] = CS_NAMES;
8875 -
8876 -- nob += snprintf(page + nob, count - nob, "%6s", " ");
8877 -+ seq_printf(m, "%6s", " ");
8878 - for (i = 0; i < CS_NR; i++)
8879 -- nob += snprintf(page + nob, count - nob,
8880 -- "%8s", names[i]);
8881 -- nob += snprintf(page + nob, count - nob, "\n");
8882 -+ seq_printf(m, "%8s", names[i]);
8883 -+ seq_printf(m, "\n");
8884 - }
8885 -
8886 -- nob += snprintf(page + nob, count - nob, "%5.5s:", cs->cs_name);
8887 -+ seq_printf(m, "%5.5s:", cs->cs_name);
8888 - for (i = 0; i < CS_NR; i++)
8889 -- nob += snprintf(page + nob, count - nob, "%8u",
8890 -- cfs_atomic_read(&cs->cs_stats[i]));
8891 -- return nob;
8892 -+ seq_printf(m, "%8u", cfs_atomic_read(&cs->cs_stats[i]));
8893 -+ return 0;
8894 - }
8895 -
8896 - static void cl_env_percpu_refill(void);
8897 -@@ -471,50 +468,48 @@ static struct cache_stats cl_env_stats = {
8898 - * Outputs client site statistical counters into a buffer. Suitable for
8899 - * ll_rd_*()-style functions.
8900 - */
8901 --int cl_site_stats_print(const struct cl_site *site, char *page, int count)
8902 --{
8903 -- int nob;
8904 -- int i;
8905 -- static const char *pstate[] = {
8906 -- [CPS_CACHED] = "c",
8907 -- [CPS_OWNED] = "o",
8908 -- [CPS_PAGEOUT] = "w",
8909 -- [CPS_PAGEIN] = "r",
8910 -- [CPS_FREEING] = "f"
8911 -- };
8912 -- static const char *lstate[] = {
8913 -- [CLS_NEW] = "n",
8914 -- [CLS_QUEUING] = "q",
8915 -- [CLS_ENQUEUED] = "e",
8916 -- [CLS_HELD] = "h",
8917 -- [CLS_INTRANSIT] = "t",
8918 -- [CLS_CACHED] = "c",
8919 -- [CLS_FREEING] = "f"
8920 -- };
8921 -+int cl_site_stats_print(const struct cl_site *site, struct seq_file *m)
8922 -+{
8923 -+ static const char *pstate[] = {
8924 -+ [CPS_CACHED] = "c",
8925 -+ [CPS_OWNED] = "o",
8926 -+ [CPS_PAGEOUT] = "w",
8927 -+ [CPS_PAGEIN] = "r",
8928 -+ [CPS_FREEING] = "f"
8929 -+ };
8930 -+ static const char *lstate[] = {
8931 -+ [CLS_NEW] = "n",
8932 -+ [CLS_QUEUING] = "q",
8933 -+ [CLS_ENQUEUED] = "e",
8934 -+ [CLS_HELD] = "h",
8935 -+ [CLS_INTRANSIT] = "t",
8936 -+ [CLS_CACHED] = "c",
8937 -+ [CLS_FREEING] = "f"
8938 -+ };
8939 -+ int i;
8940 -+
8941 - /*
8942 - lookup hit total busy create
8943 - pages: ...... ...... ...... ...... ...... [...... ...... ...... ......]
8944 - locks: ...... ...... ...... ...... ...... [...... ...... ...... ...... ......]
8945 - env: ...... ...... ...... ...... ......
8946 - */
8947 -- nob = lu_site_stats_print(&site->cs_lu, page, count);
8948 -- nob += cache_stats_print(&site->cs_pages, page + nob, count - nob, 1);
8949 -- nob += snprintf(page + nob, count - nob, " [");
8950 -- for (i = 0; i < ARRAY_SIZE(site->cs_pages_state); ++i)
8951 -- nob += snprintf(page + nob, count - nob, "%s: %u ",
8952 -- pstate[i],
8953 -- cfs_atomic_read(&site->cs_pages_state[i]));
8954 -- nob += snprintf(page + nob, count - nob, "]\n");
8955 -- nob += cache_stats_print(&site->cs_locks, page + nob, count - nob, 0);
8956 -- nob += snprintf(page + nob, count - nob, " [");
8957 -- for (i = 0; i < ARRAY_SIZE(site->cs_locks_state); ++i)
8958 -- nob += snprintf(page + nob, count - nob, "%s: %u ",
8959 -- lstate[i],
8960 -- cfs_atomic_read(&site->cs_locks_state[i]));
8961 -- nob += snprintf(page + nob, count - nob, "]\n");
8962 -- nob += cache_stats_print(&cl_env_stats, page + nob, count - nob, 0);
8963 -- nob += snprintf(page + nob, count - nob, "\n");
8964 -- return nob;
8965 -+ lu_site_stats_seq_print(&site->cs_lu, m);
8966 -+ cache_stats_print(&site->cs_pages, m, 1);
8967 -+ seq_printf(m, " [");
8968 -+ for (i = 0; i < ARRAY_SIZE(site->cs_pages_state); ++i)
8969 -+ seq_printf(m, "%s: %u ", pstate[i],
8970 -+ cfs_atomic_read(&site->cs_pages_state[i]));
8971 -+ seq_printf(m, "]\n");
8972 -+ cache_stats_print(&site->cs_locks, m, 0);
8973 -+ seq_printf(m, " [");
8974 -+ for (i = 0; i < ARRAY_SIZE(site->cs_locks_state); ++i)
8975 -+ seq_printf(m, "%s: %u ", lstate[i],
8976 -+ cfs_atomic_read(&site->cs_locks_state[i]));
8977 -+ seq_printf(m, "]\n");
8978 -+ cache_stats_print(&cl_env_stats, m, 0);
8979 -+ seq_printf(m, "\n");
8980 -+ return 0;
8981 - }
8982 - EXPORT_SYMBOL(cl_site_stats_print);
8983 -
8984 -diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c
8985 -index 28a18ef..cca2ec0 100644
8986 ---- a/lustre/obdclass/lu_object.c
8987 -+++ b/lustre/obdclass/lu_object.c
8988 -@@ -2090,6 +2090,28 @@ static __u32 ls_stats_read(struct lprocfs_stats *stats, int idx)
8989 - * Output site statistical counters into a buffer. Suitable for
8990 - * lprocfs_rd_*()-style functions.
8991 - */
8992 -+int lu_site_stats_seq_print(const struct lu_site *s, struct seq_file *m)
8993 -+{
8994 -+ lu_site_stats_t stats;
8995 -+
8996 -+ memset(&stats, 0, sizeof(stats));
8997 -+ lu_site_stats_get(s->ls_obj_hash, &stats, 1);
8998 -+
8999 -+ return seq_printf(m, "%d/%d %d/%d %d %d %d %d %d %d %d\n",
9000 -+ stats.lss_busy,
9001 -+ stats.lss_total,
9002 -+ stats.lss_populated,
9003 -+ CFS_HASH_NHLIST(s->ls_obj_hash),
9004 -+ stats.lss_max_search,
9005 -+ ls_stats_read(s->ls_stats, LU_SS_CREATED),
9006 -+ ls_stats_read(s->ls_stats, LU_SS_CACHE_HIT),
9007 -+ ls_stats_read(s->ls_stats, LU_SS_CACHE_MISS),
9008 -+ ls_stats_read(s->ls_stats, LU_SS_CACHE_RACE),
9009 -+ ls_stats_read(s->ls_stats, LU_SS_CACHE_DEATH_RACE),
9010 -+ ls_stats_read(s->ls_stats, LU_SS_LRU_PURGED));
9011 -+}
9012 -+EXPORT_SYMBOL(lu_site_stats_seq_print);
9013 -+
9014 - int lu_site_stats_print(const struct lu_site *s, char *page, int count)
9015 - {
9016 - lu_site_stats_t stats;
9017 ---
9018 -1.8.5.1
9019 -
9020
9021 diff --git a/sys-cluster/lustre/files/0015-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0006-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch
9022 similarity index 81%
9023 rename from sys-cluster/lustre/files/0015-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch
9024 rename to sys-cluster/lustre/files/0006-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch
9025 index 8d25476..4189564 100644
9026 --- a/sys-cluster/lustre/files/0015-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch
9027 +++ b/sys-cluster/lustre/files/0006-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch
9028 @@ -1,23 +1,23 @@
9029 -From 1537f22b9b2bc9250006805774fc300e5240c2bc Mon Sep 17 00:00:00 2001
9030 +From 0af5f0dce053b1623b18bec48731d20c0a80b7b5 Mon Sep 17 00:00:00 2001
9031 From: James Simmons <uja.ornl@×××××.com>
9032 -Date: Thu, 14 Nov 2013 19:23:09 -0500
9033 -Subject: [PATCH 15/18] LU-3319 procfs: move osp proc handling to seq_files
9034 +Date: Fri, 31 Jan 2014 12:50:59 -0500
9035 +Subject: [PATCH 06/13] LU-3319 procfs: move osp proc handling to seq_files
9036
9037 With 3.10 linux kernel and above proc handling now only
9038 uses struct seq_files. This patch migrates the osp
9039 layer proc entries over to using seq_files.
9040
9041 Signed-off-by: James Simmons <uja.ornl@×××××.com>
9042 -Change-Id: If58826e11524a5fffd2e491c1386e3795015bc7e
9043 +Change-Id: Id8f77d72fd35755f1b7b1c17fcf27e0731bd5ac1
9044 ---
9045 - lustre/osp/lproc_osp.c | 363 ++++++++++++++++++++++++----------------------
9046 + lustre/osp/lproc_osp.c | 374 ++++++++++++++++++++++++----------------------
9047 lustre/osp/lwp_dev.c | 18 +--
9048 - lustre/osp/osp_dev.c | 38 ++---
9049 + lustre/osp/osp_dev.c | 48 +++---
9050 lustre/osp/osp_internal.h | 2 -
9051 - 4 files changed, 203 insertions(+), 218 deletions(-)
9052 + 4 files changed, 223 insertions(+), 219 deletions(-)
9053
9054 diff --git a/lustre/osp/lproc_osp.c b/lustre/osp/lproc_osp.c
9055 -index 22e3372..24f2f4c 100644
9056 +index 75ebeb1..3dc5ec7 100644
9057 --- a/lustre/osp/lproc_osp.c
9058 +++ b/lustre/osp/lproc_osp.c
9059 @@ -45,24 +45,23 @@
9060 @@ -189,7 +189,7 @@ index 22e3372..24f2f4c 100644
9061 + struct obd_device *obd = m->private;
9062 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
9063
9064 - if (osp == NULL)
9065 + if (osp == NULL || osp->opd_pre == NULL)
9066 return 0;
9067
9068 - return snprintf(page, count, "%d\n", osp->opd_pre_grow_count);
9069 @@ -221,7 +221,7 @@ index 22e3372..24f2f4c 100644
9070 + struct obd_device *obd = m->private;
9071 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
9072
9073 - if (osp == NULL)
9074 + if (osp == NULL || osp->opd_pre == NULL)
9075 return 0;
9076
9077 - return snprintf(page, count, "%d\n", osp->opd_pre_max_grow_count);
9078 @@ -253,7 +253,7 @@ index 22e3372..24f2f4c 100644
9079 + struct obd_device *obd = m->private;
9080 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
9081
9082 - if (osp == NULL)
9083 + if (osp == NULL || osp->opd_pre == NULL)
9084 return 0;
9085
9086 - return snprintf(page, count, "%u\n",
9087 @@ -270,7 +270,7 @@ index 22e3372..24f2f4c 100644
9088 + struct obd_device *obd = m->private;
9089 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
9090
9091 - if (osp == NULL)
9092 + if (osp == NULL || osp->opd_pre == NULL)
9093 return 0;
9094
9095 - return snprintf(page, count, "%u\n",
9096 @@ -287,7 +287,7 @@ index 22e3372..24f2f4c 100644
9097 + struct obd_device *obd = m->private;
9098 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
9099
9100 - if (osp == NULL)
9101 + if (osp == NULL || osp->opd_pre == NULL)
9102 return 0;
9103
9104 - return snprintf(page, count, LPX64"\n",
9105 @@ -304,7 +304,7 @@ index 22e3372..24f2f4c 100644
9106 + struct obd_device *obd = m->private;
9107 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
9108
9109 - if (osp == NULL)
9110 + if (osp == NULL || osp->opd_pre == NULL)
9111 return 0;
9112
9113 - return snprintf(page, count, LPX64"\n",
9114 @@ -321,7 +321,7 @@ index 22e3372..24f2f4c 100644
9115 + struct obd_device *obd = m->private;
9116 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
9117
9118 - if (osp == NULL)
9119 + if (osp == NULL || osp->opd_pre == NULL)
9120 return 0;
9121
9122 - return snprintf(page, count, LPU64"\n", osp->opd_pre_reserved);
9123 @@ -372,7 +372,7 @@ index 22e3372..24f2f4c 100644
9124 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
9125 - int rc;
9126
9127 - if (osp == NULL)
9128 + if (osp == NULL || osp->opd_pre == NULL)
9129 return -EINVAL;
9130
9131 - rc = snprintf(page, count, "%d\n", osp->opd_pre_status);
9132 @@ -390,7 +390,7 @@ index 22e3372..24f2f4c 100644
9133 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
9134
9135 if (osp == NULL)
9136 -@@ -411,87 +398,94 @@ static int osp_rd_destroys_in_flight(char *page, char **start, off_t off,
9137 +@@ -411,87 +398,126 @@ static int osp_rd_destroys_in_flight(char *page, char **start, off_t off,
9138 * - sync changes are zero - no llog records
9139 * - sync in progress are zero - no RPCs in flight
9140 */
9141 @@ -468,30 +468,55 @@ index 22e3372..24f2f4c 100644
9142 +LPROC_SEQ_FOPS_RO_TYPE(osp, state);
9143 +
9144 +static struct lprocfs_seq_vars lprocfs_osp_obd_vars[] = {
9145 -+ { "uuid", &osp_uuid_fops },
9146 -+ { "ping", &osp_ping_fops, 0, 0222 },
9147 -+ { "connect_flags", &osp_connect_flags_fops },
9148 -+ { "ost_server_uuid", &osp_server_uuid_fops },
9149 -+ { "ost_conn_uuid", &osp_conn_uuid_fops },
9150 -+ { "active", &osp_active_fops },
9151 -+ { "max_rpcs_in_flight", &osp_max_rpcs_in_flight_fops },
9152 -+ { "max_rpcs_in_progress", &osp_max_rpcs_in_prog_fops },
9153 -+ { "create_count", &osp_create_count_fops },
9154 -+ { "max_create_count", &osp_max_create_count_fops },
9155 -+ { "prealloc_next_id", &osp_prealloc_next_id_fops },
9156 -+ { "prealloc_next_seq", &osp_prealloc_next_seq_fops },
9157 -+ { "prealloc_last_id", &osp_prealloc_last_id_fops },
9158 -+ { "prealloc_last_seq", &osp_prealloc_last_seq_fops },
9159 -+ { "prealloc_reserved", &osp_prealloc_reserved_fops },
9160 -+ { "timeouts", &osp_timeouts_fops },
9161 -+ { "import", &osp_import_fops },
9162 -+ { "state", &osp_state_fops },
9163 -+ { "maxage", &osp_maxage_fops },
9164 -+ { "prealloc_status", &osp_pre_status_fops },
9165 -+ { "sync_changes", &osp_syn_changes_fops },
9166 -+ { "sync_in_flight", &osp_syn_in_flight_fops },
9167 -+ { "sync_in_progress", &osp_syn_in_prog_fops },
9168 -+ { "old_sync_processed", &osp_old_sync_processed_fops },
9169 ++ { .name = "uuid",
9170 ++ .fops = &osp_uuid_fops },
9171 ++ { .name = "ping",
9172 ++ .fops = &osp_ping_fops,
9173 ++ .proc_mode = 0222 },
9174 ++ { .name = "connect_flags",
9175 ++ .fops = &osp_connect_flags_fops },
9176 ++ { .name = "ost_server_uuid",
9177 ++ .fops = &osp_server_uuid_fops },
9178 ++ { .name = "ost_conn_uuid",
9179 ++ .fops = &osp_conn_uuid_fops },
9180 ++ { .name = "active",
9181 ++ .fops = &osp_active_fops },
9182 ++ { .name = "max_rpcs_in_flight",
9183 ++ .fops = &osp_max_rpcs_in_flight_fops },
9184 ++ { .name = "max_rpcs_in_progress",
9185 ++ .fops = &osp_max_rpcs_in_prog_fops },
9186 ++ { .name = "create_count",
9187 ++ .fops = &osp_create_count_fops },
9188 ++ { .name = "max_create_count",
9189 ++ .fops = &osp_max_create_count_fops },
9190 ++ { .name = "prealloc_next_id",
9191 ++ .fops = &osp_prealloc_next_id_fops },
9192 ++ { .name = "prealloc_next_seq",
9193 ++ .fops = &osp_prealloc_next_seq_fops },
9194 ++ { .name = "prealloc_last_id",
9195 ++ .fops = &osp_prealloc_last_id_fops },
9196 ++ { .name = "prealloc_last_seq",
9197 ++ .fops = &osp_prealloc_last_seq_fops },
9198 ++ { .name = "prealloc_reserved",
9199 ++ .fops = &osp_prealloc_reserved_fops },
9200 ++ { .name = "timeouts",
9201 ++ .fops = &osp_timeouts_fops },
9202 ++ { .name = "import",
9203 ++ .fops = &osp_import_fops },
9204 ++ { .name = "state",
9205 ++ .fops = &osp_state_fops },
9206 ++ { .name = "maxage",
9207 ++ .fops = &osp_maxage_fops },
9208 ++ { .name = "prealloc_status",
9209 ++ .fops = &osp_pre_status_fops },
9210 ++ { .name = "sync_changes",
9211 ++ .fops = &osp_syn_changes_fops },
9212 ++ { .name = "sync_in_flight",
9213 ++ .fops = &osp_syn_in_flight_fops },
9214 ++ { .name = "sync_in_progress",
9215 ++ .fops = &osp_syn_in_prog_fops },
9216 ++ { .name = "old_sync_processed",
9217 ++ .fops = &osp_old_sync_processed_fops },
9218
9219 -static struct lprocfs_vars lprocfs_osp_osd_vars[] = {
9220 - { "blocksize", lprocfs_dt_rd_blksize, 0, 0 },
9221 @@ -501,7 +526,8 @@ index 22e3372..24f2f4c 100644
9222 - { "filestotal", lprocfs_dt_rd_filestotal, 0, 0 },
9223 - { "filesfree", lprocfs_dt_rd_filesfree, 0, 0 },
9224 + /* for compatibility reasons */
9225 -+ { "destroys_in_flight", &osp_destroys_in_flight_fops },
9226 ++ { .name = "destroys_in_flight",
9227 ++ .fops = &osp_destroys_in_flight_fops },
9228 { 0 }
9229 };
9230
9231 @@ -515,12 +541,18 @@ index 22e3372..24f2f4c 100644
9232 +LPROC_SEQ_FOPS_RO_TYPE(osp, dt_filesfree);
9233 +
9234 +static struct lprocfs_seq_vars lprocfs_osp_osd_vars[] = {
9235 -+ { "blocksize", &osp_dt_blksize_fops },
9236 -+ { "kbytestotal", &osp_dt_kbytestotal_fops },
9237 -+ { "kbytesfree", &osp_dt_kbytesfree_fops },
9238 -+ { "kbytesavail", &osp_dt_kbytesavail_fops },
9239 -+ { "filestotal", &osp_dt_filestotal_fops },
9240 -+ { "filesfree", &osp_dt_filesfree_fops },
9241 ++ { .name = "blocksize",
9242 ++ .fops = &osp_dt_blksize_fops },
9243 ++ { .name = "kbytestotal",
9244 ++ .fops = &osp_dt_kbytestotal_fops },
9245 ++ { .name = "kbytesfree",
9246 ++ .fops = &osp_dt_kbytesfree_fops },
9247 ++ { .name = "kbytesavail",
9248 ++ .fops = &osp_dt_kbytesavail_fops },
9249 ++ { .name = "filestotal",
9250 ++ .fops = &osp_dt_filestotal_fops },
9251 ++ { .name = "filesfree",
9252 ++ .fops = &osp_dt_filesfree_fops },
9253 { 0 }
9254 };
9255
9256 @@ -533,7 +565,8 @@ index 22e3372..24f2f4c 100644
9257 void osp_lprocfs_init(struct osp_device *osp)
9258 {
9259 struct obd_device *obd = osp->opd_obd;
9260 - struct proc_dir_entry *osc_proc_dir;
9261 +- struct proc_dir_entry *osc_proc_dir;
9262 ++ struct proc_dir_entry *symlink = NULL;
9263 int rc;
9264
9265 - obd->obd_proc_entry = lprocfs_register(obd->obd_name,
9266 @@ -541,7 +574,7 @@ index 22e3372..24f2f4c 100644
9267 obd->obd_type->typ_procroot,
9268 lprocfs_osp_osd_vars,
9269 &osp->opd_dt_dev);
9270 -@@ -502,7 +496,7 @@ void osp_lprocfs_init(struct osp_device *osp)
9271 +@@ -502,34 +528,30 @@ void osp_lprocfs_init(struct osp_device *osp)
9272 return;
9273 }
9274
9275 @@ -550,11 +583,14 @@ index 22e3372..24f2f4c 100644
9276 if (rc) {
9277 CERROR("%s: can't register in lprocfs: %ld\n",
9278 obd->obd_name, PTR_ERR(obd->obd_proc_entry));
9279 -@@ -511,24 +505,47 @@ void osp_lprocfs_init(struct osp_device *osp)
9280 + return;
9281 + }
9282 ++ obd->obd_vars = lprocfs_osp_obd_vars;
9283
9284 ptlrpc_lprocfs_register_obd(obd);
9285
9286 -+ if (osp->opd_connect_mdt)
9287 ++ if (osp->opd_connect_mdt || obd->obd_type->typ_procsym == NULL ||
9288 ++ !strstr(obd->obd_name, "osc"))
9289 + return;
9290 +
9291 /* for compatibility we link old procfs's OSC entries to osp ones */
9292 @@ -573,52 +609,26 @@ index 22e3372..24f2f4c 100644
9293 - symlink = lprocfs_add_symlink(name,
9294 - osc_proc_dir, "../osp/%s",
9295 - obd->obd_name);
9296 -+ osc_proc_dir = obd->obd_proc_private;
9297 -+ if (osc_proc_dir == NULL) {
9298 -+ cfs_proc_dir_entry_t *symlink = NULL;
9299 -+ struct obd_type *type;
9300 -+ char *name;
9301 -+
9302 -+ type = class_search_type(LUSTRE_OSC_NAME);
9303 -+ if (type == NULL) {
9304 -+ osc_proc_dir = lprocfs_seq_register("osc",
9305 -+ proc_lustre_root,
9306 -+ NULL, NULL);
9307 -+ if (IS_ERR(osc_proc_dir))
9308 -+ CERROR("osp: can't create compat entry \"osc\": %d\n",
9309 -+ (int) PTR_ERR(osc_proc_dir));
9310 -+ } else {
9311 -+ osc_proc_dir = type->typ_procroot;
9312 -+ }
9313 -+
9314 -+ OBD_ALLOC(name, strlen(obd->obd_name) + 1);
9315 -+ if (name == NULL)
9316 -+ return;
9317 -+
9318 -+ strcpy(name, obd->obd_name);
9319 -+ if (strstr(name, "osc")) {
9320 -+ symlink = lprocfs_add_symlink(name, osc_proc_dir,
9321 -+ "../osp/%s",
9322 -+ obd->obd_name);
9323 - OBD_FREE(name, strlen(obd->obd_name) + 1);
9324 +- OBD_FREE(name, strlen(obd->obd_name) + 1);
9325 - osp->opd_symlink = symlink;
9326 -+ if (symlink == NULL) {
9327 -+ CERROR("could not register OSC symlink for "
9328 -+ "/proc/fs/lustre/osp/%s.",
9329 -+ obd->obd_name);
9330 -+ lprocfs_remove(&osc_proc_dir);
9331 -+ } else {
9332 -+ osp->opd_symlink = symlink;
9333 -+ obd->obd_proc_private = osc_proc_dir;
9334 -+ }
9335 - }
9336 +- }
9337 ++ symlink = lprocfs_add_symlink(obd->obd_name, obd->obd_type->typ_procsym,
9338 ++ "../osp/%s", obd->obd_name);
9339 ++ if (symlink == NULL) {
9340 ++ CERROR("could not register OSC symlink for "
9341 ++ "/proc/fs/lustre/osp/%s.", obd->obd_name);
9342 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
9343 ++ obd->obd_type->typ_procsym = NULL;
9344 ++ } else {
9345 ++ osp->opd_symlink = symlink;
9346 }
9347 }
9348 +
9349 diff --git a/lustre/osp/lwp_dev.c b/lustre/osp/lwp_dev.c
9350 -index fce82a2..755c096 100644
9351 +index 9560504..d6ae965 100644
9352 --- a/lustre/osp/lwp_dev.c
9353 +++ b/lustre/osp/lwp_dev.c
9354 -@@ -210,25 +210,13 @@ const struct lu_device_operations lwp_lu_ops = {
9355 +@@ -186,25 +186,13 @@ const struct lu_device_operations lwp_lu_ops = {
9356 .ldo_process_config = lwp_process_config,
9357 };
9358
9359 @@ -645,7 +655,7 @@ index fce82a2..755c096 100644
9360 int rc;
9361 ENTRY;
9362
9363 -@@ -257,8 +245,8 @@ int lwp_init0(const struct lu_env *env, struct lwp_device *lwp,
9364 +@@ -233,8 +221,8 @@ int lwp_init0(const struct lu_env *env, struct lwp_device *lwp,
9365 RETURN(rc);
9366 }
9367
9368 @@ -657,7 +667,7 @@ index fce82a2..755c096 100644
9369
9370 RETURN(0);
9371 diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c
9372 -index 096de6a..780276d 100644
9373 +index 5828d88..7d45fa1 100644
9374 --- a/lustre/osp/osp_dev.c
9375 +++ b/lustre/osp/osp_dev.c
9376 @@ -371,7 +371,7 @@ static int osp_process_config(const struct lu_env *env,
9377 @@ -684,23 +694,24 @@ index 096de6a..780276d 100644
9378 if (rc > 0)
9379 rc = 0;
9380 if (rc == -ENOSYS) {
9381 -@@ -837,6 +835,9 @@ static struct lu_device *osp_device_fini(const struct lu_env *env,
9382 +@@ -842,6 +840,9 @@ static struct lu_device *osp_device_fini(const struct lu_env *env,
9383 OBD_FREE_PTR(cli->cl_rpc_lock);
9384 cli->cl_rpc_lock = NULL;
9385 }
9386 + } else {
9387 -+ if (m->opd_obd->obd_proc_private != NULL)
9388 -+ lprocfs_remove((struct proc_dir_entry **)&m->opd_obd->obd_proc_private);
9389 ++ if (m->opd_obd->obd_type->typ_procsym != NULL)
9390 ++ lprocfs_remove(&m->opd_obd->obd_type->typ_procsym);
9391 }
9392
9393 rc = client_obd_cleanup(m->opd_obd);
9394 -@@ -1188,33 +1189,25 @@ struct llog_operations osp_mds_ost_orig_logops;
9395 +@@ -1220,33 +1221,26 @@ struct llog_operations osp_mds_ost_orig_logops;
9396
9397 static int __init osp_mod_init(void)
9398 {
9399 - struct lprocfs_static_vars lvars;
9400 - cfs_proc_dir_entry_t *osc_proc_dir;
9401 - int rc;
9402 ++ struct obd_type *type;
9403 + int rc;
9404
9405 rc = lu_kmem_init(osp_caches);
9406 @@ -731,11 +742,10 @@ index 096de6a..780276d 100644
9407 #endif
9408 LUSTRE_LWP_NAME, &lwp_device_type);
9409 if (rc != 0) {
9410 -@@ -1227,22 +1220,11 @@ static int __init osp_mod_init(void)
9411 - osp_mds_ost_orig_logops = llog_osd_ops;
9412 +@@ -1260,21 +1254,23 @@ static int __init osp_mod_init(void)
9413 osp_mds_ost_orig_logops.lop_add = llog_cat_add_rec;
9414 osp_mds_ost_orig_logops.lop_declare_add = llog_cat_declare_add_rec;
9415 --
9416 +
9417 - osc_proc_dir = lprocfs_srch(proc_lustre_root, "osc");
9418 - if (osc_proc_dir == NULL) {
9419 - osc_proc_dir = lprocfs_register("osc", proc_lustre_root, NULL,
9420 @@ -743,7 +753,18 @@ index 096de6a..780276d 100644
9421 - if (IS_ERR(osc_proc_dir))
9422 - CERROR("osp: can't create compat entry \"osc\": %d\n",
9423 - (int) PTR_ERR(osc_proc_dir));
9424 -- }
9425 ++ type = class_search_type(LUSTRE_OSC_NAME);
9426 ++ if (type)
9427 ++ return rc;
9428 ++
9429 ++ type = class_search_type(LUSTRE_OSP_NAME);
9430 ++ type->typ_procsym = lprocfs_seq_register("osc", proc_lustre_root,
9431 ++ NULL, NULL);
9432 ++ if (IS_ERR(type->typ_procsym)) {
9433 ++ CERROR("osp: can't create compat entry \"osc\": %d\n",
9434 ++ (int) PTR_ERR(type->typ_procsym));
9435 ++ type->typ_procsym = NULL;
9436 + }
9437 return rc;
9438 }
9439
9440 @@ -755,18 +776,18 @@ index 096de6a..780276d 100644
9441 class_unregister_type(LUSTRE_OSP_NAME);
9442 lu_kmem_fini(osp_caches);
9443 diff --git a/lustre/osp/osp_internal.h b/lustre/osp/osp_internal.h
9444 -index 92c7b72..fe8b57e 100644
9445 +index 0871d8d..0cc608b 100644
9446 --- a/lustre/osp/osp_internal.h
9447 +++ b/lustre/osp/osp_internal.h
9448 -@@ -415,7 +415,6 @@ int osp_write_last_oid_seq_files(struct lu_env *env, struct osp_device *osp,
9449 - struct lu_fid *fid, int sync);
9450 +@@ -433,7 +433,6 @@ int osp_write_last_oid_seq_files(struct lu_env *env, struct osp_device *osp,
9451 + int osp_init_pre_fid(struct osp_device *osp);
9452
9453 /* lproc_osp.c */
9454 -void lprocfs_osp_init_vars(struct lprocfs_static_vars *lvars);
9455 void osp_lprocfs_init(struct osp_device *osp);
9456
9457 /* osp_sync.c */
9458 -@@ -429,7 +428,6 @@ int osp_sync_fini(struct osp_device *d);
9459 +@@ -447,7 +446,6 @@ int osp_sync_fini(struct osp_device *d);
9460 void __osp_sync_check_for_work(struct osp_device *d);
9461
9462 /* lwp_dev.c */
9463 @@ -775,5 +796,5 @@ index 92c7b72..fe8b57e 100644
9464 extern struct lu_device_type lwp_device_type;
9465
9466 --
9467 -1.8.5.1
9468 +1.8.5.3
9469
9470
9471 diff --git a/sys-cluster/lustre/files/0007-LU-3319-procfs-move-lmv-proc-handling-over-to-seq_fi.patch b/sys-cluster/lustre/files/0007-LU-3319-procfs-move-lmv-proc-handling-over-to-seq_fi.patch
9472 deleted file mode 100644
9473 index 0fee4ee..0000000
9474 --- a/sys-cluster/lustre/files/0007-LU-3319-procfs-move-lmv-proc-handling-over-to-seq_fi.patch
9475 +++ /dev/null
9476 @@ -1,409 +0,0 @@
9477 -From 4169735b41f2452d884e24c92581af0c4fbf6121 Mon Sep 17 00:00:00 2001
9478 -From: James Simmons <uja.ornl@×××××.com>
9479 -Date: Thu, 14 Nov 2013 09:32:29 -0500
9480 -Subject: [PATCH 07/18] LU-3319 procfs: move lmv proc handling over to seq_file
9481 -
9482 -In order to support 3.10+ kernels for clients we adapt
9483 -the lmv proc handling to using seq_files.
9484 -
9485 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
9486 -Change-Id: I34f58c3a484ee79b41b59d4a60f6a21726373152
9487 ----
9488 - lustre/lmv/lmv_internal.h | 7 +--
9489 - lustre/lmv/lmv_obd.c | 138 ++++++++++++++++++++--------------------------
9490 - lustre/lmv/lproc_lmv.c | 78 ++++++++++----------------
9491 - 3 files changed, 91 insertions(+), 132 deletions(-)
9492 -
9493 -diff --git a/lustre/lmv/lmv_internal.h b/lustre/lmv/lmv_internal.h
9494 -index 15692c5..1d027d7 100644
9495 ---- a/lustre/lmv/lmv_internal.h
9496 -+++ b/lustre/lmv/lmv_internal.h
9497 -@@ -147,12 +147,7 @@ struct lmv_tgt_desc
9498 - struct lu_fid *fid);
9499 - /* lproc_lmv.c */
9500 - #ifdef LPROCFS
9501 --void lprocfs_lmv_init_vars(struct lprocfs_static_vars *lvars);
9502 --#else
9503 --static inline void lprocfs_lmv_init_vars(struct lprocfs_static_vars *lvars)
9504 --{
9505 -- memset(lvars, 0, sizeof(*lvars));
9506 --}
9507 -+extern struct lprocfs_seq_vars lprocfs_lmv_obd_vars[];
9508 - #endif
9509 - extern struct file_operations lmv_proc_target_fops;
9510 -
9511 -diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c
9512 -index 56d6e20..888a86f 100644
9513 ---- a/lustre/lmv/lmv_obd.c
9514 -+++ b/lustre/lmv/lmv_obd.c
9515 -@@ -239,13 +239,19 @@ static int lmv_connect(const struct lu_env *env,
9516 - lmv->conn_data = *data;
9517 -
9518 - #ifdef __KERNEL__
9519 -- lmv_proc_dir = lprocfs_register("target_obds", obd->obd_proc_entry,
9520 -- NULL, NULL);
9521 -- if (IS_ERR(lmv_proc_dir)) {
9522 -- CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.",
9523 -- obd->obd_type->typ_name, obd->obd_name);
9524 -- lmv_proc_dir = NULL;
9525 -- }
9526 -+ if (obd->obd_proc_private != NULL) {
9527 -+ lmv_proc_dir = obd->obd_proc_private;
9528 -+ } else {
9529 -+ lmv_proc_dir = lprocfs_seq_register("target_obds",
9530 -+ obd->obd_proc_entry,
9531 -+ NULL, NULL);
9532 -+ if (IS_ERR(lmv_proc_dir)) {
9533 -+ CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.",
9534 -+ obd->obd_type->typ_name, obd->obd_name);
9535 -+ lmv_proc_dir = NULL;
9536 -+ }
9537 -+ obd->obd_proc_private = lmv_proc_dir;
9538 -+ }
9539 - #endif
9540 -
9541 - /*
9542 -@@ -258,12 +264,11 @@ static int lmv_connect(const struct lu_env *env,
9543 - rc = lmv_check_connect(obd);
9544 -
9545 - #ifdef __KERNEL__
9546 -- if (rc) {
9547 -- if (lmv_proc_dir)
9548 -- lprocfs_remove(&lmv_proc_dir);
9549 -- }
9550 -+ if (rc && lmv_proc_dir) {
9551 -+ lprocfs_remove(&lmv_proc_dir);
9552 -+ obd->obd_proc_private = NULL;
9553 -+ }
9554 - #endif
9555 --
9556 - RETURN(rc);
9557 - }
9558 -
9559 -@@ -423,28 +428,28 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
9560 - cfs_atomic_read(&obd->obd_refcount));
9561 -
9562 - #ifdef __KERNEL__
9563 -- lmv_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
9564 -- if (lmv_proc_dir) {
9565 -- struct proc_dir_entry *mdc_symlink;
9566 --
9567 -- LASSERT(mdc_obd->obd_type != NULL);
9568 -- LASSERT(mdc_obd->obd_type->typ_name != NULL);
9569 -- mdc_symlink = lprocfs_add_symlink(mdc_obd->obd_name,
9570 -- lmv_proc_dir,
9571 -- "../../../%s/%s",
9572 -- mdc_obd->obd_type->typ_name,
9573 -- mdc_obd->obd_name);
9574 -- if (mdc_symlink == NULL) {
9575 -- CERROR("Could not register LMV target "
9576 -- "/proc/fs/lustre/%s/%s/target_obds/%s.",
9577 -- obd->obd_type->typ_name, obd->obd_name,
9578 -- mdc_obd->obd_name);
9579 -- lprocfs_remove(&lmv_proc_dir);
9580 -- lmv_proc_dir = NULL;
9581 -- }
9582 -- }
9583 -+ lmv_proc_dir = obd->obd_proc_private;
9584 -+ if (lmv_proc_dir) {
9585 -+ struct proc_dir_entry *mdc_symlink;
9586 -+
9587 -+ LASSERT(mdc_obd->obd_type != NULL);
9588 -+ LASSERT(mdc_obd->obd_type->typ_name != NULL);
9589 -+ mdc_symlink = lprocfs_add_symlink(mdc_obd->obd_name,
9590 -+ lmv_proc_dir,
9591 -+ "../../../%s/%s",
9592 -+ mdc_obd->obd_type->typ_name,
9593 -+ mdc_obd->obd_name);
9594 -+ if (mdc_symlink == NULL) {
9595 -+ CERROR("Could not register LMV target "
9596 -+ "/proc/fs/lustre/%s/%s/target_obds/%s.",
9597 -+ obd->obd_type->typ_name, obd->obd_name,
9598 -+ mdc_obd->obd_name);
9599 -+ lprocfs_remove(&lmv_proc_dir);
9600 -+ obd->obd_proc_private = NULL;
9601 -+ }
9602 -+ }
9603 - #endif
9604 -- RETURN(0);
9605 -+ RETURN(0);
9606 - }
9607 -
9608 - static void lmv_del_target(struct lmv_obd *lmv, int index)
9609 -@@ -652,19 +657,9 @@ static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
9610 - }
9611 -
9612 - #ifdef __KERNEL__
9613 -- lmv_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
9614 -- if (lmv_proc_dir) {
9615 -- struct proc_dir_entry *mdc_symlink;
9616 --
9617 -- mdc_symlink = lprocfs_srch(lmv_proc_dir, mdc_obd->obd_name);
9618 -- if (mdc_symlink) {
9619 -- lprocfs_remove(&mdc_symlink);
9620 -- } else {
9621 -- CERROR("/proc/fs/lustre/%s/%s/target_obds/%s missing\n",
9622 -- obd->obd_type->typ_name, obd->obd_name,
9623 -- mdc_obd->obd_name);
9624 -- }
9625 -- }
9626 -+ lmv_proc_dir = obd->obd_proc_private;
9627 -+ if (lmv_proc_dir)
9628 -+ lprocfs_remove_proc_entry(mdc_obd->obd_name, lmv_proc_dir);
9629 - #endif
9630 - rc = obd_fid_fini(tgt->ltd_exp->exp_obd);
9631 - if (rc)
9632 -@@ -691,9 +686,6 @@ static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
9633 - static int lmv_disconnect(struct obd_export *exp)
9634 - {
9635 - struct obd_device *obd = class_exp2obd(exp);
9636 --#ifdef __KERNEL__
9637 -- struct proc_dir_entry *lmv_proc_dir;
9638 --#endif
9639 - struct lmv_obd *lmv = &obd->u.lmv;
9640 - int rc;
9641 - __u32 i;
9642 -@@ -717,13 +709,11 @@ static int lmv_disconnect(struct obd_export *exp)
9643 - }
9644 -
9645 - #ifdef __KERNEL__
9646 -- lmv_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
9647 -- if (lmv_proc_dir) {
9648 -- lprocfs_remove(&lmv_proc_dir);
9649 -- } else {
9650 -- CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n",
9651 -- obd->obd_type->typ_name, obd->obd_name);
9652 -- }
9653 -+ if (obd->obd_proc_private)
9654 -+ lprocfs_remove((struct proc_dir_entry **)&obd->obd_proc_private);
9655 -+ else
9656 -+ CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n",
9657 -+ obd->obd_type->typ_name, obd->obd_name);
9658 - #endif
9659 -
9660 - out_local:
9661 -@@ -1383,11 +1373,10 @@ int lmv_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
9662 -
9663 - static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
9664 - {
9665 -- struct lmv_obd *lmv = &obd->u.lmv;
9666 -- struct lprocfs_static_vars lvars;
9667 -- struct lmv_desc *desc;
9668 -- int rc;
9669 -- ENTRY;
9670 -+ struct lmv_obd *lmv = &obd->u.lmv;
9671 -+ struct lmv_desc *desc;
9672 -+ int rc;
9673 -+ ENTRY;
9674 -
9675 - if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1) {
9676 - CERROR("LMV setup requires a descriptor\n");
9677 -@@ -1417,18 +1406,15 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
9678 - spin_lock_init(&lmv->lmv_lock);
9679 - mutex_init(&lmv->init_mutex);
9680 -
9681 -- lprocfs_lmv_init_vars(&lvars);
9682 --
9683 -- lprocfs_obd_setup(obd, lvars.obd_vars);
9684 -- lprocfs_alloc_md_stats(obd, 0);
9685 - #ifdef LPROCFS
9686 -- {
9687 -- rc = lprocfs_seq_create(obd->obd_proc_entry, "target_obd",
9688 -- 0444, &lmv_proc_target_fops, obd);
9689 -- if (rc)
9690 -- CWARN("%s: error adding LMV target_obd file: rc = %d\n",
9691 -- obd->obd_name, rc);
9692 -- }
9693 -+ obd->obd_vars = lprocfs_lmv_obd_vars;
9694 -+ lprocfs_seq_obd_setup(obd);
9695 -+ lprocfs_alloc_md_stats(obd, 0);
9696 -+ rc = lprocfs_seq_create(obd->obd_proc_entry, "target_obd",
9697 -+ 0444, &lmv_proc_target_fops, obd);
9698 -+ if (rc)
9699 -+ CWARN("%s: error adding LMV target_obd file: rc = %d\n",
9700 -+ obd->obd_name, rc);
9701 - #endif
9702 - rc = fld_client_init(&lmv->lmv_fld, obd->obd_name,
9703 - LUSTRE_CLI_FLD_HASH_DHT);
9704 -@@ -2477,7 +2463,7 @@ int lmv_set_info_async(const struct lu_env *env, struct obd_export *exp,
9705 - obd_count keylen, void *key, obd_count vallen,
9706 - void *val, struct ptlrpc_request_set *set)
9707 - {
9708 -- struct lmv_tgt_desc *tgt;
9709 -+ struct lmv_tgt_desc *tgt = NULL;
9710 - struct obd_device *obd;
9711 - struct lmv_obd *lmv;
9712 - int rc = 0;
9713 -@@ -2982,13 +2968,9 @@ struct md_ops lmv_md_ops = {
9714 -
9715 - int __init lmv_init(void)
9716 - {
9717 -- struct lprocfs_static_vars lvars;
9718 --
9719 -- lprocfs_lmv_init_vars(&lvars);
9720 --
9721 - return class_register_type(&lmv_obd_ops, &lmv_md_ops, NULL,
9722 - #ifndef HAVE_ONLY_PROCFS_SEQ
9723 -- lvars.module_vars,
9724 -+ NULL,
9725 - #endif
9726 - LUSTRE_LMV_NAME, NULL);
9727 - }
9728 -diff --git a/lustre/lmv/lproc_lmv.c b/lustre/lmv/lproc_lmv.c
9729 -index 6a3b128..eea5927 100644
9730 ---- a/lustre/lmv/lproc_lmv.c
9731 -+++ b/lustre/lmv/lproc_lmv.c
9732 -@@ -46,18 +46,16 @@
9733 - static struct lprocfs_vars lprocfs_module_vars[] = { {0} };
9734 - static struct lprocfs_vars lprocfs_obd_vars[] = { {0} };
9735 - #else
9736 --static int lmv_rd_numobd(char *page, char **start, off_t off, int count,
9737 -- int *eof, void *data)
9738 -+static int lmv_numobd_seq_show(struct seq_file *m, void *v)
9739 - {
9740 -- struct obd_device *dev = (struct obd_device*)data;
9741 -+ struct obd_device *dev = (struct obd_device *)m->private;
9742 - struct lmv_desc *desc;
9743 -
9744 - LASSERT(dev != NULL);
9745 - desc = &dev->u.lmv.desc;
9746 -- *eof = 1;
9747 -- return snprintf(page, count, "%u\n", desc->ld_tgt_count);
9748 --
9749 -+ return seq_printf(m, "%u\n", desc->ld_tgt_count);
9750 - }
9751 -+LPROC_SEQ_FOPS_RO(lmv_numobd);
9752 -
9753 - static const char *placement_name[] = {
9754 - [PLACEMENT_CHAR_POLICY] = "CHAR",
9755 -@@ -82,26 +80,22 @@ static const char *placement_policy2name(placement_policy_t placement)
9756 - return placement_name[placement];
9757 - }
9758 -
9759 --static int lmv_rd_placement(char *page, char **start, off_t off, int count,
9760 -- int *eof, void *data)
9761 -+static int lmv_placement_seq_show(struct seq_file *m, void *v)
9762 - {
9763 -- struct obd_device *dev = (struct obd_device*)data;
9764 -+ struct obd_device *dev = (struct obd_device *)m->private;
9765 - struct lmv_obd *lmv;
9766 -
9767 - LASSERT(dev != NULL);
9768 - lmv = &dev->u.lmv;
9769 -- *eof = 1;
9770 -- return snprintf(page, count, "%s\n",
9771 -- placement_policy2name(lmv->lmv_placement));
9772 --
9773 -+ return seq_printf(m, "%s\n", placement_policy2name(lmv->lmv_placement));
9774 - }
9775 -
9776 - #define MAX_POLICY_STRING_SIZE 64
9777 -
9778 --static int lmv_wr_placement(struct file *file, const char *buffer,
9779 -- unsigned long count, void *data)
9780 -+static ssize_t lmv_placement_seq_write(struct file *file, const char *buffer,
9781 -+ size_t count, loff_t *off)
9782 - {
9783 -- struct obd_device *dev = (struct obd_device *)data;
9784 -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
9785 - char dummy[MAX_POLICY_STRING_SIZE + 1];
9786 - int len = count;
9787 - placement_policy_t policy;
9788 -@@ -131,30 +125,29 @@ static int lmv_wr_placement(struct file *file, const char *buffer,
9789 - }
9790 - return count;
9791 - }
9792 -+LPROC_SEQ_FOPS(lmv_placement);
9793 -
9794 --static int lmv_rd_activeobd(char *page, char **start, off_t off, int count,
9795 -- int *eof, void *data)
9796 -+static int lmv_activeobd_seq_show(struct seq_file *m, void *v)
9797 - {
9798 -- struct obd_device *dev = (struct obd_device*)data;
9799 -+ struct obd_device *dev = (struct obd_device *)m->private;
9800 - struct lmv_desc *desc;
9801 -
9802 - LASSERT(dev != NULL);
9803 - desc = &dev->u.lmv.desc;
9804 -- *eof = 1;
9805 -- return snprintf(page, count, "%u\n", desc->ld_active_tgt_count);
9806 -+ return seq_printf(m, "%u\n", desc->ld_active_tgt_count);
9807 - }
9808 -+LPROC_SEQ_FOPS_RO(lmv_activeobd);
9809 -
9810 --static int lmv_rd_desc_uuid(char *page, char **start, off_t off, int count,
9811 -- int *eof, void *data)
9812 -+static int lmv_desc_uuid_seq_show(struct seq_file *m, void *v)
9813 - {
9814 -- struct obd_device *dev = (struct obd_device*) data;
9815 -+ struct obd_device *dev = (struct obd_device*)m->private;
9816 - struct lmv_obd *lmv;
9817 -
9818 - LASSERT(dev != NULL);
9819 - lmv = &dev->u.lmv;
9820 -- *eof = 1;
9821 -- return snprintf(page, count, "%s\n", lmv->desc.ld_uuid.uuid);
9822 -+ return seq_printf(m, "%s\n", lmv->desc.ld_uuid.uuid);
9823 - }
9824 -+LPROC_SEQ_FOPS_RO(lmv_desc_uuid);
9825 -
9826 - static void *lmv_tgt_seq_start(struct seq_file *p, loff_t *pos)
9827 - {
9828 -@@ -195,7 +188,6 @@ struct seq_operations lmv_tgt_sops = {
9829 -
9830 - static int lmv_target_seq_open(struct inode *inode, struct file *file)
9831 - {
9832 -- struct proc_dir_entry *dp = PDE(inode);
9833 - struct seq_file *seq;
9834 - int rc;
9835 -
9836 -@@ -203,24 +195,20 @@ static int lmv_target_seq_open(struct inode *inode, struct file *file)
9837 - if (rc)
9838 - return rc;
9839 -
9840 -- seq = file->private_data;
9841 -- seq->private = dp->data;
9842 --
9843 -- return 0;
9844 -+ seq = file->private_data;
9845 -+ seq->private = PDE_DATA(inode);
9846 -+ return 0;
9847 - }
9848 -
9849 --struct lprocfs_vars lprocfs_lmv_obd_vars[] = {
9850 -- { "numobd", lmv_rd_numobd, 0, 0 },
9851 -- { "placement", lmv_rd_placement, lmv_wr_placement, 0 },
9852 -- { "activeobd", lmv_rd_activeobd, 0, 0 },
9853 -- { "uuid", lprocfs_rd_uuid, 0, 0 },
9854 -- { "desc_uuid", lmv_rd_desc_uuid, 0, 0 },
9855 -- { 0 }
9856 --};
9857 -+LPROC_SEQ_FOPS_RO_TYPE(lmv, uuid);
9858 -
9859 --static struct lprocfs_vars lprocfs_lmv_module_vars[] = {
9860 -- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
9861 -- { 0 }
9862 -+struct lprocfs_seq_vars lprocfs_lmv_obd_vars[] = {
9863 -+ { "numobd", &lmv_numobd_fops },
9864 -+ { "placement", &lmv_placement_fops },
9865 -+ { "activeobd", &lmv_activeobd_fops },
9866 -+ { "uuid", &lmv_uuid_fops },
9867 -+ { "desc_uuid", &lmv_desc_uuid_fops },
9868 -+ { 0 }
9869 - };
9870 -
9871 - struct file_operations lmv_proc_target_fops = {
9872 -@@ -230,10 +218,4 @@ struct file_operations lmv_proc_target_fops = {
9873 - .llseek = seq_lseek,
9874 - .release = seq_release,
9875 - };
9876 --
9877 - #endif /* LPROCFS */
9878 --void lprocfs_lmv_init_vars(struct lprocfs_static_vars *lvars)
9879 --{
9880 -- lvars->module_vars = lprocfs_lmv_module_vars;
9881 -- lvars->obd_vars = lprocfs_lmv_obd_vars;
9882 --}
9883 ---
9884 -1.8.5.1
9885 -
9886
9887 diff --git a/sys-cluster/lustre/files/0014-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0007-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch
9888 similarity index 86%
9889 rename from sys-cluster/lustre/files/0014-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch
9890 rename to sys-cluster/lustre/files/0007-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch
9891 index 4bbea03..3aad32c 100644
9892 --- a/sys-cluster/lustre/files/0014-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch
9893 +++ b/sys-cluster/lustre/files/0007-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch
9894 @@ -1,7 +1,7 @@
9895 -From eb1406399522d52e51c3dd7e8a73813c0179d12a Mon Sep 17 00:00:00 2001
9896 +From 9260e5e777af25ebc1a94113ede31667c5f10e97 Mon Sep 17 00:00:00 2001
9897 From: James Simmons <uja.ornl@×××××.com>
9898 -Date: Thu, 14 Nov 2013 19:20:50 -0500
9899 -Subject: [PATCH 14/18] LU-3319 procfs: move lod proc handling to seq_files
9900 +Date: Fri, 31 Jan 2014 12:46:28 -0500
9901 +Subject: [PATCH 07/13] LU-3319 procfs: move lod proc handling to seq_files
9902
9903 With 3.10 linux kernel and above proc handling now only
9904 uses struct seq_files. This patch migrates the lod
9905 @@ -10,14 +10,14 @@ layer proc entries over to using seq_files.
9906 Signed-off-by: James Simmons <uja.ornl@×××××.com>
9907 Change-Id: Iaa0f617fcd430e91f12afbc0faf6906fd275a7a5
9908 ---
9909 - lustre/lod/lod_dev.c | 28 +----
9910 + lustre/lod/lod_dev.c | 39 ++++---
9911 lustre/lod/lod_internal.h | 1 -
9912 lustre/lod/lod_pool.c | 7 +-
9913 - lustre/lod/lproc_lod.c | 255 ++++++++++++++++++++++++----------------------
9914 - 4 files changed, 143 insertions(+), 148 deletions(-)
9915 + lustre/lod/lproc_lod.c | 252 ++++++++++++++++++++++++----------------------
9916 + 4 files changed, 153 insertions(+), 146 deletions(-)
9917
9918 diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c
9919 -index e36aee1..8a0be26 100644
9920 +index 02a1e1e..b0ad1fd 100644
9921 --- a/lustre/lod/lod_dev.c
9922 +++ b/lustre/lod/lod_dev.c
9923 @@ -297,12 +297,10 @@ static int lod_process_config(const struct lu_env *env,
9924 @@ -36,13 +36,15 @@ index e36aee1..8a0be26 100644
9925 if (rc > 0)
9926 rc = 0;
9927 GOTO(out, rc);
9928 -@@ -916,44 +914,26 @@ static struct obd_ops lod_obd_device_ops = {
9929 +@@ -916,19 +914,16 @@ static struct obd_ops lod_obd_device_ops = {
9930
9931 static int __init lod_mod_init(void)
9932 {
9933 - struct lprocfs_static_vars lvars = { 0 };
9934 - cfs_proc_dir_entry_t *lov_proc_dir;
9935 - int rc;
9936 +- int rc;
9937 ++ struct obd_type *lod, *lov;
9938 ++ int rc;
9939
9940 rc = lu_kmem_init(lod_caches);
9941 if (rc)
9942 @@ -57,19 +59,30 @@ index e36aee1..8a0be26 100644
9943 #endif
9944 LUSTRE_LOD_NAME, &lod_device_type);
9945 if (rc) {
9946 - lu_kmem_fini(lod_caches);
9947 - return rc;
9948 +@@ -937,23 +932,25 @@ static int __init lod_mod_init(void)
9949 }
9950 --
9951 -- /* create "lov" entry in procfs for compatibility purposes */
9952 +
9953 + /* create "lov" entry in procfs for compatibility purposes */
9954 - lov_proc_dir = lprocfs_srch(proc_lustre_root, "lov");
9955 - if (lov_proc_dir == NULL) {
9956 - lov_proc_dir = lprocfs_register("lov", proc_lustre_root,
9957 - NULL, NULL);
9958 - if (IS_ERR(lov_proc_dir))
9959 -- CERROR("lod: can't create compat entry \"lov\": %d\n",
9960 ++ lod = class_search_type(LUSTRE_LOD_NAME);
9961 ++ lov = class_search_type(LUSTRE_LOV_NAME);
9962 ++ if (lov == NULL) {
9963 ++ lod->typ_procsym = lprocfs_seq_register("lov", proc_lustre_root,
9964 ++ NULL, NULL);
9965 ++ if (IS_ERR(lod->typ_procsym)) {
9966 + CERROR("lod: can't create compat entry \"lov\": %d\n",
9967 - (int)PTR_ERR(lov_proc_dir));
9968 -- }
9969 ++ (int)PTR_ERR(lod->typ_procsym));
9970 ++ lod->typ_procsym = NULL;
9971 ++ }
9972 ++ } else {
9973 ++ /* Map lov proc root to lod symlink */
9974 ++ lod->typ_procsym = lov->typ_procroot;
9975 + }
9976 -
9977 return rc;
9978 }
9979 @@ -83,10 +96,10 @@ index e36aee1..8a0be26 100644
9980 lu_kmem_fini(lod_caches);
9981 }
9982 diff --git a/lustre/lod/lod_internal.h b/lustre/lod/lod_internal.h
9983 -index 0dd077b..bb6fbfb 100644
9984 +index 6d99ad5..9299a91 100644
9985 --- a/lustre/lod/lod_internal.h
9986 +++ b/lustre/lod/lod_internal.h
9987 -@@ -317,7 +317,6 @@ int qos_add_tgt(struct lod_device*, struct lod_tgt_desc *);
9988 +@@ -376,7 +376,6 @@ int qos_add_tgt(struct lod_device*, struct lod_tgt_desc *);
9989 int qos_del_tgt(struct lod_device *, struct lod_tgt_desc *);
9990
9991 /* lproc_lod.c */
9992 @@ -95,7 +108,7 @@ index 0dd077b..bb6fbfb 100644
9993 void lod_procfs_fini(struct lod_device *lod);
9994
9995 diff --git a/lustre/lod/lod_pool.c b/lustre/lod/lod_pool.c
9996 -index e33ae4d..77d04a7 100644
9997 +index 98b2416..1849e5d 100644
9998 --- a/lustre/lod/lod_pool.c
9999 +++ b/lustre/lod/lod_pool.c
10000 @@ -283,7 +283,7 @@ static int pool_proc_open(struct inode *inode, struct file *file)
10001 @@ -120,7 +133,7 @@ index e33ae4d..77d04a7 100644
10002 &pool_proc_operations);
10003 if (IS_ERR(new_pool->pool_proc_entry)) {
10004 diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c
10005 -index e976063..b0d4e17 100644
10006 +index e976063..6e20b36 100644
10007 --- a/lustre/lod/lproc_lod.c
10008 +++ b/lustre/lod/lproc_lod.c
10009 @@ -42,23 +42,22 @@
10010 @@ -408,7 +421,7 @@ index e976063..b0d4e17 100644
10011
10012 static void *lod_osts_seq_start(struct seq_file *p, loff_t *pos)
10013 {
10014 -@@ -414,56 +409,52 @@ static const struct seq_operations lod_osts_sops = {
10015 +@@ -414,56 +409,63 @@ static const struct seq_operations lod_osts_sops = {
10016
10017 static int lod_osts_seq_open(struct inode *inode, struct file *file)
10018 {
10019 @@ -439,16 +452,6 @@ index e976063..b0d4e17 100644
10020 - { "qos_prio_free",lod_rd_qos_priofree, lod_wr_qos_priofree, 0 },
10021 - { "qos_threshold_rr", lod_rd_qos_thresholdrr, lod_wr_qos_thresholdrr, 0 },
10022 - { "qos_maxage", lod_rd_qos_maxage, lod_wr_qos_maxage, 0 },
10023 -- { 0 }
10024 --};
10025 --
10026 --static struct lprocfs_vars lprocfs_lod_osd_vars[] = {
10027 -- { "blocksize", lprocfs_dt_rd_blksize, 0, 0 },
10028 -- { "kbytestotal", lprocfs_dt_rd_kbytestotal, 0, 0 },
10029 -- { "kbytesfree", lprocfs_dt_rd_kbytesfree, 0, 0 },
10030 -- { "kbytesavail", lprocfs_dt_rd_kbytesavail, 0, 0 },
10031 -- { "filestotal", lprocfs_dt_rd_filestotal, 0, 0 },
10032 -- { "filesfree", lprocfs_dt_rd_filesfree, 0, 0 },
10033 +LPROC_SEQ_FOPS_RO_TYPE(lod, uuid);
10034 +
10035 +LPROC_SEQ_FOPS_RO_TYPE(lod, dt_blksize);
10036 @@ -459,22 +462,38 @@ index e976063..b0d4e17 100644
10037 +LPROC_SEQ_FOPS_RO_TYPE(lod, dt_filesfree);
10038 +
10039 +static struct lprocfs_seq_vars lprocfs_lod_obd_vars[] = {
10040 -+ { "uuid", &lod_uuid_fops },
10041 -+ { "stripesize", &lod_stripesize_fops },
10042 -+ { "stripeoffset", &lod_stripeoffset_fops },
10043 -+ { "stripecount", &lod_stripecount_fops },
10044 -+ { "stripetype", &lod_stripetype_fops },
10045 -+ { "numobd", &lod_numobd_fops },
10046 -+ { "activeobd", &lod_activeobd_fops },
10047 -+ { "desc_uuid", &lod_desc_uuid_fops },
10048 -+ { "qos_prio_free", &lod_qos_priofree_fops },
10049 -+ { "qos_threshold_rr", &lod_qos_thresholdrr_fops },
10050 -+ { "qos_maxage", &lod_qos_maxage_fops },
10051 ++ { .name = "uuid",
10052 ++ .fops = &lod_uuid_fops },
10053 ++ { .name = "stripesize",
10054 ++ .fops = &lod_stripesize_fops },
10055 ++ { .name = "stripeoffset",
10056 ++ .fops = &lod_stripeoffset_fops },
10057 ++ { .name = "stripecount",
10058 ++ .fops = &lod_stripecount_fops },
10059 ++ { .name = "stripetype",
10060 ++ .fops = &lod_stripetype_fops },
10061 ++ { .name = "numobd",
10062 ++ .fops = &lod_numobd_fops },
10063 ++ { .name = "activeobd",
10064 ++ .fops = &lod_activeobd_fops },
10065 ++ { .name = "desc_uuid",
10066 ++ .fops = &lod_desc_uuid_fops },
10067 ++ { .name = "qos_prio_free",
10068 ++ .fops = &lod_qos_priofree_fops },
10069 ++ { .name = "qos_threshold_rr",
10070 ++ .fops = &lod_qos_thresholdrr_fops },
10071 ++ { .name = "qos_maxage",
10072 ++ .fops = &lod_qos_maxage_fops },
10073 { 0 }
10074 };
10075
10076 --static struct lprocfs_vars lprocfs_lod_module_vars[] = {
10077 -- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
10078 +-static struct lprocfs_vars lprocfs_lod_osd_vars[] = {
10079 +- { "blocksize", lprocfs_dt_rd_blksize, 0, 0 },
10080 +- { "kbytestotal", lprocfs_dt_rd_kbytestotal, 0, 0 },
10081 +- { "kbytesfree", lprocfs_dt_rd_kbytesfree, 0, 0 },
10082 +- { "kbytesavail", lprocfs_dt_rd_kbytesavail, 0, 0 },
10083 +- { "filestotal", lprocfs_dt_rd_filestotal, 0, 0 },
10084 +- { "filesfree", lprocfs_dt_rd_filesfree, 0, 0 },
10085 +static struct lprocfs_seq_vars lprocfs_lod_osd_vars[] = {
10086 + { "blocksize", &lod_dt_blksize_fops },
10087 + { "kbytestotal", &lod_dt_kbytestotal_fops },
10088 @@ -485,6 +504,11 @@ index e976063..b0d4e17 100644
10089 { 0 }
10090 };
10091
10092 +-static struct lprocfs_vars lprocfs_lod_module_vars[] = {
10093 +- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
10094 +- { 0 }
10095 +-};
10096 +-
10097 -void lprocfs_lod_init_vars(struct lprocfs_static_vars *lvars)
10098 -{
10099 - lvars->module_vars = lprocfs_lod_module_vars;
10100 @@ -494,12 +518,12 @@ index e976063..b0d4e17 100644
10101 static const struct file_operations lod_proc_target_fops = {
10102 .owner = THIS_MODULE,
10103 .open = lod_osts_seq_open,
10104 -@@ -475,20 +466,19 @@ static const struct file_operations lod_proc_target_fops = {
10105 +@@ -475,20 +477,18 @@ static const struct file_operations lod_proc_target_fops = {
10106 int lod_procfs_init(struct lod_device *lod)
10107 {
10108 struct obd_device *obd = lod2obd(lod);
10109 - struct lprocfs_static_vars lvars;
10110 - cfs_proc_dir_entry_t *lov_proc_dir;
10111 +- cfs_proc_dir_entry_t *lov_proc_dir;
10112 int rc;
10113
10114 - lprocfs_lod_init_vars(&lvars);
10115 @@ -519,7 +543,7 @@ index e976063..b0d4e17 100644
10116 if (rc) {
10117 CERROR("%s: cannot setup procfs entry: %d\n",
10118 obd->obd_name, rc);
10119 -@@ -503,9 +493,9 @@ int lod_procfs_init(struct lod_device *lod)
10120 +@@ -503,9 +503,9 @@ int lod_procfs_init(struct lod_device *lod)
10121 GOTO(out, rc);
10122 }
10123
10124 @@ -532,58 +556,43 @@ index e976063..b0d4e17 100644
10125 if (IS_ERR(lod->lod_pool_proc_entry)) {
10126 rc = PTR_ERR(lod->lod_pool_proc_entry);
10127 lod->lod_pool_proc_entry = NULL;
10128 -@@ -514,14 +504,34 @@ int lod_procfs_init(struct lod_device *lod)
10129 +@@ -514,14 +514,19 @@ int lod_procfs_init(struct lod_device *lod)
10130 GOTO(out, rc);
10131 }
10132
10133 - /* for compatibility we link old procfs's OSC entries to osp ones */
10134 - lov_proc_dir = lprocfs_srch(proc_lustre_root, "lov");
10135 - if (lov_proc_dir != NULL && strstr(obd->obd_name, "lov") != NULL)
10136 -- lod->lod_symlink = lprocfs_add_symlink(obd->obd_name,
10137 ++ /* for compatibility we link old procfs's LOV entries to lod ones */
10138 ++ if (obd->obd_type->typ_procsym != NULL) {
10139 + lod->lod_symlink = lprocfs_add_symlink(obd->obd_name,
10140 - lov_proc_dir,
10141 - "../lod/%s",
10142 - obd->obd_name);
10143 -+ /* for compatibility we link old procfs's LOV entries to lod ones */
10144 -+ lov_proc_dir = obd->obd_proc_private;
10145 -+ if (lov_proc_dir == NULL) {
10146 -+ struct obd_type *type = class_search_type(LUSTRE_LOV_NAME);
10147 -+
10148 -+ /* create "lov" entry in procfs for compatibility purposes */
10149 -+ if (type == NULL) {
10150 -+ lov_proc_dir = lprocfs_seq_register("lov",
10151 -+ proc_lustre_root,
10152 -+ NULL, NULL);
10153 -+ if (IS_ERR(lov_proc_dir))
10154 -+ CERROR("lod: can't create compat entry \"lov\""
10155 -+ ": %d\n",(int)PTR_ERR(lov_proc_dir));
10156 -+ } else {
10157 -+ lov_proc_dir = type->typ_procroot;
10158 -+ }
10159 -
10160 -+ lod->lod_symlink = lprocfs_add_symlink(obd->obd_name,
10161 -+ lov_proc_dir,
10162 +-
10163 ++ obd->obd_type->typ_procsym,
10164 + "../lod/%s",
10165 + obd->obd_name);
10166 + if (lod->lod_symlink == NULL) {
10167 + CERROR("could not register LOV symlink for "
10168 + "/proc/fs/lustre/lod/%s.", obd->obd_name);
10169 -+ lprocfs_remove(&lov_proc_dir);
10170 -+ } else
10171 -+ obd->obd_proc_private = lov_proc_dir;
10172 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
10173 ++ obd->obd_type->typ_procsym = NULL;
10174 ++ }
10175 + }
10176 RETURN(0);
10177
10178 out:
10179 -@@ -542,6 +552,9 @@ void lod_procfs_fini(struct lod_device *lod)
10180 +@@ -542,6 +547,9 @@ void lod_procfs_fini(struct lod_device *lod)
10181 lod->lod_pool_proc_entry = NULL;
10182 }
10183
10184 -+ if (obd->obd_proc_private != NULL)
10185 -+ lprocfs_remove((struct proc_dir_entry **)&obd->obd_proc_private);
10186 ++ if (obd->obd_type->typ_procsym != NULL)
10187 ++ lprocfs_remove(&obd->obd_type->typ_procsym);
10188 +
10189 lprocfs_obd_cleanup(obd);
10190 }
10191
10192 --
10193 -1.8.5.1
10194 +1.8.5.3
10195
10196
10197 diff --git a/sys-cluster/lustre/files/0008-LU-3319-procfs-move-ldlm-proc-handling-over-to-seq_f.patch b/sys-cluster/lustre/files/0008-LU-3319-procfs-move-ldlm-proc-handling-over-to-seq_f.patch
10198 deleted file mode 100644
10199 index d3768d5..0000000
10200 --- a/sys-cluster/lustre/files/0008-LU-3319-procfs-move-ldlm-proc-handling-over-to-seq_f.patch
10201 +++ /dev/null
10202 @@ -1,789 +0,0 @@
10203 -From a464fd862a7876e1c4f679b32956904eee88d45e Mon Sep 17 00:00:00 2001
10204 -From: James Simmons <uja.ornl@×××××.com>
10205 -Date: Tue, 17 Dec 2013 19:11:15 -0500
10206 -Subject: [PATCH 08/18] LU-3319 procfs: move ldlm proc handling over to
10207 - seq_file
10208 -
10209 -In order to support 3.10+ kernels for clients we adapt
10210 -the ldlm proc handling to using seq_files.
10211 -
10212 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
10213 -Change-Id: Iaedae5fe1e1cd2985a6240314810db9bba3cd747
10214 ----
10215 - lustre/include/lustre_dlm.h | 5 +-
10216 - lustre/ldlm/ldlm_internal.h | 85 ++++++------
10217 - lustre/ldlm/ldlm_pool.c | 197 +++++++++++++---------------
10218 - lustre/ldlm/ldlm_resource.c | 306 +++++++++++++++++++-------------------------
10219 - 4 files changed, 270 insertions(+), 323 deletions(-)
10220 -
10221 -diff --git a/lustre/include/lustre_dlm.h b/lustre/include/lustre_dlm.h
10222 -index 30b70b5..d01b7e9 100644
10223 ---- a/lustre/include/lustre_dlm.h
10224 -+++ b/lustre/include/lustre_dlm.h
10225 -@@ -243,7 +243,7 @@ struct ldlm_pool_ops {
10226 - */
10227 - struct ldlm_pool {
10228 - /** Pool proc directory. */
10229 -- cfs_proc_dir_entry_t *pl_proc_dir;
10230 -+ struct proc_dir_entry *pl_proc_dir;
10231 - /** Pool name, must be long enough to hold compound proc entry name. */
10232 - char pl_name[100];
10233 - /** Lock for protecting SLV/CLV updates. */
10234 -@@ -400,6 +400,9 @@ struct ldlm_namespace {
10235 - /** Client side original connect flags supported by server. */
10236 - __u64 ns_orig_connect_flags;
10237 -
10238 -+ /* namespace proc dir entry */
10239 -+ struct proc_dir_entry *ns_proc_dir_entry;
10240 -+
10241 - /**
10242 - * Position in global namespace list linking all namespaces on
10243 - * the node.
10244 -diff --git a/lustre/ldlm/ldlm_internal.h b/lustre/ldlm/ldlm_internal.h
10245 -index 5077072..ffc528b 100644
10246 ---- a/lustre/ldlm/ldlm_internal.h
10247 -+++ b/lustre/ldlm/ldlm_internal.h
10248 -@@ -212,8 +212,8 @@ void ldlm_destroy_flock_export(struct obd_export *exp);
10249 - void l_check_ns_lock(struct ldlm_namespace *ns);
10250 - void l_check_no_ns_lock(struct ldlm_namespace *ns);
10251 -
10252 --extern cfs_proc_dir_entry_t *ldlm_svc_proc_dir;
10253 --extern cfs_proc_dir_entry_t *ldlm_type_proc_dir;
10254 -+extern struct proc_dir_entry *ldlm_svc_proc_dir;
10255 -+extern struct proc_dir_entry *ldlm_type_proc_dir;
10256 -
10257 - struct ldlm_state {
10258 - struct ptlrpc_service *ldlm_cb_service;
10259 -@@ -252,42 +252,51 @@ enum ldlm_policy_res {
10260 -
10261 - typedef enum ldlm_policy_res ldlm_policy_res_t;
10262 -
10263 --#define LDLM_POOL_PROC_READER(var, type) \
10264 -- static int lprocfs_rd_##var(char *page, char **start, off_t off, \
10265 -- int count, int *eof, void *data) \
10266 -- { \
10267 -- struct ldlm_pool *pl = data; \
10268 -- type tmp; \
10269 -- \
10270 -- spin_lock(&pl->pl_lock); \
10271 -- tmp = pl->pl_##var; \
10272 -- spin_unlock(&pl->pl_lock); \
10273 -- \
10274 -- return lprocfs_rd_uint(page, start, off, count, eof, &tmp); \
10275 -- } \
10276 -- struct __##var##__dummy_read {;} /* semicolon catcher */
10277 --
10278 --#define LDLM_POOL_PROC_WRITER(var, type) \
10279 -- int lprocfs_wr_##var(struct file *file, const char *buffer, \
10280 -- unsigned long count, void *data) \
10281 -- { \
10282 -- struct ldlm_pool *pl = data; \
10283 -- type tmp; \
10284 -- int rc; \
10285 -- \
10286 -- rc = lprocfs_wr_uint(file, buffer, count, &tmp); \
10287 -- if (rc < 0) { \
10288 -- CERROR("Can't parse user input, rc = %d\n", rc); \
10289 -- return rc; \
10290 -- } \
10291 -- \
10292 -- spin_lock(&pl->pl_lock); \
10293 -- pl->pl_##var = tmp; \
10294 -- spin_unlock(&pl->pl_lock); \
10295 -- \
10296 -- return rc; \
10297 -- } \
10298 -- struct __##var##__dummy_write {;} /* semicolon catcher */
10299 -+#define LDLM_POOL_PROC_READER_SEQ_SHOW(var, type) \
10300 -+ static int lprocfs_##var##_seq_show(struct seq_file *m, void *v)\
10301 -+ { \
10302 -+ struct ldlm_pool *pl = m->private; \
10303 -+ type tmp; \
10304 -+ \
10305 -+ spin_lock(&pl->pl_lock); \
10306 -+ tmp = pl->pl_##var; \
10307 -+ spin_unlock(&pl->pl_lock); \
10308 -+ \
10309 -+ return lprocfs_uint_seq_show(m, &tmp); \
10310 -+ } \
10311 -+ struct __##var##__dummy_read {;} /* semicolon catcher */
10312 -+
10313 -+#define LDLM_POOL_PROC_WRITER(var, type) \
10314 -+ int lprocfs_wr_##var(struct file *file, const char *buffer, \
10315 -+ unsigned long count, void *data) \
10316 -+ { \
10317 -+ struct ldlm_pool *pl = data; \
10318 -+ type tmp; \
10319 -+ int rc; \
10320 -+ \
10321 -+ rc = lprocfs_wr_uint(file, buffer, count, &tmp); \
10322 -+ if (rc < 0) { \
10323 -+ CERROR("Can't parse user input, rc = %d\n", rc);\
10324 -+ return rc; \
10325 -+ } \
10326 -+ \
10327 -+ spin_lock(&pl->pl_lock); \
10328 -+ pl->pl_##var = tmp; \
10329 -+ spin_unlock(&pl->pl_lock); \
10330 -+ \
10331 -+ return rc; \
10332 -+ } \
10333 -+ struct __##var##__dummy_write {;} /* semicolon catcher */
10334 -+
10335 -+static inline void
10336 -+ldlm_add_var(struct lprocfs_seq_vars *vars, struct proc_dir_entry *proc_dir,
10337 -+ const char *name, void *data, const struct file_operations *ops)
10338 -+{
10339 -+ snprintf((char *)vars->name, MAX_STRING_SIZE, "%s", name);
10340 -+ vars->data = data;
10341 -+ vars->fops = ops;
10342 -+ lprocfs_seq_add_vars(proc_dir, vars, 0);
10343 -+}
10344 -
10345 - static inline int is_granted_or_cancelled(struct ldlm_lock *lock)
10346 - {
10347 -diff --git a/lustre/ldlm/ldlm_pool.c b/lustre/ldlm/ldlm_pool.c
10348 -index 734b330..c1b7ac6 100644
10349 ---- a/lustre/ldlm/ldlm_pool.c
10350 -+++ b/lustre/ldlm/ldlm_pool.c
10351 -@@ -148,7 +148,7 @@
10352 - #define LDLM_POOL_SLV_SHIFT (10)
10353 -
10354 - #ifdef __KERNEL__
10355 --extern cfs_proc_dir_entry_t *ldlm_ns_proc_dir;
10356 -+extern struct proc_dir_entry *ldlm_ns_proc_dir;
10357 - #endif
10358 -
10359 - static inline __u64 dru(__u64 val, __u32 shift, int round_up)
10360 -@@ -656,14 +656,13 @@ int ldlm_pool_setup(struct ldlm_pool *pl, int limit)
10361 - EXPORT_SYMBOL(ldlm_pool_setup);
10362 -
10363 - #ifdef __KERNEL__
10364 --static int lprocfs_rd_pool_state(char *page, char **start, off_t off,
10365 -- int count, int *eof, void *data)
10366 -+static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused)
10367 - {
10368 -- int granted, grant_rate, cancel_rate, grant_step;
10369 -- int nr = 0, grant_speed, grant_plan, lvf;
10370 -- struct ldlm_pool *pl = data;
10371 -- __u64 slv, clv;
10372 -- __u32 limit;
10373 -+ int granted, grant_rate, cancel_rate, grant_step;
10374 -+ int grant_speed, grant_plan, lvf;
10375 -+ struct ldlm_pool *pl = m->private;
10376 -+ __u64 slv, clv;
10377 -+ __u32 limit;
10378 -
10379 - spin_lock(&pl->pl_lock);
10380 - slv = pl->pl_server_lock_volume;
10381 -@@ -678,35 +677,28 @@ static int lprocfs_rd_pool_state(char *page, char **start, off_t off,
10382 - grant_step = ldlm_pool_t2gsp(pl->pl_recalc_period);
10383 - spin_unlock(&pl->pl_lock);
10384 -
10385 -- nr += snprintf(page + nr, count - nr, "LDLM pool state (%s):\n",
10386 -- pl->pl_name);
10387 -- nr += snprintf(page + nr, count - nr, " SLV: "LPU64"\n", slv);
10388 -- nr += snprintf(page + nr, count - nr, " CLV: "LPU64"\n", clv);
10389 -- nr += snprintf(page + nr, count - nr, " LVF: %d\n", lvf);
10390 --
10391 -- if (ns_is_server(ldlm_pl2ns(pl))) {
10392 -- nr += snprintf(page + nr, count - nr, " GSP: %d%%\n",
10393 -- grant_step);
10394 -- nr += snprintf(page + nr, count - nr, " GP: %d\n",
10395 -- grant_plan);
10396 -- }
10397 -- nr += snprintf(page + nr, count - nr, " GR: %d\n",
10398 -- grant_rate);
10399 -- nr += snprintf(page + nr, count - nr, " CR: %d\n",
10400 -- cancel_rate);
10401 -- nr += snprintf(page + nr, count - nr, " GS: %d\n",
10402 -- grant_speed);
10403 -- nr += snprintf(page + nr, count - nr, " G: %d\n",
10404 -- granted);
10405 -- nr += snprintf(page + nr, count - nr, " L: %d\n",
10406 -- limit);
10407 -- return nr;
10408 -+ seq_printf(m, "LDLM pool state (%s):\n"
10409 -+ " SLV: "LPU64"\n"
10410 -+ " CLV: "LPU64"\n"
10411 -+ " LVF: %d\n",
10412 -+ pl->pl_name, slv, clv, lvf);
10413 -+
10414 -+ if (ns_is_server(ldlm_pl2ns(pl))) {
10415 -+ seq_printf(m, " GSP: %d%%\n"
10416 -+ " GP: %d\n",
10417 -+ grant_step, grant_plan);
10418 -+ }
10419 -+ seq_printf(m, " GR: %d\n" " CR: %d\n" " GS: %d\n"
10420 -+ " G: %d\n" " L: %d\n",
10421 -+ grant_rate, cancel_rate, grant_speed,
10422 -+ granted, limit);
10423 -+ return 0;
10424 - }
10425 -+LPROC_SEQ_FOPS_RO(lprocfs_pool_state);
10426 -
10427 --static int lprocfs_rd_grant_speed(char *page, char **start, off_t off,
10428 -- int count, int *eof, void *data)
10429 -+static int lprocfs_grant_speed_seq_show(struct seq_file *m, void *unused)
10430 - {
10431 -- struct ldlm_pool *pl = data;
10432 -+ struct ldlm_pool *pl = m->private;
10433 - int grant_speed;
10434 -
10435 - spin_lock(&pl->pl_lock);
10436 -@@ -714,35 +706,50 @@ static int lprocfs_rd_grant_speed(char *page, char **start, off_t off,
10437 - grant_speed = cfs_atomic_read(&pl->pl_grant_rate) -
10438 - cfs_atomic_read(&pl->pl_cancel_rate);
10439 - spin_unlock(&pl->pl_lock);
10440 -- return lprocfs_rd_uint(page, start, off, count, eof, &grant_speed);
10441 -+ return lprocfs_uint_seq_show(m, &grant_speed);
10442 - }
10443 -
10444 --LDLM_POOL_PROC_READER(grant_plan, int);
10445 --LDLM_POOL_PROC_READER(recalc_period, int);
10446 -+LDLM_POOL_PROC_READER_SEQ_SHOW(grant_plan, int);
10447 -+LPROC_SEQ_FOPS_RO(lprocfs_grant_plan);
10448 -+
10449 -+LDLM_POOL_PROC_READER_SEQ_SHOW(recalc_period, int);
10450 - LDLM_POOL_PROC_WRITER(recalc_period, int);
10451 -+static ssize_t lprocfs_recalc_period_seq_write(struct file *file, const char *buf,
10452 -+ size_t len, loff_t *off)
10453 -+{
10454 -+ struct seq_file *seq = file->private_data;
10455 -+
10456 -+ return lprocfs_wr_recalc_period(file, buf, len, seq->private);
10457 -+}
10458 -+LPROC_SEQ_FOPS(lprocfs_recalc_period);
10459 -+
10460 -+LPROC_SEQ_FOPS_RO_TYPE(ldlm_pool, u64);
10461 -+LPROC_SEQ_FOPS_RO_TYPE(ldlm_pool, atomic);
10462 -+LPROC_SEQ_FOPS_RW_TYPE(ldlm_pool_rw, atomic);
10463 -+
10464 -+LPROC_SEQ_FOPS_RO(lprocfs_grant_speed);
10465 -
10466 - static int ldlm_pool_proc_init(struct ldlm_pool *pl)
10467 - {
10468 -- struct ldlm_namespace *ns = ldlm_pl2ns(pl);
10469 -- struct proc_dir_entry *parent_ns_proc;
10470 -- struct lprocfs_vars pool_vars[2];
10471 -- char *var_name = NULL;
10472 -- int rc = 0;
10473 -- ENTRY;
10474 -+ struct ldlm_namespace *ns = ldlm_pl2ns(pl);
10475 -+ struct proc_dir_entry *parent_ns_proc;
10476 -+ struct lprocfs_seq_vars pool_vars[2];
10477 -+ char *var_name = NULL;
10478 -+ int rc = 0;
10479 -+ ENTRY;
10480 -
10481 -- OBD_ALLOC(var_name, MAX_STRING_SIZE + 1);
10482 -- if (!var_name)
10483 -- RETURN(-ENOMEM);
10484 -+ OBD_ALLOC(var_name, MAX_STRING_SIZE + 1);
10485 -+ if (!var_name)
10486 -+ RETURN(-ENOMEM);
10487 -
10488 -- parent_ns_proc = lprocfs_srch(ldlm_ns_proc_dir,
10489 -- ldlm_ns_name(ns));
10490 -- if (parent_ns_proc == NULL) {
10491 -- CERROR("%s: proc entry is not initialized\n",
10492 -- ldlm_ns_name(ns));
10493 -- GOTO(out_free_name, rc = -EINVAL);
10494 -- }
10495 -- pl->pl_proc_dir = lprocfs_register("pool", parent_ns_proc,
10496 -- NULL, NULL);
10497 -+ parent_ns_proc = ns->ns_proc_dir_entry;
10498 -+ if (parent_ns_proc == NULL) {
10499 -+ CERROR("%s: proc entry is not initialized\n",
10500 -+ ldlm_ns_name(ns));
10501 -+ GOTO(out_free_name, rc = -EINVAL);
10502 -+ }
10503 -+ pl->pl_proc_dir = lprocfs_seq_register("pool", parent_ns_proc,
10504 -+ NULL, NULL);
10505 - if (IS_ERR(pl->pl_proc_dir)) {
10506 - rc = PTR_ERR(pl->pl_proc_dir);
10507 - pl->pl_proc_dir = NULL;
10508 -@@ -751,62 +758,30 @@ static int ldlm_pool_proc_init(struct ldlm_pool *pl)
10509 - GOTO(out_free_name, rc);
10510 - }
10511 -
10512 -- var_name[MAX_STRING_SIZE] = '\0';
10513 -- memset(pool_vars, 0, sizeof(pool_vars));
10514 -- pool_vars[0].name = var_name;
10515 --
10516 -- snprintf(var_name, MAX_STRING_SIZE, "server_lock_volume");
10517 -- pool_vars[0].data = &pl->pl_server_lock_volume;
10518 -- pool_vars[0].read_fptr = lprocfs_rd_u64;
10519 -- lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
10520 --
10521 -- snprintf(var_name, MAX_STRING_SIZE, "limit");
10522 -- pool_vars[0].data = &pl->pl_limit;
10523 -- pool_vars[0].read_fptr = lprocfs_rd_atomic;
10524 -- pool_vars[0].write_fptr = lprocfs_wr_atomic;
10525 -- lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
10526 --
10527 -- snprintf(var_name, MAX_STRING_SIZE, "granted");
10528 -- pool_vars[0].data = &pl->pl_granted;
10529 -- pool_vars[0].read_fptr = lprocfs_rd_atomic;
10530 -- lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
10531 --
10532 -- snprintf(var_name, MAX_STRING_SIZE, "grant_speed");
10533 -- pool_vars[0].data = pl;
10534 -- pool_vars[0].read_fptr = lprocfs_rd_grant_speed;
10535 -- lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
10536 --
10537 -- snprintf(var_name, MAX_STRING_SIZE, "cancel_rate");
10538 -- pool_vars[0].data = &pl->pl_cancel_rate;
10539 -- pool_vars[0].read_fptr = lprocfs_rd_atomic;
10540 -- lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
10541 --
10542 -- snprintf(var_name, MAX_STRING_SIZE, "grant_rate");
10543 -- pool_vars[0].data = &pl->pl_grant_rate;
10544 -- pool_vars[0].read_fptr = lprocfs_rd_atomic;
10545 -- lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
10546 --
10547 -- snprintf(var_name, MAX_STRING_SIZE, "grant_plan");
10548 -- pool_vars[0].data = pl;
10549 -- pool_vars[0].read_fptr = lprocfs_rd_grant_plan;
10550 -- lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
10551 --
10552 -- snprintf(var_name, MAX_STRING_SIZE, "recalc_period");
10553 -- pool_vars[0].data = pl;
10554 -- pool_vars[0].read_fptr = lprocfs_rd_recalc_period;
10555 -- pool_vars[0].write_fptr = lprocfs_wr_recalc_period;
10556 -- lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
10557 --
10558 -- snprintf(var_name, MAX_STRING_SIZE, "lock_volume_factor");
10559 -- pool_vars[0].data = &pl->pl_lock_volume_factor;
10560 -- pool_vars[0].read_fptr = lprocfs_rd_atomic;
10561 -- pool_vars[0].write_fptr = lprocfs_wr_atomic;
10562 -- lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
10563 --
10564 -- snprintf(var_name, MAX_STRING_SIZE, "state");
10565 -- pool_vars[0].data = pl;
10566 -- pool_vars[0].read_fptr = lprocfs_rd_pool_state;
10567 -- lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
10568 -+ var_name[MAX_STRING_SIZE] = '\0';
10569 -+ memset(pool_vars, 0, sizeof(pool_vars));
10570 -+ pool_vars[0].name = var_name;
10571 -+
10572 -+ ldlm_add_var(&pool_vars[0], pl->pl_proc_dir, "server_lock_volume",
10573 -+ &pl->pl_server_lock_volume, &ldlm_pool_u64_fops);
10574 -+ ldlm_add_var(&pool_vars[0], pl->pl_proc_dir, "limit", &pl->pl_limit,
10575 -+ &ldlm_pool_rw_atomic_fops);
10576 -+ ldlm_add_var(&pool_vars[0], pl->pl_proc_dir, "granted",
10577 -+ &pl->pl_granted, &ldlm_pool_atomic_fops);
10578 -+ ldlm_add_var(&pool_vars[0], pl->pl_proc_dir, "grant_speed", pl,
10579 -+ &lprocfs_grant_speed_fops);
10580 -+ ldlm_add_var(&pool_vars[0], pl->pl_proc_dir, "cancel_rate",
10581 -+ &pl->pl_cancel_rate, &ldlm_pool_atomic_fops);
10582 -+ ldlm_add_var(&pool_vars[0], pl->pl_proc_dir, "grant_rate",
10583 -+ &pl->pl_grant_rate, &ldlm_pool_atomic_fops);
10584 -+ ldlm_add_var(&pool_vars[0], pl->pl_proc_dir, "grant_plan", pl,
10585 -+ &lprocfs_grant_plan_fops);
10586 -+ ldlm_add_var(&pool_vars[0], pl->pl_proc_dir, "recalc_period",
10587 -+ pl, &lprocfs_recalc_period_fops);
10588 -+ ldlm_add_var(&pool_vars[0], pl->pl_proc_dir, "lock_volume_factor",
10589 -+ &pl->pl_lock_volume_factor, &ldlm_pool_rw_atomic_fops);
10590 -+ ldlm_add_var(&pool_vars[0], pl->pl_proc_dir, "state", pl,
10591 -+ &lprocfs_pool_state_fops);
10592 -
10593 - pl->pl_stats = lprocfs_alloc_stats(LDLM_POOL_LAST_STAT -
10594 - LDLM_POOL_FIRST_STAT, 0);
10595 -diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c
10596 -index e1b8787..e504cff 100644
10597 ---- a/lustre/ldlm/ldlm_resource.c
10598 -+++ b/lustre/ldlm/ldlm_resource.c
10599 -@@ -66,9 +66,9 @@ CFS_LIST_HEAD(ldlm_cli_active_namespace_list);
10600 - /* Client namespaces that don't have any locks in them */
10601 - CFS_LIST_HEAD(ldlm_cli_inactive_namespace_list);
10602 -
10603 --cfs_proc_dir_entry_t *ldlm_type_proc_dir = NULL;
10604 --cfs_proc_dir_entry_t *ldlm_ns_proc_dir = NULL;
10605 --cfs_proc_dir_entry_t *ldlm_svc_proc_dir = NULL;
10606 -+struct proc_dir_entry *ldlm_type_proc_dir = NULL;
10607 -+struct proc_dir_entry *ldlm_ns_proc_dir = NULL;
10608 -+struct proc_dir_entry *ldlm_svc_proc_dir = NULL;
10609 -
10610 - extern unsigned int ldlm_cancel_unused_locks_before_replay;
10611 -
10612 -@@ -77,57 +77,64 @@ extern unsigned int ldlm_cancel_unused_locks_before_replay;
10613 - unsigned int ldlm_dump_granted_max = 256;
10614 -
10615 - #ifdef LPROCFS
10616 --static int ldlm_proc_dump_ns(struct file *file, const char *buffer,
10617 -- unsigned long count, void *data)
10618 -+static ssize_t
10619 -+lprocfs_dump_ns_seq_write(struct file *file, const char *buffer,
10620 -+ size_t count, loff_t *off)
10621 - {
10622 -- ldlm_dump_all_namespaces(LDLM_NAMESPACE_SERVER, D_DLMTRACE);
10623 -- ldlm_dump_all_namespaces(LDLM_NAMESPACE_CLIENT, D_DLMTRACE);
10624 -- RETURN(count);
10625 -+ ldlm_dump_all_namespaces(LDLM_NAMESPACE_SERVER, D_DLMTRACE);
10626 -+ ldlm_dump_all_namespaces(LDLM_NAMESPACE_CLIENT, D_DLMTRACE);
10627 -+ RETURN(count);
10628 - }
10629 -+LPROC_SEQ_FOPS_WO_TYPE(ldlm, dump_ns);
10630 -+
10631 -+LPROC_SEQ_FOPS_RW_TYPE(ldlm_rw, uint);
10632 -+LPROC_SEQ_FOPS_RO_TYPE(ldlm, uint);
10633 -
10634 - int ldlm_proc_setup(void)
10635 - {
10636 -- int rc;
10637 -- struct lprocfs_vars list[] = {
10638 -- { "dump_namespaces", NULL, ldlm_proc_dump_ns, NULL },
10639 -- { "dump_granted_max",
10640 -- lprocfs_rd_uint, lprocfs_wr_uint,
10641 -- &ldlm_dump_granted_max, NULL },
10642 -- { "cancel_unused_locks_before_replay",
10643 -- lprocfs_rd_uint, lprocfs_wr_uint,
10644 -- &ldlm_cancel_unused_locks_before_replay, NULL },
10645 -- { NULL }};
10646 -- ENTRY;
10647 -- LASSERT(ldlm_ns_proc_dir == NULL);
10648 --
10649 -- ldlm_type_proc_dir = lprocfs_register(OBD_LDLM_DEVICENAME,
10650 -- proc_lustre_root,
10651 -- NULL, NULL);
10652 -- if (IS_ERR(ldlm_type_proc_dir)) {
10653 -- CERROR("LProcFS failed in ldlm-init\n");
10654 -- rc = PTR_ERR(ldlm_type_proc_dir);
10655 -- GOTO(err, rc);
10656 -- }
10657 -+ int rc;
10658 -+ struct lprocfs_seq_vars list[] = {
10659 -+ { .name = "dump_namespaces",
10660 -+ .fops = &ldlm_dump_ns_fops,
10661 -+ .proc_mode = 0222 },
10662 -+ { .name = "dump_granted_max",
10663 -+ .fops = &ldlm_rw_uint_fops,
10664 -+ .data = &ldlm_dump_granted_max },
10665 -+ { .name = "cancel_unused_locks_before_replay",
10666 -+ .fops = &ldlm_rw_uint_fops,
10667 -+ .data = &ldlm_cancel_unused_locks_before_replay },
10668 -+ { NULL }};
10669 -+ ENTRY;
10670 -+ LASSERT(ldlm_ns_proc_dir == NULL);
10671 -+
10672 -+ ldlm_type_proc_dir = lprocfs_seq_register(OBD_LDLM_DEVICENAME,
10673 -+ proc_lustre_root,
10674 -+ NULL, NULL);
10675 -+ if (IS_ERR(ldlm_type_proc_dir)) {
10676 -+ CERROR("LProcFS failed in ldlm-init\n");
10677 -+ rc = PTR_ERR(ldlm_type_proc_dir);
10678 -+ GOTO(err, rc);
10679 -+ }
10680 -
10681 -- ldlm_ns_proc_dir = lprocfs_register("namespaces",
10682 -- ldlm_type_proc_dir,
10683 -- NULL, NULL);
10684 -- if (IS_ERR(ldlm_ns_proc_dir)) {
10685 -- CERROR("LProcFS failed in ldlm-init\n");
10686 -- rc = PTR_ERR(ldlm_ns_proc_dir);
10687 -- GOTO(err_type, rc);
10688 -- }
10689 -+ ldlm_ns_proc_dir = lprocfs_seq_register("namespaces",
10690 -+ ldlm_type_proc_dir,
10691 -+ NULL, NULL);
10692 -+ if (IS_ERR(ldlm_ns_proc_dir)) {
10693 -+ CERROR("LProcFS failed in ldlm-init\n");
10694 -+ rc = PTR_ERR(ldlm_ns_proc_dir);
10695 -+ GOTO(err_type, rc);
10696 -+ }
10697 -
10698 -- ldlm_svc_proc_dir = lprocfs_register("services",
10699 -- ldlm_type_proc_dir,
10700 -- NULL, NULL);
10701 -- if (IS_ERR(ldlm_svc_proc_dir)) {
10702 -- CERROR("LProcFS failed in ldlm-init\n");
10703 -- rc = PTR_ERR(ldlm_svc_proc_dir);
10704 -- GOTO(err_ns, rc);
10705 -- }
10706 -+ ldlm_svc_proc_dir = lprocfs_seq_register("services",
10707 -+ ldlm_type_proc_dir,
10708 -+ NULL, NULL);
10709 -+ if (IS_ERR(ldlm_svc_proc_dir)) {
10710 -+ CERROR("LProcFS failed in ldlm-init\n");
10711 -+ rc = PTR_ERR(ldlm_svc_proc_dir);
10712 -+ GOTO(err_ns, rc);
10713 -+ }
10714 -
10715 -- rc = lprocfs_add_vars(ldlm_type_proc_dir, list, NULL);
10716 -+ rc = lprocfs_seq_add_vars(ldlm_type_proc_dir, list, NULL);
10717 - if (rc != 0) {
10718 - CERROR("LProcFS failed in ldlm-init\n");
10719 - GOTO(err_svc, rc);
10720 -@@ -158,46 +165,45 @@ void ldlm_proc_cleanup(void)
10721 - lprocfs_remove(&ldlm_type_proc_dir);
10722 - }
10723 -
10724 --static int lprocfs_rd_ns_resources(char *page, char **start, off_t off,
10725 -- int count, int *eof, void *data)
10726 -+static int lprocfs_ns_resources_seq_show(struct seq_file *m, void *v)
10727 - {
10728 -- struct ldlm_namespace *ns = data;
10729 -- __u64 res = 0;
10730 -- cfs_hash_bd_t bd;
10731 -- int i;
10732 --
10733 -- /* result is not strictly consistant */
10734 -- cfs_hash_for_each_bucket(ns->ns_rs_hash, &bd, i)
10735 -- res += cfs_hash_bd_count_get(&bd);
10736 -- return lprocfs_rd_u64(page, start, off, count, eof, &res);
10737 -+ struct ldlm_namespace *ns = m->private;
10738 -+ __u64 res = 0;
10739 -+ cfs_hash_bd_t bd;
10740 -+ int i;
10741 -+
10742 -+ /* result is not strictly consistant */
10743 -+ cfs_hash_for_each_bucket(ns->ns_rs_hash, &bd, i)
10744 -+ res += cfs_hash_bd_count_get(&bd);
10745 -+ return lprocfs_u64_seq_show(m, &res);
10746 - }
10747 -+LPROC_SEQ_FOPS_RO(lprocfs_ns_resources);
10748 -
10749 --static int lprocfs_rd_ns_locks(char *page, char **start, off_t off,
10750 -- int count, int *eof, void *data)
10751 -+static int lprocfs_ns_locks_seq_show(struct seq_file *m, void *v)
10752 - {
10753 -- struct ldlm_namespace *ns = data;
10754 -- __u64 locks;
10755 -+ struct ldlm_namespace *ns = m->private;
10756 -+ __u64 locks;
10757 -
10758 -- locks = lprocfs_stats_collector(ns->ns_stats, LDLM_NSS_LOCKS,
10759 -- LPROCFS_FIELDS_FLAGS_SUM);
10760 -- return lprocfs_rd_u64(page, start, off, count, eof, &locks);
10761 -+ locks = lprocfs_stats_collector(ns->ns_stats, LDLM_NSS_LOCKS,
10762 -+ LPROCFS_FIELDS_FLAGS_SUM);
10763 -+ return lprocfs_u64_seq_show(m, &locks);
10764 - }
10765 -+LPROC_SEQ_FOPS_RO(lprocfs_ns_locks);
10766 -
10767 --static int lprocfs_rd_lru_size(char *page, char **start, off_t off,
10768 -- int count, int *eof, void *data)
10769 -+static int lprocfs_lru_size_seq_show(struct seq_file *m, void *v)
10770 - {
10771 -- struct ldlm_namespace *ns = data;
10772 -- __u32 *nr = &ns->ns_max_unused;
10773 -+ struct ldlm_namespace *ns = m->private;
10774 -+ __u32 *nr = &ns->ns_max_unused;
10775 -
10776 -- if (ns_connect_lru_resize(ns))
10777 -- nr = &ns->ns_nr_unused;
10778 -- return lprocfs_rd_uint(page, start, off, count, eof, nr);
10779 -+ if (ns_connect_lru_resize(ns))
10780 -+ nr = &ns->ns_nr_unused;
10781 -+ return lprocfs_uint_seq_show(m, nr);
10782 - }
10783 -
10784 --static int lprocfs_wr_lru_size(struct file *file, const char *buffer,
10785 -- unsigned long count, void *data)
10786 -+static ssize_t lprocfs_lru_size_seq_write(struct file *file, const char *buffer,
10787 -+ size_t count, loff_t *off)
10788 - {
10789 -- struct ldlm_namespace *ns = data;
10790 -+ struct ldlm_namespace *ns = ((struct seq_file *)file->private_data)->private;
10791 - char dummy[MAX_STRING_SIZE + 1], *end;
10792 - unsigned long tmp;
10793 - int lru_resize;
10794 -@@ -280,20 +286,20 @@ static int lprocfs_wr_lru_size(struct file *file, const char *buffer,
10795 -
10796 - return count;
10797 - }
10798 -+LPROC_SEQ_FOPS(lprocfs_lru_size);
10799 -
10800 --static int lprocfs_rd_elc(char *page, char **start, off_t off,
10801 -- int count, int *eof, void *data)
10802 -+static int lprocfs_elc_seq_show(struct seq_file *m, void *v)
10803 - {
10804 -- struct ldlm_namespace *ns = data;
10805 -+ struct ldlm_namespace *ns = m->private;
10806 - unsigned int supp = ns_connect_cancelset(ns);
10807 -
10808 -- return lprocfs_rd_uint(page, start, off, count, eof, &supp);
10809 -+ return lprocfs_uint_seq_show(m, &supp);
10810 - }
10811 -
10812 --static int lprocfs_wr_elc(struct file *file, const char *buffer,
10813 -- unsigned long count, void *data)
10814 -+static ssize_t lprocfs_elc_seq_write(struct file *file, const char *buffer,
10815 -+ size_t count, loff_t *off)
10816 - {
10817 -- struct ldlm_namespace *ns = data;
10818 -+ struct ldlm_namespace *ns = ((struct seq_file *)file->private_data)->private;
10819 - unsigned int supp = -1;
10820 - int rc;
10821 -
10822 -@@ -307,31 +313,38 @@ static int lprocfs_wr_elc(struct file *file, const char *buffer,
10823 - ns->ns_connect_flags |= OBD_CONNECT_CANCELSET;
10824 - return count;
10825 - }
10826 -+LPROC_SEQ_FOPS(lprocfs_elc);
10827 -
10828 - void ldlm_namespace_proc_unregister(struct ldlm_namespace *ns)
10829 - {
10830 -- struct proc_dir_entry *dir;
10831 --
10832 -- dir = lprocfs_srch(ldlm_ns_proc_dir, ldlm_ns_name(ns));
10833 -- if (dir == NULL) {
10834 -+ if (ns->ns_proc_dir_entry == NULL)
10835 - CERROR("dlm namespace %s has no procfs dir?\n",
10836 - ldlm_ns_name(ns));
10837 -- } else {
10838 -- lprocfs_remove(&dir);
10839 -- }
10840 -+ else
10841 -+ lprocfs_remove(&ns->ns_proc_dir_entry);
10842 -
10843 -- if (ns->ns_stats != NULL)
10844 -- lprocfs_free_stats(&ns->ns_stats);
10845 -+ if (ns->ns_stats != NULL)
10846 -+ lprocfs_free_stats(&ns->ns_stats);
10847 - }
10848 -
10849 - int ldlm_namespace_proc_register(struct ldlm_namespace *ns)
10850 - {
10851 -- struct lprocfs_vars lock_vars[2];
10852 -+ struct lprocfs_seq_vars lock_vars[2];
10853 - char lock_name[MAX_STRING_SIZE + 1];
10854 -+ struct proc_dir_entry *ns_pde;
10855 -
10856 - LASSERT(ns != NULL);
10857 - LASSERT(ns->ns_rs_hash != NULL);
10858 -
10859 -+ if (ns->ns_proc_dir_entry != NULL) {
10860 -+ ns_pde = ns->ns_proc_dir_entry;
10861 -+ } else {
10862 -+ ns_pde = proc_mkdir(ldlm_ns_name(ns), ldlm_ns_proc_dir);
10863 -+ if (ns_pde == NULL)
10864 -+ return -ENOMEM;
10865 -+ ns->ns_proc_dir_entry = ns_pde;
10866 -+ }
10867 -+
10868 - ns->ns_stats = lprocfs_alloc_stats(LDLM_NSS_LAST, 0);
10869 - if (ns->ns_stats == NULL)
10870 - return -ENOMEM;
10871 -@@ -344,88 +357,35 @@ int ldlm_namespace_proc_register(struct ldlm_namespace *ns)
10872 - memset(lock_vars, 0, sizeof(lock_vars));
10873 - lock_vars[0].name = lock_name;
10874 -
10875 -- snprintf(lock_name, MAX_STRING_SIZE, "%s/resource_count",
10876 -- ldlm_ns_name(ns));
10877 -- lock_vars[0].data = ns;
10878 -- lock_vars[0].read_fptr = lprocfs_rd_ns_resources;
10879 -- lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
10880 --
10881 -- snprintf(lock_name, MAX_STRING_SIZE, "%s/lock_count",
10882 -- ldlm_ns_name(ns));
10883 -- lock_vars[0].data = ns;
10884 -- lock_vars[0].read_fptr = lprocfs_rd_ns_locks;
10885 -- lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
10886 --
10887 -- if (ns_is_client(ns)) {
10888 -- snprintf(lock_name, MAX_STRING_SIZE, "%s/lock_unused_count",
10889 -- ldlm_ns_name(ns));
10890 -- lock_vars[0].data = &ns->ns_nr_unused;
10891 -- lock_vars[0].read_fptr = lprocfs_rd_uint;
10892 -- lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
10893 --
10894 -- snprintf(lock_name, MAX_STRING_SIZE, "%s/lru_size",
10895 -- ldlm_ns_name(ns));
10896 -- lock_vars[0].data = ns;
10897 -- lock_vars[0].read_fptr = lprocfs_rd_lru_size;
10898 -- lock_vars[0].write_fptr = lprocfs_wr_lru_size;
10899 -- lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
10900 --
10901 -- snprintf(lock_name, MAX_STRING_SIZE, "%s/lru_max_age",
10902 -- ldlm_ns_name(ns));
10903 -- lock_vars[0].data = &ns->ns_max_age;
10904 -- lock_vars[0].read_fptr = lprocfs_rd_uint;
10905 -- lock_vars[0].write_fptr = lprocfs_wr_uint;
10906 -- lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
10907 --
10908 -- snprintf(lock_name, MAX_STRING_SIZE, "%s/early_lock_cancel",
10909 -- ldlm_ns_name(ns));
10910 -- lock_vars[0].data = ns;
10911 -- lock_vars[0].read_fptr = lprocfs_rd_elc;
10912 -- lock_vars[0].write_fptr = lprocfs_wr_elc;
10913 -- lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
10914 -- } else {
10915 -- snprintf(lock_name, MAX_STRING_SIZE, "%s/ctime_age_limit",
10916 -- ldlm_ns_name(ns));
10917 -- lock_vars[0].data = &ns->ns_ctime_age_limit;
10918 -- lock_vars[0].read_fptr = lprocfs_rd_uint;
10919 -- lock_vars[0].write_fptr = lprocfs_wr_uint;
10920 -- lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
10921 --
10922 -- snprintf(lock_name, MAX_STRING_SIZE, "%s/lock_timeouts",
10923 -- ldlm_ns_name(ns));
10924 -- lock_vars[0].data = &ns->ns_timeouts;
10925 -- lock_vars[0].read_fptr = lprocfs_rd_uint;
10926 -- lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
10927 --
10928 -- snprintf(lock_name, MAX_STRING_SIZE, "%s/max_nolock_bytes",
10929 -- ldlm_ns_name(ns));
10930 -- lock_vars[0].data = &ns->ns_max_nolock_size;
10931 -- lock_vars[0].read_fptr = lprocfs_rd_uint;
10932 -- lock_vars[0].write_fptr = lprocfs_wr_uint;
10933 -- lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
10934 --
10935 -- snprintf(lock_name, MAX_STRING_SIZE, "%s/contention_seconds",
10936 -- ldlm_ns_name(ns));
10937 -- lock_vars[0].data = &ns->ns_contention_time;
10938 -- lock_vars[0].read_fptr = lprocfs_rd_uint;
10939 -- lock_vars[0].write_fptr = lprocfs_wr_uint;
10940 -- lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
10941 --
10942 -- snprintf(lock_name, MAX_STRING_SIZE, "%s/contended_locks",
10943 -- ldlm_ns_name(ns));
10944 -- lock_vars[0].data = &ns->ns_contended_locks;
10945 -- lock_vars[0].read_fptr = lprocfs_rd_uint;
10946 -- lock_vars[0].write_fptr = lprocfs_wr_uint;
10947 -- lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
10948 --
10949 -- snprintf(lock_name, MAX_STRING_SIZE, "%s/max_parallel_ast",
10950 -- ldlm_ns_name(ns));
10951 -- lock_vars[0].data = &ns->ns_max_parallel_ast;
10952 -- lock_vars[0].read_fptr = lprocfs_rd_uint;
10953 -- lock_vars[0].write_fptr = lprocfs_wr_uint;
10954 -- lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0);
10955 -- }
10956 -- return 0;
10957 -+ ldlm_add_var(&lock_vars[0], ns_pde, "resource_count", ns,
10958 -+ &lprocfs_ns_resources_fops);
10959 -+ ldlm_add_var(&lock_vars[0], ns_pde, "lock_count", ns,
10960 -+ &lprocfs_ns_locks_fops);
10961 -+
10962 -+ if (ns_is_client(ns)) {
10963 -+ ldlm_add_var(&lock_vars[0], ns_pde, "lock_unused_count",
10964 -+ &ns->ns_nr_unused, &ldlm_uint_fops);
10965 -+ ldlm_add_var(&lock_vars[0], ns_pde, "lru_size", ns,
10966 -+ &lprocfs_lru_size_fops);
10967 -+ ldlm_add_var(&lock_vars[0], ns_pde, "lru_max_age",
10968 -+ &ns->ns_max_age, &ldlm_rw_uint_fops);
10969 -+ ldlm_add_var(&lock_vars[0], ns_pde, "early_lock_cancel",
10970 -+ ns, &lprocfs_elc_fops);
10971 -+ } else {
10972 -+ ldlm_add_var(&lock_vars[0], ns_pde, "ctime_age_limit",
10973 -+ &ns->ns_ctime_age_limit, &ldlm_rw_uint_fops);
10974 -+ ldlm_add_var(&lock_vars[0], ns_pde, "lock_timeouts",
10975 -+ &ns->ns_timeouts, &ldlm_uint_fops);
10976 -+ ldlm_add_var(&lock_vars[0], ns_pde, "max_nolock_bytes",
10977 -+ &ns->ns_max_nolock_size, &ldlm_rw_uint_fops);
10978 -+ ldlm_add_var(&lock_vars[0], ns_pde, "contention_seconds",
10979 -+ &ns->ns_contention_time, &ldlm_rw_uint_fops);
10980 -+ ldlm_add_var(&lock_vars[0], ns_pde, "contended_locks",
10981 -+ &ns->ns_contended_locks, &ldlm_rw_uint_fops);
10982 -+ ldlm_add_var(&lock_vars[0], ns_pde, "max_parallel_ast",
10983 -+ &ns->ns_max_parallel_ast, &ldlm_rw_uint_fops);
10984 -+ }
10985 -+ return 0;
10986 - }
10987 - #undef MAX_STRING_SIZE
10988 - #else /* LPROCFS */
10989 ---
10990 -1.8.5.1
10991 -
10992
10993 diff --git a/sys-cluster/lustre/files/0016-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch b/sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
10994 similarity index 90%
10995 rename from sys-cluster/lustre/files/0016-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
10996 rename to sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
10997 index 3bc1eb5..efaca78 100644
10998 --- a/sys-cluster/lustre/files/0016-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
10999 +++ b/sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
11000 @@ -1,7 +1,7 @@
11001 -From 2110d1028da0bab44e1b3494ba4642155195a735 Mon Sep 17 00:00:00 2001
11002 +From 44996aad332f6a30634b651c6e5fe92c01923090 Mon Sep 17 00:00:00 2001
11003 From: James Simmons <uja.ornl@×××××.com>
11004 -Date: Mon, 2 Dec 2013 12:36:06 -0500
11005 -Subject: [PATCH 16/18] LU-3319 procfs: move mdt/mds proc handling to seq_files
11006 +Date: Fri, 31 Jan 2014 10:47:37 -0500
11007 +Subject: [PATCH 08/13] LU-3319 procfs: move mdt/mds proc handling to seq_files
11008
11009 With 3.10 linux kernel and above proc handling now only
11010 uses struct seq_files. This patch migrates the mdt/mds
11011 @@ -9,20 +9,19 @@ layer proc entries over to using seq_files.
11012
11013 Signed-off-by: James Simmons <uja.ornl@×××××.com>
11014 Change-Id: Icbafdcd2c2fe3959a51dda3f9c715b0ff8d95742
11015 -Signed-off-by: Alexey Shvetsov <alexxy@g.o>
11016 ---
11017 - lustre/mdt/mdt_coordinator.c | 246 +++++++---------
11018 + lustre/mdt/mdt_coordinator.c | 259 +++++++--------
11019 lustre/mdt/mdt_handler.c | 16 +-
11020 lustre/mdt/mdt_hsm_cdt_actions.c | 5 +-
11021 lustre/mdt/mdt_hsm_cdt_agent.c | 5 +-
11022 lustre/mdt/mdt_hsm_cdt_requests.c | 5 +-
11023 lustre/mdt/mdt_internal.h | 14 +-
11024 - lustre/mdt/mdt_lproc.c | 603 ++++++++++++++++++--------------------
11025 + lustre/mdt/mdt_lproc.c | 639 ++++++++++++++++++--------------------
11026 lustre/mdt/mdt_mds.c | 12 +-
11027 - 8 files changed, 401 insertions(+), 505 deletions(-)
11028 + 8 files changed, 442 insertions(+), 513 deletions(-)
11029
11030 diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c
11031 -index 3915e21..eb05bdf 100644
11032 +index 037bcbd..9bbcbd4 100644
11033 --- a/lustre/mdt/mdt_coordinator.c
11034 +++ b/lustre/mdt/mdt_coordinator.c
11035 @@ -46,7 +46,7 @@
11036 @@ -52,7 +51,7 @@ index 3915e21..eb05bdf 100644
11037 {
11038 return lprocfs_mdt_hsm_vars;
11039 }
11040 -@@ -1769,22 +1769,17 @@ static __u64 hsm_policy_str2bit(const char *name)
11041 +@@ -1786,22 +1786,17 @@ static __u64 hsm_policy_str2bit(const char *name)
11042 * \param hexa [IN] print mask before bit names
11043 * \param buffer [OUT] string
11044 * \param count [IN] size of buffer
11045 @@ -81,7 +80,7 @@ index 3915e21..eb05bdf 100644
11046 for (i = 0; i < CDT_POLICY_SHIFT_COUNT; i++) {
11047 bit = (1ULL << i);
11048
11049 -@@ -1793,48 +1788,34 @@ static int hsm_policy_bit2str(const __u64 mask, const bool hexa, char *buffer,
11050 +@@ -1810,48 +1805,34 @@ static int hsm_policy_bit2str(const __u64 mask, const bool hexa, char *buffer,
11051 break;
11052 }
11053 if (bit & mask)
11054 @@ -141,7 +140,7 @@ index 3915e21..eb05bdf 100644
11055 int rc;
11056 ENTRY;
11057
11058 -@@ -1867,18 +1848,10 @@ static int lprocfs_wr_hsm_policy(struct file *file, const char *buffer,
11059 +@@ -1884,18 +1865,10 @@ static int lprocfs_wr_hsm_policy(struct file *file, const char *buffer,
11060
11061 policy = hsm_policy_str2bit(token);
11062 if (policy == 0) {
11063 @@ -163,7 +162,7 @@ index 3915e21..eb05bdf 100644
11064 GOTO(out, rc = -EINVAL);
11065 }
11066 switch (sign) {
11067 -@@ -1917,25 +1890,24 @@ out:
11068 +@@ -1934,25 +1907,24 @@ out:
11069 OBD_FREE(buf, count + 1);
11070 RETURN(rc);
11071 }
11072 @@ -198,7 +197,7 @@ index 3915e21..eb05bdf 100644
11073 struct coordinator *cdt = &mdt->mdt_coordinator; \
11074 int val; \
11075 int rc; \
11076 -@@ -1949,7 +1921,7 @@ static int lprocfs_wr_hsm_##VAR(struct file *file, const char *buffer, \
11077 +@@ -1966,7 +1938,7 @@ static int lprocfs_wr_hsm_##VAR(struct file *file, const char *buffer, \
11078 RETURN(count); \
11079 } \
11080 RETURN(-EINVAL); \
11081 @@ -207,7 +206,7 @@ index 3915e21..eb05bdf 100644
11082
11083 GENERATE_PROC_METHOD(cdt_loop_period)
11084 GENERATE_PROC_METHOD(cdt_grace_delay)
11085 -@@ -1967,10 +1939,11 @@ GENERATE_PROC_METHOD(cdt_default_archive_id)
11086 +@@ -1984,10 +1956,11 @@ GENERATE_PROC_METHOD(cdt_default_archive_id)
11087 #define CDT_PURGE_CMD "purge"
11088 #define CDT_HELP_CMD "help"
11089
11090 @@ -222,7 +221,7 @@ index 3915e21..eb05bdf 100644
11091 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
11092 struct coordinator *cdt = &(mdt->mdt_coordinator);
11093 int rc, usage = 0;
11094 -@@ -2024,83 +1997,71 @@ int lprocfs_wr_hsm_cdt_control(struct file *file, const char *buffer,
11095 +@@ -2041,83 +2014,71 @@ int lprocfs_wr_hsm_cdt_control(struct file *file, const char *buffer,
11096 RETURN(count);
11097 }
11098
11099 @@ -328,7 +327,7 @@ index 3915e21..eb05bdf 100644
11100 }
11101
11102 static inline enum hsm_copytool_action
11103 -@@ -2120,9 +2081,9 @@ hsm_copytool_name2action(const char *name)
11104 +@@ -2137,9 +2098,9 @@ hsm_copytool_name2action(const char *name)
11105 return -1;
11106 }
11107
11108 @@ -341,7 +340,7 @@ index 3915e21..eb05bdf 100644
11109 {
11110 char *buf, *pos, *name;
11111 size_t buf_size;
11112 -@@ -2166,69 +2127,60 @@ out:
11113 +@@ -2183,69 +2144,73 @@ out:
11114 RETURN(rc);
11115 }
11116
11117 @@ -434,25 +433,38 @@ index 3915e21..eb05bdf 100644
11118 +LPROC_SEQ_FOPS(mdt_hsm_other_request_mask);
11119 +
11120 +static struct lprocfs_seq_vars lprocfs_mdt_hsm_vars[] = {
11121 -+ { "agents", &mdt_hsm_agent_fops },
11122 -+ { "actions", &mdt_hsm_actions_fops, NULL, 0444 },
11123 -+ { "default_archive_id", &mdt_hsm_cdt_default_archive_id_fops },
11124 -+ { "grace_delay", &mdt_hsm_cdt_grace_delay_fops },
11125 -+ { "loop_period", &mdt_hsm_cdt_loop_period_fops },
11126 -+ { "max_requests", &mdt_hsm_cdt_max_requests_fops },
11127 -+ { "policy", &mdt_hsm_policy_fops },
11128 -+ { "active_request_timeout",&mdt_hsm_cdt_active_req_timeout_fops },
11129 -+ { "active_requests", &mdt_hsm_active_requests_fops },
11130 -+ { "user_request_mask", &mdt_hsm_user_request_mask_fops, },
11131 -+ { "group_request_mask", &mdt_hsm_group_request_mask_fops, },
11132 -+ { "other_request_mask", &mdt_hsm_other_request_mask_fops, },
11133 ++ { .name = "agents",
11134 ++ .fops = &mdt_hsm_agent_fops },
11135 ++ { .name = "actions",
11136 ++ .fops = &mdt_hsm_actions_fops,
11137 ++ .proc_mode = 0444 },
11138 ++ { .name = "default_archive_id",
11139 ++ .fops = &mdt_hsm_cdt_default_archive_id_fops },
11140 ++ { .name = "grace_delay",
11141 ++ .fops = &mdt_hsm_cdt_grace_delay_fops },
11142 ++ { .name = "loop_period",
11143 ++ .fops = &mdt_hsm_cdt_loop_period_fops },
11144 ++ { .name = "max_requests",
11145 ++ .fops = &mdt_hsm_cdt_max_requests_fops },
11146 ++ { .name = "policy",
11147 ++ .fops = &mdt_hsm_policy_fops },
11148 ++ { .name = "active_request_timeout",
11149 ++ .fops = &mdt_hsm_cdt_active_req_timeout_fops },
11150 ++ { .name = "active_requests",
11151 ++ .fops = &mdt_hsm_active_requests_fops },
11152 ++ { .name = "user_request_mask",
11153 ++ .fops = &mdt_hsm_user_request_mask_fops, },
11154 ++ { .name = "group_request_mask",
11155 ++ .fops = &mdt_hsm_group_request_mask_fops, },
11156 ++ { .name = "other_request_mask",
11157 ++ .fops = &mdt_hsm_other_request_mask_fops, },
11158 { 0 }
11159 };
11160 diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c
11161 -index 8daf7e1..9f7d4ba 100644
11162 +index 4c386b1..273cb80 100644
11163 --- a/lustre/mdt/mdt_handler.c
11164 +++ b/lustre/mdt/mdt_handler.c
11165 -@@ -4508,7 +4508,6 @@ static int mdt_process_config(const struct lu_env *env,
11166 +@@ -4538,7 +4538,6 @@ static int mdt_process_config(const struct lu_env *env,
11167
11168 switch (cfg->lcfg_command) {
11169 case LCFG_PARAM: {
11170 @@ -460,7 +472,7 @@ index 8daf7e1..9f7d4ba 100644
11171 struct obd_device *obd = d->ld_obd;
11172
11173 /* For interoperability */
11174 -@@ -4543,14 +4542,13 @@ static int mdt_process_config(const struct lu_env *env,
11175 +@@ -4573,14 +4572,13 @@ static int mdt_process_config(const struct lu_env *env,
11176 }
11177 }
11178
11179 @@ -480,7 +492,7 @@ index 8daf7e1..9f7d4ba 100644
11180 if (rc > 0 || rc == -ENOSYS)
11181 /* we don't understand; pass it on */
11182 rc = next->ld_ops->ldo_process_config(env, next,
11183 -@@ -5725,7 +5723,6 @@ static struct lu_device_type mdt_device_type = {
11184 +@@ -5759,7 +5757,6 @@ static struct lu_device_type mdt_device_type = {
11185
11186 static int __init mdt_mod_init(void)
11187 {
11188 @@ -488,7 +500,7 @@ index 8daf7e1..9f7d4ba 100644
11189 int rc;
11190
11191 CLASSERT(sizeof("0x0123456789ABCDEF:0x01234567:0x01234567") ==
11192 -@@ -5740,10 +5737,9 @@ static int __init mdt_mod_init(void)
11193 +@@ -5774,10 +5771,9 @@ static int __init mdt_mod_init(void)
11194 if (rc)
11195 GOTO(lu_fini, rc);
11196
11197 @@ -566,10 +578,10 @@ index 796cbea..7bbc771 100644
11198 RETURN(rc);
11199 }
11200 diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h
11201 -index dd36201..43cf9eb 100644
11202 +index d548988..e30d78d 100644
11203 --- a/lustre/mdt/mdt_internal.h
11204 +++ b/lustre/mdt/mdt_internal.h
11205 -@@ -778,9 +778,6 @@ void mdt_thread_info_init(struct ptlrpc_request *req,
11206 +@@ -784,9 +784,6 @@ void mdt_thread_info_init(struct ptlrpc_request *req,
11207 void mdt_thread_info_fini(struct mdt_thread_info *mti);
11208 struct mdt_thread_info *tsi2mdt_info(struct tgt_session_info *tsi);
11209
11210 @@ -579,7 +591,7 @@ index dd36201..43cf9eb 100644
11211 int mdt_hsm_attr_set(struct mdt_thread_info *info, struct mdt_object *obj,
11212 const struct md_hsm *mh);
11213
11214 -@@ -913,13 +910,12 @@ int mdt_hsm_cdt_fini(struct mdt_device *mdt);
11215 +@@ -919,13 +916,12 @@ int mdt_hsm_cdt_fini(struct mdt_device *mdt);
11216 int mdt_hsm_cdt_wakeup(struct mdt_device *mdt);
11217
11218 /* coordinator control /proc interface */
11219 @@ -597,7 +609,7 @@ index dd36201..43cf9eb 100644
11220 /* md_hsm helpers */
11221 struct mdt_object *mdt_hsm_get_md_hsm(struct mdt_thread_info *mti,
11222 const struct lu_fid *fid,
11223 -@@ -1087,8 +1083,6 @@ enum {
11224 +@@ -1065,8 +1061,6 @@ enum {
11225 };
11226 void mdt_counter_incr(struct ptlrpc_request *req, int opcode);
11227 void mdt_stats_counter_init(struct lprocfs_stats *stats);
11228 @@ -605,9 +617,9 @@ index dd36201..43cf9eb 100644
11229 -void lprocfs_mds_init_vars(struct lprocfs_static_vars *lvars);
11230 int mdt_procfs_init(struct mdt_device *mdt, const char *name);
11231 void mdt_procfs_fini(struct mdt_device *mdt);
11232 - void mdt_rename_counter_tally(struct mdt_thread_info *info,
11233 +
11234 diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c
11235 -index 4abb532..236b6c2 100644
11236 +index 0ee5148..658f00d 100644
11237 --- a/lustre/mdt/mdt_lproc.c
11238 +++ b/lustre/mdt/mdt_lproc.c
11239 @@ -156,7 +156,6 @@ static ssize_t mdt_rename_stats_seq_write(struct file *file, const char *buf,
11240 @@ -623,7 +635,8 @@ index 4abb532..236b6c2 100644
11241 }
11242
11243 -int mdt_procfs_init(struct mdt_device *mdt, const char *name)
11244 --{
11245 ++static int mdt_identity_expire_seq_show(struct seq_file *m, void *data)
11246 + {
11247 - struct obd_device *obd = mdt2obd_dev(mdt);
11248 - struct lprocfs_static_vars lvars;
11249 - int rc;
11250 @@ -687,8 +700,7 @@ index 4abb532..236b6c2 100644
11251 -
11252 -static int lprocfs_rd_identity_expire(char *page, char **start, off_t off,
11253 - int count, int *eof, void *data)
11254 -+static int mdt_identity_expire_seq_show(struct seq_file *m, void *data)
11255 - {
11256 +-{
11257 - struct obd_device *obd = data;
11258 - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
11259 + struct obd_device *obd = m->private;
11260 @@ -838,6 +850,15 @@ index 4abb532..236b6c2 100644
11261 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
11262 struct identity_downcall_data *param;
11263 int size = sizeof(*param), rc, checked = 0;
11264 +@@ -415,7 +348,7 @@ static int lprocfs_wr_identity_info(struct file *file, const char *buffer,
11265 + again:
11266 + if (count < size) {
11267 + CERROR("%s: invalid data count = %lu, size = %d\n",
11268 +- mdt_obd_name(mdt), count, size);
11269 ++ mdt_obd_name(mdt), (unsigned long) count, size);
11270 + return -EINVAL;
11271 + }
11272 +
11273 @@ -468,23 +401,24 @@ out:
11274
11275 return rc ? rc : count;
11276 @@ -1235,7 +1256,7 @@ index 4abb532..236b6c2 100644
11277 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
11278 __u32 val;
11279 int rc;
11280 -@@ -957,97 +899,46 @@ static int lprocfs_wr_enable_remote_dir_gid(struct file *file,
11281 +@@ -957,97 +899,72 @@ static int lprocfs_wr_enable_remote_dir_gid(struct file *file,
11282 mdt->mdt_enable_remote_dir_gid = val;
11283 return count;
11284 }
11285 @@ -1344,36 +1365,85 @@ index 4abb532..236b6c2 100644
11286 +LPROC_SEQ_FOPS(mdt_hsm_cdt_control);
11287 +
11288 +static struct lprocfs_seq_vars lprocfs_mdt_obd_vars[] = {
11289 -+ { "uuid", &mdt_uuid_fops },
11290 -+ { "recovery_status", &mdt_recovery_status_fops },
11291 -+ { "num_exports", &mdt_num_exports_fops },
11292 -+ { "identity_expire", &mdt_identity_expire_fops },
11293 -+ { "identity_acquire_expire", &mdt_identity_acquire_expire_fops },
11294 -+ { "identity_upcall", &mdt_identity_upcall_fops },
11295 -+ { "identity_flush", &mdt_identity_flush_fops },
11296 -+ { "identity_info", &mdt_identity_info_fops },
11297 -+ { "capa", &mdt_capa_fops },
11298 -+ { "capa_timeout", &mdt_capa_timeout_fops },
11299 -+ { "capa_key_timeout", &mdt_ck_timeout_fops },
11300 -+ { "capa_count", &mdt_capa_count_fops },
11301 -+ { "site_stats", &mdt_site_stats_fops },
11302 -+ { "evict_client", &mdt_mds_evict_client_fops },
11303 -+ { "hash_stats", &mdt_hash_fops },
11304 -+ { "sec_level", &mdt_sec_level_fops },
11305 -+ { "commit_on_sharing", &mdt_cos_fops },
11306 -+ { "root_squash", &mdt_root_squash_fops },
11307 -+ { "nosquash_nids", &mdt_nosquash_nids_fops },
11308 -+ { "som", &mdt_som_fops },
11309 -+ { "instance", &mdt_target_instance_fops },
11310 -+ { "ir_factor", &mdt_ir_factor_fops },
11311 -+ { "job_cleanup_interval", &mdt_job_interval_fops },
11312 -+ { "enable_remote_dir", &mdt_enable_remote_dir_fops },
11313 -+ { "enable_remote_dir_gid", &mdt_enable_remote_dir_gid_fops },
11314 -+ { "hsm_control", &mdt_hsm_cdt_control_fops },
11315 ++ { .name = "uuid",
11316 ++ .fops = &mdt_uuid_fops },
11317 ++ { .name = "recovery_status",
11318 ++ .fops = &mdt_recovery_status_fops },
11319 ++ { .name = "num_exports",
11320 ++ .fops = &mdt_num_exports_fops },
11321 ++ { .name = "identity_expire",
11322 ++ .fops = &mdt_identity_expire_fops },
11323 ++ { .name = "identity_acquire_expire",
11324 ++ .fops = &mdt_identity_acquire_expire_fops },
11325 ++ { .name = "identity_upcall",
11326 ++ .fops = &mdt_identity_upcall_fops },
11327 ++ { .name = "identity_flush",
11328 ++ .fops = &mdt_identity_flush_fops },
11329 ++ { .name = "identity_info",
11330 ++ .fops = &mdt_identity_info_fops },
11331 ++ { .name = "capa",
11332 ++ .fops = &mdt_capa_fops },
11333 ++ { .name = "capa_timeout",
11334 ++ .fops = &mdt_capa_timeout_fops },
11335 ++ { .name = "capa_key_timeout",
11336 ++ .fops = &mdt_ck_timeout_fops },
11337 ++ { .name = "capa_count",
11338 ++ .fops = &mdt_capa_count_fops },
11339 ++ { .name = "site_stats",
11340 ++ .fops = &mdt_site_stats_fops },
11341 ++ { .name = "evict_client",
11342 ++ .fops = &mdt_mds_evict_client_fops },
11343 ++ { .name = "hash_stats",
11344 ++ .fops = &mdt_hash_fops },
11345 ++ { .name = "sec_level",
11346 ++ .fops = &mdt_sec_level_fops },
11347 ++ { .name = "commit_on_sharing",
11348 ++ .fops = &mdt_cos_fops },
11349 ++ { .name = "root_squash",
11350 ++ .fops = &mdt_root_squash_fops },
11351 ++ { .name = "nosquash_nids",
11352 ++ .fops = &mdt_nosquash_nids_fops },
11353 ++ { .name = "som",
11354 ++ .fops = &mdt_som_fops },
11355 ++ { .name = "instance",
11356 ++ .fops = &mdt_target_instance_fops },
11357 ++ { .name = "ir_factor",
11358 ++ .fops = &mdt_ir_factor_fops },
11359 ++ { .name = "job_cleanup_interval",
11360 ++ .fops = &mdt_job_interval_fops },
11361 ++ { .name = "enable_remote_dir",
11362 ++ .fops = &mdt_enable_remote_dir_fops },
11363 ++ { .name = "enable_remote_dir_gid",
11364 ++ .fops = &mdt_enable_remote_dir_gid_fops },
11365 ++ { .name = "hsm_control",
11366 ++ .fops = &mdt_hsm_cdt_control_fops },
11367 { 0 }
11368 };
11369
11370 -@@ -1087,3 +978,67 @@ void mdt_stats_counter_init(struct lprocfs_stats *stats)
11371 +@@ -1085,21 +1002,15 @@ int lprocfs_mdt_open_files_seq_show(struct seq_file *seq, void *v)
11372 +
11373 + int lprocfs_mdt_open_files_seq_open(struct inode *inode, struct file *file)
11374 + {
11375 +- struct proc_dir_entry *dp = PDE(inode);
11376 + struct seq_file *seq;
11377 +- struct nid_stat *tmp;
11378 + int rc;
11379 +
11380 +- if (LPROCFS_ENTRY_CHECK(dp))
11381 +- return -ENOENT;
11382 +-
11383 +- tmp = dp->data;
11384 + rc = single_open(file, &lprocfs_mdt_open_files_seq_show, NULL);
11385 + if (rc != 0)
11386 + return rc;
11387 +
11388 + seq = file->private_data;
11389 +- seq->private = tmp;
11390 ++ seq->private = PDE_DATA(inode);
11391 +
11392 + return 0;
11393 + }
11394 +@@ -1140,3 +1051,67 @@ void mdt_stats_counter_init(struct lprocfs_stats *stats)
11395 lprocfs_counter_init(stats, LPROC_MDT_CROSSDIR_RENAME, 0,
11396 "crossdir_rename", "reqs");
11397 }
11398 @@ -1479,5 +1549,5 @@ index 367f659..4fa66c3 100644
11399 LUSTRE_MDS_NAME, &mds_device_type);
11400 }
11401 --
11402 -1.8.5.1
11403 +1.8.5.3
11404
11405
11406 diff --git a/sys-cluster/lustre/files/0009-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch b/sys-cluster/lustre/files/0009-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch
11407 new file mode 100644
11408 index 0000000..e289134
11409 --- /dev/null
11410 +++ b/sys-cluster/lustre/files/0009-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch
11411 @@ -0,0 +1,1928 @@
11412 +From 075cf04c212e2bf0f38c94433a80bca2e5bb051e Mon Sep 17 00:00:00 2001
11413 +From: James Simmons <uja.ornl@×××××.com>
11414 +Date: Fri, 31 Jan 2014 14:00:32 -0500
11415 +Subject: [PATCH 09/13] LU-3319 procfs: move mdd/ofd proc handling to seq_files
11416 +
11417 +With 3.10 linux kernel and above proc handling now only
11418 +uses struct seq_files. This patch migrates the mdd/ofd
11419 +layer proc entries over to using seq_files.
11420 +
11421 +Signed-off-by: James Simmons <uja.ornl@×××××.com>
11422 +Change-Id: I61b7df6bfd5efd0f12e3ca1a1813b7b62d493168
11423 +---
11424 + lustre/include/lustre_lfsck.h | 6 +-
11425 + lustre/lfsck/lfsck_internal.h | 9 +-
11426 + lustre/lfsck/lfsck_layout.c | 66 ++----
11427 + lustre/lfsck/lfsck_lib.c | 77 +++----
11428 + lustre/lfsck/lfsck_namespace.c | 75 ++-----
11429 + lustre/mdd/mdd_device.c | 25 +--
11430 + lustre/mdd/mdd_internal.h | 1 -
11431 + lustre/mdd/mdd_lproc.c | 293 ++++++++++++--------------
11432 + lustre/obdclass/lprocfs_status.c | 9 +-
11433 + lustre/ofd/lproc_ofd.c | 436 ++++++++++++++++++++-------------------
11434 + lustre/ofd/ofd_dev.c | 48 ++---
11435 + lustre/ofd/ofd_internal.h | 6 +-
11436 + lustre/osd-ldiskfs/osd_handler.c | 1 +
11437 + lustre/osd-zfs/osd_handler.c | 1 +
11438 + 14 files changed, 463 insertions(+), 590 deletions(-)
11439 +
11440 +diff --git a/lustre/include/lustre_lfsck.h b/lustre/include/lustre_lfsck.h
11441 +index 2e93420..0e578ac 100644
11442 +--- a/lustre/include/lustre_lfsck.h
11443 ++++ b/lustre/include/lustre_lfsck.h
11444 +@@ -156,11 +156,11 @@ int lfsck_in_notify(const struct lu_env *env, struct dt_device *key,
11445 + int lfsck_query(const struct lu_env *env, struct dt_device *key,
11446 + struct lfsck_request *lr);
11447 +
11448 +-int lfsck_get_speed(struct dt_device *key, void *buf, int len);
11449 ++int lfsck_get_speed(struct seq_file *m, struct dt_device *key);
11450 + int lfsck_set_speed(struct dt_device *key, int val);
11451 +-int lfsck_get_windows(struct dt_device *key, void *buf, int len);
11452 ++int lfsck_get_windows(struct seq_file *m, struct dt_device *key);
11453 + int lfsck_set_windows(struct dt_device *key, int val);
11454 +
11455 +-int lfsck_dump(struct dt_device *key, void *buf, int len, enum lfsck_type type);
11456 ++int lfsck_dump(struct seq_file *m, struct dt_device *key, enum lfsck_type type);
11457 +
11458 + #endif /* _LUSTRE_LFSCK_H */
11459 +diff --git a/lustre/lfsck/lfsck_internal.h b/lustre/lfsck/lfsck_internal.h
11460 +index 698fb5f..1893ccc 100644
11461 +--- a/lustre/lfsck/lfsck_internal.h
11462 ++++ b/lustre/lfsck/lfsck_internal.h
11463 +@@ -288,8 +288,7 @@ struct lfsck_operations {
11464 +
11465 + int (*lfsck_dump)(const struct lu_env *env,
11466 + struct lfsck_component *com,
11467 +- char *buf,
11468 +- int len);
11469 ++ struct seq_file *m);
11470 +
11471 + int (*lfsck_double_scan)(const struct lu_env *env,
11472 + struct lfsck_component *com);
11473 +@@ -539,10 +538,10 @@ void lfsck_component_cleanup(const struct lu_env *env,
11474 + struct lfsck_component *com);
11475 + void lfsck_instance_cleanup(const struct lu_env *env,
11476 + struct lfsck_instance *lfsck);
11477 +-int lfsck_bits_dump(char **buf, int *len, int bits, const char *names[],
11478 ++int lfsck_bits_dump(struct seq_file *m, int bits, const char *names[],
11479 + const char *prefix);
11480 +-int lfsck_time_dump(char **buf, int *len, __u64 time, const char *prefix);
11481 +-int lfsck_pos_dump(char **buf, int *len, struct lfsck_position *pos,
11482 ++int lfsck_time_dump(struct seq_file *m, __u64 time, const char *prefix);
11483 ++int lfsck_pos_dump(struct seq_file *m, struct lfsck_position *pos,
11484 + const char *prefix);
11485 + void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck,
11486 + struct lfsck_position *pos, bool init);
11487 +diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c
11488 +index e7c12d2..8b9c43e 100644
11489 +--- a/lustre/lfsck/lfsck_layout.c
11490 ++++ b/lustre/lfsck/lfsck_layout.c
11491 +@@ -2024,69 +2024,53 @@ static int lfsck_layout_slave_post(const struct lu_env *env,
11492 + }
11493 +
11494 + static int lfsck_layout_dump(const struct lu_env *env,
11495 +- struct lfsck_component *com, char *buf, int len)
11496 ++ struct lfsck_component *com, struct seq_file *m)
11497 + {
11498 + struct lfsck_instance *lfsck = com->lc_lfsck;
11499 + struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram;
11500 + struct lfsck_layout *lo = com->lc_file_ram;
11501 +- int save = len;
11502 +- int ret = -ENOSPC;
11503 + int rc;
11504 +
11505 + down_read(&com->lc_sem);
11506 +- rc = snprintf(buf, len,
11507 +- "name: lfsck_layout\n"
11508 ++ seq_printf(m, "name: lfsck_layout\n"
11509 + "magic: %#x\n"
11510 + "version: %d\n"
11511 + "status: %s\n",
11512 + lo->ll_magic,
11513 + bk->lb_version,
11514 + lfsck_status2names(lo->ll_status));
11515 +- if (rc <= 0)
11516 +- goto out;
11517 +
11518 +- buf += rc;
11519 +- len -= rc;
11520 +- rc = lfsck_bits_dump(&buf, &len, lo->ll_flags, lfsck_flags_names,
11521 +- "flags");
11522 ++ rc = lfsck_bits_dump(m, lo->ll_flags, lfsck_flags_names, "flags");
11523 + if (rc < 0)
11524 + goto out;
11525 +
11526 +- rc = lfsck_bits_dump(&buf, &len, bk->lb_param, lfsck_param_names,
11527 +- "param");
11528 ++ rc = lfsck_bits_dump(m, bk->lb_param, lfsck_param_names, "param");
11529 + if (rc < 0)
11530 + goto out;
11531 +
11532 +- rc = lfsck_time_dump(&buf, &len, lo->ll_time_last_complete,
11533 ++ rc = lfsck_time_dump(m, lo->ll_time_last_complete,
11534 + "time_since_last_completed");
11535 + if (rc < 0)
11536 + goto out;
11537 +
11538 +- rc = lfsck_time_dump(&buf, &len, lo->ll_time_latest_start,
11539 ++ rc = lfsck_time_dump(m, lo->ll_time_latest_start,
11540 + "time_since_latest_start");
11541 + if (rc < 0)
11542 + goto out;
11543 +
11544 +- rc = lfsck_time_dump(&buf, &len, lo->ll_time_last_checkpoint,
11545 ++ rc = lfsck_time_dump(m, lo->ll_time_last_checkpoint,
11546 + "time_since_last_checkpoint");
11547 + if (rc < 0)
11548 + goto out;
11549 +
11550 +- rc = snprintf(buf, len,
11551 +- "latest_start_position: "LPU64"\n"
11552 ++ seq_printf(m, "latest_start_position: "LPU64"\n"
11553 + "last_checkpoint_position: "LPU64"\n"
11554 + "first_failure_position: "LPU64"\n",
11555 + lo->ll_pos_latest_start,
11556 + lo->ll_pos_last_checkpoint,
11557 + lo->ll_pos_first_inconsistent);
11558 +- if (rc <= 0)
11559 +- goto out;
11560 +-
11561 +- buf += rc;
11562 +- len -= rc;
11563 +
11564 +- rc = snprintf(buf, len,
11565 +- "success_count: %u\n"
11566 ++ seq_printf(m, "success_count: %u\n"
11567 + "repaired_dangling: "LPU64"\n"
11568 + "repaired_unmatched_pair: "LPU64"\n"
11569 + "repaired_multiple_referenced: "LPU64"\n"
11570 +@@ -2106,11 +2090,6 @@ static int lfsck_layout_dump(const struct lu_env *env,
11571 + lo->ll_objs_skipped,
11572 + lo->ll_objs_failed_phase1,
11573 + lo->ll_objs_failed_phase2);
11574 +- if (rc <= 0)
11575 +- goto out;
11576 +-
11577 +- buf += rc;
11578 +- len -= rc;
11579 +
11580 + if (lo->ll_status == LS_SCANNING_PHASE1) {
11581 + __u64 pos;
11582 +@@ -2127,8 +2106,7 @@ static int lfsck_layout_dump(const struct lu_env *env,
11583 + do_div(new_checked, duration);
11584 + if (rtime != 0)
11585 + do_div(speed, rtime);
11586 +- rc = snprintf(buf, len,
11587 +- "checked_phase1: "LPU64"\n"
11588 ++ seq_printf(m, "checked_phase1: "LPU64"\n"
11589 + "checked_phase2: "LPU64"\n"
11590 + "run_time_phase1: %u seconds\n"
11591 + "run_time_phase2: %u seconds\n"
11592 +@@ -2142,11 +2120,6 @@ static int lfsck_layout_dump(const struct lu_env *env,
11593 + lo->ll_run_time_phase2,
11594 + speed,
11595 + new_checked);
11596 +- if (rc <= 0)
11597 +- goto out;
11598 +-
11599 +- buf += rc;
11600 +- len -= rc;
11601 +
11602 + LASSERT(lfsck->li_di_oit != NULL);
11603 +
11604 +@@ -2159,12 +2132,7 @@ static int lfsck_layout_dump(const struct lu_env *env,
11605 + pos = iops->store(env, lfsck->li_di_oit);
11606 + if (!lfsck->li_current_oit_processed)
11607 + pos--;
11608 +- rc = snprintf(buf, len, "current_position: "LPU64"\n", pos);
11609 +- if (rc <= 0)
11610 +- goto out;
11611 +-
11612 +- buf += rc;
11613 +- len -= rc;
11614 ++ seq_printf(m, "current_position: "LPU64"\n", pos);
11615 + } else {
11616 + /* XXX: LS_SCANNING_PHASE2 will be handled in the future. */
11617 + __u64 speed1 = lo->ll_objs_checked_phase1;
11618 +@@ -2174,8 +2142,7 @@ static int lfsck_layout_dump(const struct lu_env *env,
11619 + do_div(speed1, lo->ll_run_time_phase1);
11620 + if (lo->ll_run_time_phase2 != 0)
11621 + do_div(speed2, lo->ll_run_time_phase2);
11622 +- rc = snprintf(buf, len,
11623 +- "checked_phase1: "LPU64"\n"
11624 ++ seq_printf(m, "checked_phase1: "LPU64"\n"
11625 + "checked_phase2: "LPU64"\n"
11626 + "run_time_phase1: %u seconds\n"
11627 + "run_time_phase2: %u seconds\n"
11628 +@@ -2190,18 +2157,11 @@ static int lfsck_layout_dump(const struct lu_env *env,
11629 + lo->ll_run_time_phase2,
11630 + speed1,
11631 + speed2);
11632 +- if (rc <= 0)
11633 +- goto out;
11634 +-
11635 +- buf += rc;
11636 +- len -= rc;
11637 + }
11638 +- ret = save - len;
11639 +-
11640 + out:
11641 + up_read(&com->lc_sem);
11642 +
11643 +- return ret;
11644 ++ return rc;
11645 + }
11646 +
11647 + static int lfsck_layout_master_double_scan(const struct lu_env *env,
11648 +diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c
11649 +index ad92e32..747e376 100644
11650 +--- a/lustre/lfsck/lfsck_lib.c
11651 ++++ b/lustre/lfsck/lfsck_lib.c
11652 +@@ -424,77 +424,52 @@ static inline int lfsck_instance_add(struct lfsck_instance *lfsck)
11653 + return 0;
11654 + }
11655 +
11656 +-int lfsck_bits_dump(char **buf, int *len, int bits, const char *names[],
11657 ++int lfsck_bits_dump(struct seq_file *m, int bits, const char *names[],
11658 + const char *prefix)
11659 + {
11660 +- int save = *len;
11661 + int flag;
11662 +- int rc;
11663 + int i;
11664 +
11665 +- rc = snprintf(*buf, *len, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
11666 +- if (rc <= 0)
11667 +- return -ENOSPC;
11668 ++ seq_printf(m, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
11669 +
11670 +- *buf += rc;
11671 +- *len -= rc;
11672 + for (i = 0, flag = 1; bits != 0; i++, flag = 1 << i) {
11673 + if (flag & bits) {
11674 + bits &= ~flag;
11675 + if (names[i] != NULL) {
11676 +- rc = snprintf(*buf, *len, "%s%c", names[i],
11677 +- bits != 0 ? ',' : '\n');
11678 +- if (rc <= 0)
11679 +- return -ENOSPC;
11680 +-
11681 +- *buf += rc;
11682 +- *len -= rc;
11683 ++ seq_printf(m, "%s%c", names[i],
11684 ++ bits != 0 ? ',' : '\n');
11685 + }
11686 + }
11687 + }
11688 +- return save - *len;
11689 ++ return 0;
11690 + }
11691 +
11692 +-int lfsck_time_dump(char **buf, int *len, __u64 time, const char *prefix)
11693 ++int lfsck_time_dump(struct seq_file *m, __u64 time, const char *prefix)
11694 + {
11695 +- int rc;
11696 +-
11697 + if (time != 0)
11698 +- rc = snprintf(*buf, *len, "%s: "LPU64" seconds\n", prefix,
11699 +- cfs_time_current_sec() - time);
11700 ++ seq_printf(m, "%s: "LPU64" seconds\n", prefix,
11701 ++ cfs_time_current_sec() - time);
11702 + else
11703 +- rc = snprintf(*buf, *len, "%s: N/A\n", prefix);
11704 +- if (rc <= 0)
11705 +- return -ENOSPC;
11706 +-
11707 +- *buf += rc;
11708 +- *len -= rc;
11709 +- return rc;
11710 ++ seq_printf(m, "%s: N/A\n", prefix);
11711 ++ return 0;
11712 + }
11713 +
11714 +-int lfsck_pos_dump(char **buf, int *len, struct lfsck_position *pos,
11715 ++int lfsck_pos_dump(struct seq_file *m, struct lfsck_position *pos,
11716 + const char *prefix)
11717 + {
11718 +- int rc;
11719 +-
11720 + if (fid_is_zero(&pos->lp_dir_parent)) {
11721 + if (pos->lp_oit_cookie == 0)
11722 +- rc = snprintf(*buf, *len, "%s: N/A, N/A, N/A\n",
11723 +- prefix);
11724 ++ seq_printf(m, "%s: N/A, N/A, N/A\n",
11725 ++ prefix);
11726 + else
11727 +- rc = snprintf(*buf, *len, "%s: "LPU64", N/A, N/A\n",
11728 +- prefix, pos->lp_oit_cookie);
11729 ++ seq_printf(m, "%s: "LPU64", N/A, N/A\n",
11730 ++ prefix, pos->lp_oit_cookie);
11731 + } else {
11732 +- rc = snprintf(*buf, *len, "%s: "LPU64", "DFID", "LPU64"\n",
11733 +- prefix, pos->lp_oit_cookie,
11734 +- PFID(&pos->lp_dir_parent), pos->lp_dir_cookie);
11735 ++ seq_printf(m, "%s: "LPU64", "DFID", "LPU64"\n",
11736 ++ prefix, pos->lp_oit_cookie,
11737 ++ PFID(&pos->lp_dir_parent), pos->lp_dir_cookie);
11738 + }
11739 +- if (rc <= 0)
11740 +- return -ENOSPC;
11741 +-
11742 +- *buf += rc;
11743 +- *len -= rc;
11744 +- return rc;
11745 ++ return 0;
11746 + }
11747 +
11748 + void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck,
11749 +@@ -1102,7 +1077,7 @@ int lfsck_async_request(const struct lu_env *env, struct obd_export *exp,
11750 +
11751 + /* external interfaces */
11752 +
11753 +-int lfsck_get_speed(struct dt_device *key, void *buf, int len)
11754 ++int lfsck_get_speed(struct seq_file *m, struct dt_device *key)
11755 + {
11756 + struct lu_env env;
11757 + struct lfsck_instance *lfsck;
11758 +@@ -1115,8 +1090,7 @@ int lfsck_get_speed(struct dt_device *key, void *buf, int len)
11759 +
11760 + lfsck = lfsck_instance_find(key, true, false);
11761 + if (likely(lfsck != NULL)) {
11762 +- rc = snprintf(buf, len, "%u\n",
11763 +- lfsck->li_bookmark_ram.lb_speed_limit);
11764 ++ seq_printf(m, "%u\n", lfsck->li_bookmark_ram.lb_speed_limit);
11765 + lfsck_instance_put(&env, lfsck);
11766 + } else {
11767 + rc = -ENODEV;
11768 +@@ -1156,7 +1130,7 @@ int lfsck_set_speed(struct dt_device *key, int val)
11769 + }
11770 + EXPORT_SYMBOL(lfsck_set_speed);
11771 +
11772 +-int lfsck_get_windows(struct dt_device *key, void *buf, int len)
11773 ++int lfsck_get_windows(struct seq_file *m, struct dt_device *key)
11774 + {
11775 + struct lu_env env;
11776 + struct lfsck_instance *lfsck;
11777 +@@ -1169,8 +1143,7 @@ int lfsck_get_windows(struct dt_device *key, void *buf, int len)
11778 +
11779 + lfsck = lfsck_instance_find(key, true, false);
11780 + if (likely(lfsck != NULL)) {
11781 +- rc = snprintf(buf, len, "%u\n",
11782 +- lfsck->li_bookmark_ram.lb_async_windows);
11783 ++ seq_printf(m, "%u\n", lfsck->li_bookmark_ram.lb_async_windows);
11784 + lfsck_instance_put(&env, lfsck);
11785 + } else {
11786 + rc = -ENODEV;
11787 +@@ -1220,7 +1193,7 @@ int lfsck_set_windows(struct dt_device *key, int val)
11788 + }
11789 + EXPORT_SYMBOL(lfsck_set_windows);
11790 +
11791 +-int lfsck_dump(struct dt_device *key, void *buf, int len, enum lfsck_type type)
11792 ++int lfsck_dump(struct seq_file *m, struct dt_device *key, enum lfsck_type type)
11793 + {
11794 + struct lu_env env;
11795 + struct lfsck_instance *lfsck;
11796 +@@ -1236,7 +1209,7 @@ int lfsck_dump(struct dt_device *key, void *buf, int len, enum lfsck_type type)
11797 + if (likely(lfsck != NULL)) {
11798 + com = lfsck_component_find(lfsck, type);
11799 + if (likely(com != NULL)) {
11800 +- rc = com->lc_ops->lfsck_dump(&env, com, buf, len);
11801 ++ rc = com->lc_ops->lfsck_dump(&env, com, m);
11802 + lfsck_component_put(&env, com);
11803 + } else {
11804 + rc = -ENOTSUPP;
11805 +diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c
11806 +index 6fc08fb..2abad67 100644
11807 +--- a/lustre/lfsck/lfsck_namespace.c
11808 ++++ b/lustre/lfsck/lfsck_namespace.c
11809 +@@ -1088,65 +1088,56 @@ static int lfsck_namespace_post(const struct lu_env *env,
11810 +
11811 + static int
11812 + lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
11813 +- char *buf, int len)
11814 ++ struct seq_file *m)
11815 + {
11816 + struct lfsck_instance *lfsck = com->lc_lfsck;
11817 + struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram;
11818 + struct lfsck_namespace *ns = com->lc_file_ram;
11819 +- int save = len;
11820 +- int ret = -ENOSPC;
11821 + int rc;
11822 +
11823 + down_read(&com->lc_sem);
11824 +- rc = snprintf(buf, len,
11825 +- "name: lfsck_namespace\n"
11826 +- "magic: %#x\n"
11827 +- "version: %d\n"
11828 +- "status: %s\n",
11829 +- ns->ln_magic,
11830 +- bk->lb_version,
11831 +- lfsck_status2names(ns->ln_status));
11832 +- if (rc <= 0)
11833 +- goto out;
11834 +-
11835 +- buf += rc;
11836 +- len -= rc;
11837 +- rc = lfsck_bits_dump(&buf, &len, ns->ln_flags, lfsck_flags_names,
11838 +- "flags");
11839 ++ seq_printf(m, "name: lfsck_namespace\n"
11840 ++ "magic: %#x\n"
11841 ++ "version: %d\n"
11842 ++ "status: %s\n",
11843 ++ ns->ln_magic,
11844 ++ bk->lb_version,
11845 ++ lfsck_status2names(ns->ln_status));
11846 ++
11847 ++ rc = lfsck_bits_dump(m, ns->ln_flags, lfsck_flags_names, "flags");
11848 + if (rc < 0)
11849 + goto out;
11850 +
11851 +- rc = lfsck_bits_dump(&buf, &len, bk->lb_param, lfsck_param_names,
11852 +- "param");
11853 ++ rc = lfsck_bits_dump(m, bk->lb_param, lfsck_param_names, "param");
11854 + if (rc < 0)
11855 + goto out;
11856 +
11857 +- rc = lfsck_time_dump(&buf, &len, ns->ln_time_last_complete,
11858 ++ rc = lfsck_time_dump(m, ns->ln_time_last_complete,
11859 + "time_since_last_completed");
11860 + if (rc < 0)
11861 + goto out;
11862 +
11863 +- rc = lfsck_time_dump(&buf, &len, ns->ln_time_latest_start,
11864 ++ rc = lfsck_time_dump(m, ns->ln_time_latest_start,
11865 + "time_since_latest_start");
11866 + if (rc < 0)
11867 + goto out;
11868 +
11869 +- rc = lfsck_time_dump(&buf, &len, ns->ln_time_last_checkpoint,
11870 ++ rc = lfsck_time_dump(m, ns->ln_time_last_checkpoint,
11871 + "time_since_last_checkpoint");
11872 + if (rc < 0)
11873 + goto out;
11874 +
11875 +- rc = lfsck_pos_dump(&buf, &len, &ns->ln_pos_latest_start,
11876 ++ rc = lfsck_pos_dump(m, &ns->ln_pos_latest_start,
11877 + "latest_start_position");
11878 + if (rc < 0)
11879 + goto out;
11880 +
11881 +- rc = lfsck_pos_dump(&buf, &len, &ns->ln_pos_last_checkpoint,
11882 ++ rc = lfsck_pos_dump(m, &ns->ln_pos_last_checkpoint,
11883 + "last_checkpoint_position");
11884 + if (rc < 0)
11885 + goto out;
11886 +
11887 +- rc = lfsck_pos_dump(&buf, &len, &ns->ln_pos_first_inconsistent,
11888 ++ rc = lfsck_pos_dump(m, &ns->ln_pos_first_inconsistent,
11889 + "first_failure_position");
11890 + if (rc < 0)
11891 + goto out;
11892 +@@ -1166,8 +1157,7 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
11893 + do_div(new_checked, duration);
11894 + if (rtime != 0)
11895 + do_div(speed, rtime);
11896 +- rc = snprintf(buf, len,
11897 +- "checked_phase1: "LPU64"\n"
11898 ++ seq_printf(m, "checked_phase1: "LPU64"\n"
11899 + "checked_phase2: "LPU64"\n"
11900 + "updated_phase1: "LPU64"\n"
11901 + "updated_phase2: "LPU64"\n"
11902 +@@ -1199,11 +1189,6 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
11903 + ns->ln_run_time_phase2,
11904 + speed,
11905 + new_checked);
11906 +- if (rc <= 0)
11907 +- goto out;
11908 +-
11909 +- buf += rc;
11910 +- len -= rc;
11911 +
11912 + LASSERT(lfsck->li_di_oit != NULL);
11913 +
11914 +@@ -1232,9 +1217,7 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
11915 + pos.lp_dir_cookie = 0;
11916 + }
11917 + spin_unlock(&lfsck->li_lock);
11918 +- rc = lfsck_pos_dump(&buf, &len, &pos, "current_position");
11919 +- if (rc <= 0)
11920 +- goto out;
11921 ++ lfsck_pos_dump(m, &pos, "current_position");
11922 + } else if (ns->ln_status == LS_SCANNING_PHASE2) {
11923 + cfs_duration_t duration = cfs_time_current() -
11924 + lfsck->li_time_last_checkpoint;
11925 +@@ -1252,8 +1235,7 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
11926 + do_div(speed1, ns->ln_run_time_phase1);
11927 + if (rtime != 0)
11928 + do_div(speed2, rtime);
11929 +- rc = snprintf(buf, len,
11930 +- "checked_phase1: "LPU64"\n"
11931 ++ seq_printf(m, "checked_phase1: "LPU64"\n"
11932 + "checked_phase2: "LPU64"\n"
11933 + "updated_phase1: "LPU64"\n"
11934 + "updated_phase2: "LPU64"\n"
11935 +@@ -1288,11 +1270,6 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
11936 + speed2,
11937 + new_checked,
11938 + PFID(&ns->ln_fid_latest_scanned_phase2));
11939 +- if (rc <= 0)
11940 +- goto out;
11941 +-
11942 +- buf += rc;
11943 +- len -= rc;
11944 + } else {
11945 + __u64 speed1 = ns->ln_items_checked;
11946 + __u64 speed2 = ns->ln_objs_checked_phase2;
11947 +@@ -1301,8 +1278,7 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
11948 + do_div(speed1, ns->ln_run_time_phase1);
11949 + if (ns->ln_run_time_phase2 != 0)
11950 + do_div(speed2, ns->ln_run_time_phase2);
11951 +- rc = snprintf(buf, len,
11952 +- "checked_phase1: "LPU64"\n"
11953 ++ seq_printf(m, "checked_phase1: "LPU64"\n"
11954 + "checked_phase2: "LPU64"\n"
11955 + "updated_phase1: "LPU64"\n"
11956 + "updated_phase2: "LPU64"\n"
11957 +@@ -1335,17 +1311,10 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
11958 + ns->ln_run_time_phase2,
11959 + speed1,
11960 + speed2);
11961 +- if (rc <= 0)
11962 +- goto out;
11963 +-
11964 +- buf += rc;
11965 +- len -= rc;
11966 + }
11967 +- ret = save - len;
11968 +-
11969 + out:
11970 + up_read(&com->lc_sem);
11971 +- return ret;
11972 ++ return 0;
11973 + }
11974 +
11975 + static int lfsck_namespace_double_scan_main(void *args)
11976 +diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c
11977 +index 40a4ee3..b0acecb 100644
11978 +--- a/lustre/mdd/mdd_device.c
11979 ++++ b/lustre/mdd/mdd_device.c
11980 +@@ -812,16 +812,16 @@ static int mdd_process_config(const struct lu_env *env,
11981 + ENTRY;
11982 +
11983 + switch (cfg->lcfg_command) {
11984 +- case LCFG_PARAM: {
11985 +- struct lprocfs_static_vars lvars;
11986 +-
11987 +- lprocfs_mdd_init_vars(&lvars);
11988 +- rc = class_process_proc_param(PARAM_MDD, lvars.obd_vars, cfg,m);
11989 +- if (rc > 0 || rc == -ENOSYS)
11990 +- /* we don't understand; pass it on */
11991 +- rc = next->ld_ops->ldo_process_config(env, next, cfg);
11992 +- break;
11993 +- }
11994 ++ case LCFG_PARAM: {
11995 ++ struct obd_device *obd = mdd2obd_dev(m);
11996 ++
11997 ++ rc = class_process_proc_seq_param(PARAM_MDD, obd->obd_vars,
11998 ++ cfg, m);
11999 ++ if (rc > 0 || rc == -ENOSYS)
12000 ++ /* we don't understand; pass it on */
12001 ++ rc = next->ld_ops->ldo_process_config(env, next, cfg);
12002 ++ break;
12003 ++ }
12004 + case LCFG_SETUP:
12005 + rc = next->ld_ops->ldo_process_config(env, next, cfg);
12006 + if (rc)
12007 +@@ -1497,11 +1497,8 @@ LU_CONTEXT_KEY_DEFINE(mdd, LCT_MD_THREAD);
12008 +
12009 + static int __init mdd_mod_init(void)
12010 + {
12011 +- struct lprocfs_static_vars lvars;
12012 + int rc;
12013 +
12014 +- lprocfs_mdd_init_vars(&lvars);
12015 +-
12016 + rc = lu_kmem_init(mdd_caches);
12017 + if (rc)
12018 + return rc;
12019 +@@ -1517,7 +1514,7 @@ static int __init mdd_mod_init(void)
12020 +
12021 + rc = class_register_type(&mdd_obd_device_ops, NULL, NULL,
12022 + #ifndef HAVE_ONLY_PROCFS_SEQ
12023 +- lvars.module_vars,
12024 ++ NULL,
12025 + #endif
12026 + LUSTRE_MDD_NAME, &mdd_device_type);
12027 + if (rc)
12028 +diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h
12029 +index daa1dcb..5332b2c 100644
12030 +--- a/lustre/mdd/mdd_internal.h
12031 ++++ b/lustre/mdd/mdd_internal.h
12032 +@@ -340,7 +340,6 @@ int orph_declare_index_delete(const struct lu_env *, struct mdd_object *,
12033 + struct thandle *);
12034 +
12035 + /* mdd_lproc.c */
12036 +-void lprocfs_mdd_init_vars(struct lprocfs_static_vars *lvars);
12037 + int mdd_procfs_init(struct mdd_device *mdd, const char *name);
12038 + int mdd_procfs_fini(struct mdd_device *mdd);
12039 +
12040 +diff --git a/lustre/mdd/mdd_lproc.c b/lustre/mdd/mdd_lproc.c
12041 +index 2573e33..e20324c 100644
12042 +--- a/lustre/mdd/mdd_lproc.c
12043 ++++ b/lustre/mdd/mdd_lproc.c
12044 +@@ -49,56 +49,14 @@
12045 + #include <libcfs/libcfs_string.h>
12046 + #include "mdd_internal.h"
12047 +
12048 +-int mdd_procfs_init(struct mdd_device *mdd, const char *name)
12049 ++static ssize_t
12050 ++mdd_atime_diff_seq_write(struct file *file, const char *buffer,
12051 ++ size_t count, loff_t *off)
12052 + {
12053 +- struct lprocfs_static_vars lvars;
12054 +- struct obd_type *type;
12055 +- int rc;
12056 +- ENTRY;
12057 +-
12058 +- /* at the moment there is no linkage between lu_type
12059 +- * and obd_type, so we lookup obd_type this way */
12060 +- type = class_search_type(LUSTRE_MDD_NAME);
12061 +-
12062 +- LASSERT(name != NULL);
12063 +- LASSERT(type != NULL);
12064 +-
12065 +- /* Find the type procroot and add the proc entry for this device */
12066 +- lprocfs_mdd_init_vars(&lvars);
12067 +- mdd->mdd_proc_entry = lprocfs_register(name, type->typ_procroot,
12068 +- lvars.obd_vars, mdd);
12069 +- if (IS_ERR(mdd->mdd_proc_entry)) {
12070 +- rc = PTR_ERR(mdd->mdd_proc_entry);
12071 +- CERROR("Error %d setting up lprocfs for %s\n",
12072 +- rc, name);
12073 +- mdd->mdd_proc_entry = NULL;
12074 +- GOTO(out, rc);
12075 +- }
12076 +-
12077 +- rc = 0;
12078 +-
12079 +- EXIT;
12080 +-out:
12081 +- if (rc)
12082 +- mdd_procfs_fini(mdd);
12083 +- return rc;
12084 +-}
12085 +-
12086 +-int mdd_procfs_fini(struct mdd_device *mdd)
12087 +-{
12088 +- if (mdd->mdd_proc_entry) {
12089 +- lprocfs_remove(&mdd->mdd_proc_entry);
12090 +- mdd->mdd_proc_entry = NULL;
12091 +- }
12092 +- RETURN(0);
12093 +-}
12094 +-
12095 +-static int lprocfs_wr_atime_diff(struct file *file, const char *buffer,
12096 +- unsigned long count, void *data)
12097 +-{
12098 +- struct mdd_device *mdd = data;
12099 +- char kernbuf[20], *end;
12100 +- unsigned long diff = 0;
12101 ++ struct seq_file *m = file->private_data;
12102 ++ struct mdd_device *mdd = m->private;
12103 ++ char kernbuf[20], *end;
12104 ++ unsigned long diff = 0;
12105 +
12106 + if (count > (sizeof(kernbuf) - 1))
12107 + return -EINVAL;
12108 +@@ -116,37 +74,35 @@ static int lprocfs_wr_atime_diff(struct file *file, const char *buffer,
12109 + return count;
12110 + }
12111 +
12112 +-static int lprocfs_rd_atime_diff(char *page, char **start, off_t off,
12113 +- int count, int *eof, void *data)
12114 ++static int mdd_atime_diff_seq_show(struct seq_file *m, void *data)
12115 + {
12116 +- struct mdd_device *mdd = data;
12117 ++ struct mdd_device *mdd = m->private;
12118 +
12119 +- *eof = 1;
12120 +- return snprintf(page, count, "%lu\n", mdd->mdd_atime_diff);
12121 ++ return seq_printf(m, "%lu\n", mdd->mdd_atime_diff);
12122 + }
12123 +-
12124 ++LPROC_SEQ_FOPS(mdd_atime_diff);
12125 +
12126 + /**** changelogs ****/
12127 +-static int lprocfs_rd_changelog_mask(char *page, char **start, off_t off,
12128 +- int count, int *eof, void *data)
12129 ++static int mdd_changelog_mask_seq_show(struct seq_file *m, void *data)
12130 + {
12131 +- struct mdd_device *mdd = data;
12132 +- int i = 0, rc = 0;
12133 +-
12134 +- *eof = 1;
12135 +- while (i < CL_LAST) {
12136 +- if (mdd->mdd_cl.mc_mask & (1 << i))
12137 +- rc += snprintf(page + rc, count - rc, "%s ",
12138 +- changelog_type2str(i));
12139 +- i++;
12140 +- }
12141 +- return rc;
12142 ++ struct mdd_device *mdd = m->private;
12143 ++ int i = 0;
12144 ++
12145 ++ while (i < CL_LAST) {
12146 ++ if (mdd->mdd_cl.mc_mask & (1 << i))
12147 ++ seq_printf(m, "%s ", changelog_type2str(i));
12148 ++ i++;
12149 ++ }
12150 ++ seq_printf(m, "\n");
12151 ++ return 0;
12152 + }
12153 +
12154 +-static int lprocfs_wr_changelog_mask(struct file *file, const char *buffer,
12155 +- unsigned long count, void *data)
12156 ++static ssize_t
12157 ++mdd_changelog_mask_seq_write(struct file *file, const char *buffer,
12158 ++ size_t count, loff_t *off)
12159 + {
12160 +- struct mdd_device *mdd = data;
12161 ++ struct seq_file *m = file->private_data;
12162 ++ struct mdd_device *mdd = m->private;
12163 + char *kernbuf;
12164 + int rc;
12165 + ENTRY;
12166 +@@ -168,45 +124,32 @@ out:
12167 + OBD_FREE(kernbuf, PAGE_CACHE_SIZE);
12168 + return rc;
12169 + }
12170 +-
12171 +-struct cucb_data {
12172 +- char *page;
12173 +- int count;
12174 +- int idx;
12175 +-};
12176 ++LPROC_SEQ_FOPS(mdd_changelog_mask);
12177 +
12178 + static int lprocfs_changelog_users_cb(const struct lu_env *env,
12179 + struct llog_handle *llh,
12180 + struct llog_rec_hdr *hdr, void *data)
12181 + {
12182 +- struct llog_changelog_user_rec *rec;
12183 +- struct cucb_data *cucb = (struct cucb_data *)data;
12184 +-
12185 +- LASSERT(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN);
12186 ++ struct llog_changelog_user_rec *rec;
12187 ++ struct seq_file *m = data;
12188 +
12189 +- rec = (struct llog_changelog_user_rec *)hdr;
12190 ++ LASSERT(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN);
12191 +
12192 +- cucb->idx += snprintf(cucb->page + cucb->idx, cucb->count - cucb->idx,
12193 +- CHANGELOG_USER_PREFIX"%-3d "LPU64"\n",
12194 +- rec->cur_id, rec->cur_endrec);
12195 +- if (cucb->idx >= cucb->count)
12196 +- return -ENOSPC;
12197 ++ rec = (struct llog_changelog_user_rec *)hdr;
12198 +
12199 +- return 0;
12200 ++ seq_printf(m, CHANGELOG_USER_PREFIX"%-3d "LPU64"\n",
12201 ++ rec->cur_id, rec->cur_endrec);
12202 ++ return 0;
12203 + }
12204 +
12205 +-static int lprocfs_rd_changelog_users(char *page, char **start, off_t off,
12206 +- int count, int *eof, void *data)
12207 ++static int mdd_changelog_users_seq_show(struct seq_file *m, void *data)
12208 + {
12209 + struct lu_env env;
12210 +- struct mdd_device *mdd = data;
12211 ++ struct mdd_device *mdd = m->private;
12212 + struct llog_ctxt *ctxt;
12213 +- struct cucb_data cucb;
12214 + __u64 cur;
12215 + int rc;
12216 +
12217 +- *eof = 1;
12218 +-
12219 + ctxt = llog_get_context(mdd2obd_dev(mdd),
12220 + LLOG_CHANGELOG_USER_ORIG_CTXT);
12221 + if (ctxt == NULL)
12222 +@@ -223,37 +166,32 @@ static int lprocfs_rd_changelog_users(char *page, char **start, off_t off,
12223 + cur = mdd->mdd_cl.mc_index;
12224 + spin_unlock(&mdd->mdd_cl.mc_lock);
12225 +
12226 +- cucb.count = count;
12227 +- cucb.page = page;
12228 +- cucb.idx = 0;
12229 +-
12230 +- cucb.idx += snprintf(cucb.page + cucb.idx, cucb.count - cucb.idx,
12231 +- "current index: "LPU64"\n", cur);
12232 +-
12233 +- cucb.idx += snprintf(cucb.page + cucb.idx, cucb.count - cucb.idx,
12234 +- "%-5s %s\n", "ID", "index");
12235 ++ seq_printf(m, "current index: "LPU64"\n", cur);
12236 ++ seq_printf(m, "%-5s %s\n", "ID", "index");
12237 +
12238 + llog_cat_process(&env, ctxt->loc_handle, lprocfs_changelog_users_cb,
12239 +- &cucb, 0, 0);
12240 ++ &m, 0, 0);
12241 +
12242 + lu_env_fini(&env);
12243 + llog_ctxt_put(ctxt);
12244 +- return cucb.idx;
12245 ++ return 0;
12246 + }
12247 ++LPROC_SEQ_FOPS_RO(mdd_changelog_users);
12248 +
12249 +-static int lprocfs_rd_sync_perm(char *page, char **start, off_t off,
12250 +- int count, int *eof, void *data)
12251 ++static int mdd_sync_perm_seq_show(struct seq_file *m, void *data)
12252 + {
12253 +- struct mdd_device *mdd = data;
12254 ++ struct mdd_device *mdd = m->private;
12255 +
12256 +- LASSERT(mdd != NULL);
12257 +- return snprintf(page, count, "%d\n", mdd->mdd_sync_permission);
12258 ++ LASSERT(mdd != NULL);
12259 ++ return seq_printf(m, "%d\n", mdd->mdd_sync_permission);
12260 + }
12261 +
12262 +-static int lprocfs_wr_sync_perm(struct file *file, const char *buffer,
12263 +- unsigned long count, void *data)
12264 ++static ssize_t
12265 ++mdd_sync_perm_seq_write(struct file *file, const char *buffer,
12266 ++ size_t count, loff_t *off)
12267 + {
12268 +- struct mdd_device *mdd = data;
12269 ++ struct seq_file *m = file->private_data;
12270 ++ struct mdd_device *mdd = m->private;
12271 + int val, rc;
12272 +
12273 + LASSERT(mdd != NULL);
12274 +@@ -264,24 +202,22 @@ static int lprocfs_wr_sync_perm(struct file *file, const char *buffer,
12275 + mdd->mdd_sync_permission = !!val;
12276 + return count;
12277 + }
12278 ++LPROC_SEQ_FOPS(mdd_sync_perm);
12279 +
12280 +-static int lprocfs_rd_lfsck_speed_limit(char *page, char **start, off_t off,
12281 +- int count, int *eof, void *data)
12282 ++static int mdd_lfsck_speed_limit_seq_show(struct seq_file *m, void *data)
12283 + {
12284 +- struct mdd_device *mdd = data;
12285 +- int rc;
12286 ++ struct mdd_device *mdd = m->private;
12287 +
12288 + LASSERT(mdd != NULL);
12289 +- *eof = 1;
12290 +-
12291 +- rc = lfsck_get_speed(mdd->mdd_bottom, page, count);
12292 +- return rc != 0 ? rc : count;
12293 ++ return lfsck_get_speed(m, mdd->mdd_bottom);
12294 + }
12295 +
12296 +-static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer,
12297 +- unsigned long count, void *data)
12298 ++static ssize_t
12299 ++mdd_lfsck_speed_limit_seq_write(struct file *file, const char *buffer,
12300 ++ size_t count, loff_t *off)
12301 + {
12302 +- struct mdd_device *mdd = data;
12303 ++ struct seq_file *m = file->private_data;
12304 ++ struct mdd_device *mdd = m->private;
12305 + __u32 val;
12306 + int rc;
12307 +
12308 +@@ -293,25 +229,22 @@ static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer,
12309 + rc = lfsck_set_speed(mdd->mdd_bottom, val);
12310 + return rc != 0 ? rc : count;
12311 + }
12312 ++LPROC_SEQ_FOPS(mdd_lfsck_speed_limit);
12313 +
12314 +-static int lprocfs_rd_lfsck_async_windows(char *page, char **start, off_t off,
12315 +- int count, int *eof, void *data)
12316 ++static int mdd_lfsck_async_windows_seq_show(struct seq_file *m, void *data)
12317 + {
12318 +- struct mdd_device *mdd = data;
12319 +- int rc;
12320 ++ struct mdd_device *mdd = m->private;
12321 +
12322 + LASSERT(mdd != NULL);
12323 +- *eof = 1;
12324 +-
12325 +- rc = lfsck_get_windows(mdd->mdd_bottom, page, count);
12326 +-
12327 +- return rc != 0 ? rc : count;
12328 ++ return lfsck_get_windows(m, mdd->mdd_bottom);
12329 + }
12330 +
12331 +-static int lprocfs_wr_lfsck_async_windows(struct file *file, const char *buffer,
12332 +- unsigned long count, void *data)
12333 ++static ssize_t
12334 ++mdd_lfsck_async_windows_seq_write(struct file *file, const char *buffer,
12335 ++ size_t count, loff_t *off)
12336 + {
12337 +- struct mdd_device *mdd = data;
12338 ++ struct seq_file *m = file->private_data;
12339 ++ struct mdd_device *mdd = m->private;
12340 + __u32 val;
12341 + int rc;
12342 +
12343 +@@ -322,42 +255,76 @@ static int lprocfs_wr_lfsck_async_windows(struct file *file, const char *buffer,
12344 +
12345 + return rc != 0 ? rc : count;
12346 + }
12347 ++LPROC_SEQ_FOPS(mdd_lfsck_async_windows);
12348 +
12349 +-static int lprocfs_rd_lfsck_namespace(char *page, char **start, off_t off,
12350 +- int count, int *eof, void *data)
12351 ++static int mdd_lfsck_namespace_seq_show(struct seq_file *m, void *data)
12352 + {
12353 +- struct mdd_device *mdd = data;
12354 +- int rc;
12355 ++ struct mdd_device *mdd = m->private;
12356 +
12357 + LASSERT(mdd != NULL);
12358 +- *eof = 1;
12359 +
12360 +- rc = lfsck_dump(mdd->mdd_bottom, page, count, LT_NAMESPACE);
12361 +- return rc;
12362 ++ return lfsck_dump(m, mdd->mdd_bottom, LT_NAMESPACE);
12363 + }
12364 +-
12365 +-static struct lprocfs_vars lprocfs_mdd_obd_vars[] = {
12366 +- { "atime_diff", lprocfs_rd_atime_diff, lprocfs_wr_atime_diff, 0 },
12367 +- { "changelog_mask", lprocfs_rd_changelog_mask,
12368 +- lprocfs_wr_changelog_mask, 0 },
12369 +- { "changelog_users", lprocfs_rd_changelog_users, 0, 0},
12370 +- { "sync_permission", lprocfs_rd_sync_perm, lprocfs_wr_sync_perm, 0 },
12371 +- { "lfsck_speed_limit", lprocfs_rd_lfsck_speed_limit,
12372 +- lprocfs_wr_lfsck_speed_limit, 0 },
12373 +- { "lfsck_async_windows", lprocfs_rd_lfsck_async_windows,
12374 +- lprocfs_wr_lfsck_async_windows, 0 },
12375 +- { "lfsck_namespace", lprocfs_rd_lfsck_namespace, 0, 0 },
12376 ++LPROC_SEQ_FOPS_RO(mdd_lfsck_namespace);
12377 ++
12378 ++static struct lprocfs_seq_vars lprocfs_mdd_obd_vars[] = {
12379 ++ { .name = "atime_diff",
12380 ++ .fops = &mdd_atime_diff_fops },
12381 ++ { .name = "changelog_mask",
12382 ++ .fops = &mdd_changelog_mask_fops },
12383 ++ { .name = "changelog_users",
12384 ++ .fops = &mdd_changelog_users_fops },
12385 ++ { .name = "sync_permission",
12386 ++ .fops = &mdd_sync_perm_fops },
12387 ++ { .name = "lfsck_speed_limit",
12388 ++ .fops = &mdd_lfsck_speed_limit_fops },
12389 ++ { .name = "lfsck_async_windows",
12390 ++ .fops = &mdd_lfsck_async_windows_fops },
12391 ++ { .name = "lfsck_namespace",
12392 ++ .fops = &mdd_lfsck_namespace_fops },
12393 + { 0 }
12394 + };
12395 +
12396 +-static struct lprocfs_vars lprocfs_mdd_module_vars[] = {
12397 +- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
12398 +- { 0 }
12399 +-};
12400 +-
12401 +-void lprocfs_mdd_init_vars(struct lprocfs_static_vars *lvars)
12402 ++int mdd_procfs_init(struct mdd_device *mdd, const char *name)
12403 + {
12404 +- lvars->module_vars = lprocfs_mdd_module_vars;
12405 +- lvars->obd_vars = lprocfs_mdd_obd_vars;
12406 ++ struct obd_device *obd = class_name2obd(name);
12407 ++ struct obd_type *type;
12408 ++ int rc;
12409 ++ ENTRY;
12410 ++
12411 ++ /* at the moment there is no linkage between lu_type
12412 ++ * and obd_type, so we lookup obd_type this way */
12413 ++ type = class_search_type(LUSTRE_MDD_NAME);
12414 ++
12415 ++ LASSERT(name != NULL);
12416 ++ LASSERT(type != NULL);
12417 ++ LASSERT(obd != NULL);
12418 ++
12419 ++ /* Find the type procroot and add the proc entry for this device */
12420 ++ obd->obd_vars = lprocfs_mdd_obd_vars;
12421 ++ mdd->mdd_proc_entry = lprocfs_seq_register(name, type->typ_procroot,
12422 ++ obd->obd_vars, mdd);
12423 ++ if (IS_ERR(mdd->mdd_proc_entry)) {
12424 ++ rc = PTR_ERR(mdd->mdd_proc_entry);
12425 ++ CERROR("Error %d setting up lprocfs for %s\n",
12426 ++ rc, name);
12427 ++ mdd->mdd_proc_entry = NULL;
12428 ++ GOTO(out, rc);
12429 ++ }
12430 ++ rc = 0;
12431 ++
12432 ++ EXIT;
12433 ++out:
12434 ++ if (rc)
12435 ++ mdd_procfs_fini(mdd);
12436 ++ return rc;
12437 + }
12438 +
12439 ++int mdd_procfs_fini(struct mdd_device *mdd)
12440 ++{
12441 ++ if (mdd->mdd_proc_entry) {
12442 ++ lprocfs_remove(&mdd->mdd_proc_entry);
12443 ++ mdd->mdd_proc_entry = NULL;
12444 ++ }
12445 ++ RETURN(0);
12446 ++}
12447 +diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c
12448 +index 63d01cc..abe5d71 100644
12449 +--- a/lustre/obdclass/lprocfs_status.c
12450 ++++ b/lustre/obdclass/lprocfs_status.c
12451 +@@ -388,11 +388,10 @@ EXPORT_SYMBOL(lprocfs_evict_client_seq_write);
12452 + #undef BUFLEN
12453 +
12454 + struct file_operations lprocfs_evict_client_fops = {
12455 +- .owner = THIS_MODULE,
12456 +- .read = lprocfs_fops_read,
12457 +- .write = lprocfs_fops_write,
12458 +- .open = lprocfs_evict_client_open,
12459 +- .release = lprocfs_evict_client_release,
12460 ++ .owner = THIS_MODULE,
12461 ++ .open = lprocfs_evict_client_open,
12462 ++ .release = lprocfs_evict_client_release,
12463 ++ .write = lprocfs_evict_client_seq_write,
12464 + };
12465 + EXPORT_SYMBOL(lprocfs_evict_client_fops);
12466 + #endif
12467 +diff --git a/lustre/ofd/lproc_ofd.c b/lustre/ofd/lproc_ofd.c
12468 +index e303fd6..1759a7d 100644
12469 +--- a/lustre/ofd/lproc_ofd.c
12470 ++++ b/lustre/ofd/lproc_ofd.c
12471 +@@ -47,80 +47,75 @@
12472 +
12473 + #ifdef LPROCFS
12474 +
12475 +-static int lprocfs_ofd_rd_seqs(char *page, char **start, off_t off,
12476 +- int count, int *eof, void *data)
12477 ++static int ofd_seqs_seq_show(struct seq_file *m, void *data)
12478 + {
12479 +- struct obd_device *obd = (struct obd_device *)data;
12480 ++ struct obd_device *obd = m->private;
12481 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12482 +
12483 +- *eof = 1;
12484 +- return snprintf(page, count, "%u\n", ofd->ofd_seq_count);
12485 ++ return seq_printf(m, "%u\n", ofd->ofd_seq_count);
12486 + }
12487 ++LPROC_SEQ_FOPS_RO(ofd_seqs);
12488 +
12489 +-static int lprocfs_ofd_rd_tot_dirty(char *page, char **start, off_t off,
12490 +- int count, int *eof, void *data)
12491 ++static int ofd_tot_dirty_seq_show(struct seq_file *m, void *data)
12492 + {
12493 +- struct obd_device *obd = (struct obd_device *)data;
12494 ++ struct obd_device *obd = m->private;
12495 + struct ofd_device *ofd;
12496 +
12497 + LASSERT(obd != NULL);
12498 + ofd = ofd_dev(obd->obd_lu_dev);
12499 +- *eof = 1;
12500 +- return snprintf(page, count, LPU64"\n", ofd->ofd_tot_dirty);
12501 ++ return seq_printf(m, LPU64"\n", ofd->ofd_tot_dirty);
12502 + }
12503 ++LPROC_SEQ_FOPS_RO(ofd_tot_dirty);
12504 +
12505 +-static int lprocfs_ofd_rd_tot_granted(char *page, char **start, off_t off,
12506 +- int count, int *eof, void *data)
12507 ++static int ofd_tot_granted_seq_show(struct seq_file *m, void *data)
12508 + {
12509 +- struct obd_device *obd = (struct obd_device *)data;
12510 ++ struct obd_device *obd = m->private;
12511 + struct ofd_device *ofd;
12512 +
12513 + LASSERT(obd != NULL);
12514 + ofd = ofd_dev(obd->obd_lu_dev);
12515 +- *eof = 1;
12516 +- return snprintf(page, count, LPU64"\n", ofd->ofd_tot_granted);
12517 ++ return seq_printf(m, LPU64"\n", ofd->ofd_tot_granted);
12518 + }
12519 ++LPROC_SEQ_FOPS_RO(ofd_tot_granted);
12520 +
12521 +-static int lprocfs_ofd_rd_tot_pending(char *page, char **start, off_t off,
12522 +- int count, int *eof, void *data)
12523 ++static int ofd_tot_pending_seq_show(struct seq_file *m, void *data)
12524 + {
12525 +- struct obd_device *obd = (struct obd_device *)data;
12526 ++ struct obd_device *obd = m->private;
12527 + struct ofd_device *ofd;
12528 +
12529 + LASSERT(obd != NULL);
12530 + ofd = ofd_dev(obd->obd_lu_dev);
12531 +- *eof = 1;
12532 +- return snprintf(page, count, LPU64"\n", ofd->ofd_tot_pending);
12533 ++ return seq_printf(m, LPU64"\n", ofd->ofd_tot_pending);
12534 + }
12535 ++LPROC_SEQ_FOPS_RO(ofd_tot_pending);
12536 +
12537 +-static int lprocfs_ofd_rd_grant_precreate(char *page, char **start, off_t off,
12538 +- int count, int *eof, void *data)
12539 ++static int ofd_grant_precreate_seq_show(struct seq_file *m, void *data)
12540 + {
12541 +- struct obd_device *obd = (struct obd_device *)data;
12542 ++ struct obd_device *obd = m->private;
12543 +
12544 + LASSERT(obd != NULL);
12545 +- *eof = 1;
12546 +- return snprintf(page, count, "%ld\n",
12547 ++ return seq_printf(m, "%ld\n",
12548 + obd->obd_self_export->exp_filter_data.fed_grant);
12549 + }
12550 ++LPROC_SEQ_FOPS_RO(ofd_grant_precreate);
12551 +
12552 +-static int lprocfs_ofd_rd_grant_ratio(char *page, char **start, off_t off,
12553 +- int count, int *eof, void *data)
12554 ++static int ofd_grant_ratio_seq_show(struct seq_file *m, void *data)
12555 + {
12556 +- struct obd_device *obd = (struct obd_device *)data;
12557 ++ struct obd_device *obd = m->private;
12558 + struct ofd_device *ofd;
12559 +
12560 + LASSERT(obd != NULL);
12561 + ofd = ofd_dev(obd->obd_lu_dev);
12562 +- *eof = 1;
12563 +- return snprintf(page, count, "%d%%\n",
12564 ++ return seq_printf(m, "%d%%\n",
12565 + (int) ofd_grant_reserved(ofd, 100));
12566 + }
12567 +
12568 +-static int lprocfs_ofd_wr_grant_ratio(struct file *file, const char *buffer,
12569 +- unsigned long count, void *data)
12570 ++static ssize_t
12571 ++ofd_grant_ratio_seq_write(struct file *file, const char *buffer,
12572 ++ size_t count, loff_t *off)
12573 + {
12574 +- struct obd_device *obd = (struct obd_device *)data;
12575 ++ struct seq_file *m = file->private_data;
12576 ++ struct obd_device *obd = m->private;
12577 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12578 + int val;
12579 + int rc;
12580 +@@ -144,23 +139,24 @@ static int lprocfs_ofd_wr_grant_ratio(struct file *file, const char *buffer,
12581 + spin_unlock(&ofd->ofd_grant_lock);
12582 + return count;
12583 + }
12584 ++LPROC_SEQ_FOPS(ofd_grant_ratio);
12585 +
12586 +-static int lprocfs_ofd_rd_precreate_batch(char *page, char **start, off_t off,
12587 +- int count, int *eof, void *data)
12588 ++static int ofd_precreate_batch_seq_show(struct seq_file *m, void *data)
12589 + {
12590 +- struct obd_device *obd = (struct obd_device *)data;
12591 ++ struct obd_device *obd = m->private;
12592 + struct ofd_device *ofd;
12593 +
12594 + LASSERT(obd != NULL);
12595 + ofd = ofd_dev(obd->obd_lu_dev);
12596 +- *eof = 1;
12597 +- return snprintf(page, count, "%d\n", ofd->ofd_precreate_batch);
12598 ++ return seq_printf(m, "%d\n", ofd->ofd_precreate_batch);
12599 + }
12600 +
12601 +-static int lprocfs_ofd_wr_precreate_batch(struct file *file, const char *buffer,
12602 +- unsigned long count, void *data)
12603 ++static ssize_t
12604 ++ofd_precreate_batch_seq_write(struct file *file, const char *buffer,
12605 ++ size_t count, loff_t *off)
12606 + {
12607 +- struct obd_device *obd = (struct obd_device *)data;
12608 ++ struct seq_file *m = file->private_data;
12609 ++ struct obd_device *obd = m->private;
12610 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12611 + int val;
12612 + int rc;
12613 +@@ -177,11 +173,11 @@ static int lprocfs_ofd_wr_precreate_batch(struct file *file, const char *buffer,
12614 + spin_unlock(&ofd->ofd_batch_lock);
12615 + return count;
12616 + }
12617 ++LPROC_SEQ_FOPS(ofd_precreate_batch);
12618 +
12619 +-static int lprocfs_ofd_rd_last_id(char *page, char **start, off_t off,
12620 +- int count, int *eof, void *data)
12621 ++static int ofd_last_id_seq_show(struct seq_file *m, void *data)
12622 + {
12623 +- struct obd_device *obd = data;
12624 ++ struct obd_device *obd = m->private;
12625 + struct ofd_device *ofd;
12626 + struct ofd_seq *oseq = NULL;
12627 + int retval = 0, rc;
12628 +@@ -199,35 +195,32 @@ static int lprocfs_ofd_rd_last_id(char *page, char **start, off_t off,
12629 + fid_idif_seq(ostid_id(&oseq->os_oi),
12630 + ofd->ofd_lut.lut_lsd.lsd_osd_index) :
12631 + ostid_seq(&oseq->os_oi);
12632 +- rc = snprintf(page, count, DOSTID"\n", seq,
12633 +- ostid_id(&oseq->os_oi));
12634 ++ rc = seq_printf(m, DOSTID"\n", seq, ostid_id(&oseq->os_oi));
12635 + if (rc < 0) {
12636 + retval = rc;
12637 + break;
12638 + }
12639 +- page += rc;
12640 +- count -= rc;
12641 + retval += rc;
12642 + }
12643 + read_unlock(&ofd->ofd_seq_list_lock);
12644 + return retval;
12645 + }
12646 ++LPROC_SEQ_FOPS_RO(ofd_last_id);
12647 +
12648 +-int lprocfs_ofd_rd_fmd_max_num(char *page, char **start, off_t off,
12649 +- int count, int *eof, void *data)
12650 ++static int ofd_fmd_max_num_seq_show(struct seq_file *m, void *data)
12651 + {
12652 +- struct obd_device *obd = data;
12653 ++ struct obd_device *obd = m->private;
12654 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12655 +- int rc;
12656 +
12657 +- rc = snprintf(page, count, "%u\n", ofd->ofd_fmd_max_num);
12658 +- return rc;
12659 ++ return seq_printf(m, "%u\n", ofd->ofd_fmd_max_num);
12660 + }
12661 +
12662 +-int lprocfs_ofd_wr_fmd_max_num(struct file *file, const char *buffer,
12663 +- unsigned long count, void *data)
12664 ++static ssize_t
12665 ++ofd_fmd_max_num_seq_write(struct file *file, const char *buffer,
12666 ++ size_t count, loff_t *off)
12667 + {
12668 +- struct obd_device *obd = data;
12669 ++ struct seq_file *m = file->private_data;
12670 ++ struct obd_device *obd = m->private;
12671 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12672 + int val;
12673 + int rc;
12674 +@@ -242,22 +235,22 @@ int lprocfs_ofd_wr_fmd_max_num(struct file *file, const char *buffer,
12675 + ofd->ofd_fmd_max_num = val;
12676 + return count;
12677 + }
12678 ++LPROC_SEQ_FOPS(ofd_fmd_max_num);
12679 +
12680 +-int lprocfs_ofd_rd_fmd_max_age(char *page, char **start, off_t off,
12681 +- int count, int *eof, void *data)
12682 ++static int ofd_fmd_max_age_seq_show(struct seq_file *m, void *data)
12683 + {
12684 +- struct obd_device *obd = data;
12685 ++ struct obd_device *obd = m->private;
12686 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12687 +- int rc;
12688 +
12689 +- rc = snprintf(page, count, "%ld\n", ofd->ofd_fmd_max_age / HZ);
12690 +- return rc;
12691 ++ return seq_printf(m, "%ld\n", ofd->ofd_fmd_max_age / HZ);
12692 + }
12693 +
12694 +-int lprocfs_ofd_wr_fmd_max_age(struct file *file, const char *buffer,
12695 +- unsigned long count, void *data)
12696 ++static ssize_t
12697 ++ofd_fmd_max_age_seq_write(struct file *file, const char *buffer,
12698 ++ size_t count, loff_t *off)
12699 + {
12700 +- struct obd_device *obd = data;
12701 ++ struct seq_file *m = file->private_data;
12702 ++ struct obd_device *obd = m->private;
12703 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12704 + int val;
12705 + int rc;
12706 +@@ -272,22 +265,22 @@ int lprocfs_ofd_wr_fmd_max_age(struct file *file, const char *buffer,
12707 + ofd->ofd_fmd_max_age = val * HZ;
12708 + return count;
12709 + }
12710 ++LPROC_SEQ_FOPS(ofd_fmd_max_age);
12711 +
12712 +-static int lprocfs_ofd_rd_capa(char *page, char **start, off_t off,
12713 +- int count, int *eof, void *data)
12714 ++static int ofd_capa_seq_show(struct seq_file *m, void *data)
12715 + {
12716 +- struct obd_device *obd = data;
12717 +- int rc;
12718 ++ struct obd_device *obd = m->private;
12719 +
12720 +- rc = snprintf(page, count, "capability on: %s\n",
12721 +- obd->u.filter.fo_fl_oss_capa ? "oss" : "");
12722 +- return rc;
12723 ++ return seq_printf(m, "capability on: %s\n",
12724 ++ obd->u.filter.fo_fl_oss_capa ? "oss" : "");
12725 + }
12726 +
12727 +-static int lprocfs_ofd_wr_capa(struct file *file, const char *buffer,
12728 +- unsigned long count, void *data)
12729 ++static ssize_t
12730 ++ofd_capa_seq_write(struct file *file, const char *buffer, size_t count,
12731 ++ loff_t *off)
12732 + {
12733 +- struct obd_device *obd = data;
12734 ++ struct seq_file *m = file->private_data;
12735 ++ struct obd_device *obd = m->private;
12736 + int val, rc;
12737 +
12738 + rc = lprocfs_write_helper(buffer, count, &val);
12739 +@@ -306,28 +299,30 @@ static int lprocfs_ofd_wr_capa(struct file *file, const char *buffer,
12740 + val ? "enabled" : "disabled");
12741 + return count;
12742 + }
12743 ++LPROC_SEQ_FOPS(ofd_capa);
12744 +
12745 +-static int lprocfs_ofd_rd_capa_count(char *page, char **start, off_t off,
12746 +- int count, int *eof, void *data)
12747 ++static int ofd_capa_count_seq_show(struct seq_file *m, void *data)
12748 + {
12749 +- return snprintf(page, count, "%d %d\n",
12750 ++ return seq_printf(m, "%d %d\n",
12751 + capa_count[CAPA_SITE_CLIENT],
12752 + capa_count[CAPA_SITE_SERVER]);
12753 + }
12754 ++LPROC_SEQ_FOPS_RO(ofd_capa_count);
12755 +
12756 +-int lprocfs_ofd_rd_degraded(char *page, char **start, off_t off,
12757 +- int count, int *eof, void *data)
12758 ++static int ofd_degraded_seq_show(struct seq_file *m, void *data)
12759 + {
12760 +- struct obd_device *obd = data;
12761 ++ struct obd_device *obd = m->private;
12762 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12763 +
12764 +- return snprintf(page, count, "%u\n", ofd->ofd_raid_degraded);
12765 ++ return seq_printf(m, "%u\n", ofd->ofd_raid_degraded);
12766 + }
12767 +
12768 +-int lprocfs_ofd_wr_degraded(struct file *file, const char *buffer,
12769 +- unsigned long count, void *data)
12770 ++static ssize_t
12771 ++ofd_degraded_seq_write(struct file *file, const char *buffer,
12772 ++ size_t count, loff_t *off)
12773 + {
12774 +- struct obd_device *obd = data;
12775 ++ struct seq_file *m = file->private_data;
12776 ++ struct obd_device *obd = m->private;
12777 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12778 + int val, rc;
12779 +
12780 +@@ -338,38 +333,37 @@ int lprocfs_ofd_wr_degraded(struct file *file, const char *buffer,
12781 + spin_lock(&ofd->ofd_flags_lock);
12782 + ofd->ofd_raid_degraded = !!val;
12783 + spin_unlock(&ofd->ofd_flags_lock);
12784 +-
12785 + return count;
12786 + }
12787 ++LPROC_SEQ_FOPS(ofd_degraded);
12788 +
12789 +-int lprocfs_ofd_rd_fstype(char *page, char **start, off_t off, int count,
12790 +- int *eof, void *data)
12791 ++static int ofd_fstype_seq_show(struct seq_file *m, void *data)
12792 + {
12793 +- struct obd_device *obd = data;
12794 ++ struct obd_device *obd = m->private;
12795 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12796 + struct lu_device *d;
12797 +
12798 + LASSERT(ofd->ofd_osd);
12799 + d = &ofd->ofd_osd->dd_lu_dev;
12800 + LASSERT(d->ld_type);
12801 +- return snprintf(page, count, "%s\n", d->ld_type->ldt_name);
12802 ++ return seq_printf(m, "%s\n", d->ld_type->ldt_name);
12803 + }
12804 ++LPROC_SEQ_FOPS_RO(ofd_fstype);
12805 +
12806 +-int lprocfs_ofd_rd_syncjournal(char *page, char **start, off_t off,
12807 +- int count, int *eof, void *data)
12808 ++static int ofd_syncjournal_seq_show(struct seq_file *m, void *data)
12809 + {
12810 +- struct obd_device *obd = data;
12811 ++ struct obd_device *obd = m->private;
12812 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12813 +- int rc;
12814 +
12815 +- rc = snprintf(page, count, "%u\n", ofd->ofd_syncjournal);
12816 +- return rc;
12817 ++ return seq_printf(m, "%u\n", ofd->ofd_syncjournal);
12818 + }
12819 +
12820 +-int lprocfs_ofd_wr_syncjournal(struct file *file, const char *buffer,
12821 +- unsigned long count, void *data)
12822 ++static ssize_t
12823 ++ofd_syncjournal_seq_write(struct file *file, const char *buffer,
12824 ++ size_t count, loff_t *off)
12825 + {
12826 +- struct obd_device *obd = data;
12827 ++ struct seq_file *m = file->private_data;
12828 ++ struct obd_device *obd = m->private;
12829 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12830 + int val;
12831 + int rc;
12832 +@@ -388,27 +382,27 @@ int lprocfs_ofd_wr_syncjournal(struct file *file, const char *buffer,
12833 +
12834 + return count;
12835 + }
12836 ++LPROC_SEQ_FOPS(ofd_syncjournal);
12837 +
12838 + static char *sync_on_cancel_states[] = {"never",
12839 + "blocking",
12840 + "always" };
12841 +
12842 +-int lprocfs_ofd_rd_sync_lock_cancel(char *page, char **start, off_t off,
12843 +- int count, int *eof, void *data)
12844 ++static int ofd_sync_lock_cancel_seq_show(struct seq_file *m, void *data)
12845 + {
12846 +- struct obd_device *obd = data;
12847 ++ struct obd_device *obd = m->private;
12848 + struct lu_target *tgt = obd->u.obt.obt_lut;
12849 +- int rc;
12850 +
12851 +- rc = snprintf(page, count, "%s\n",
12852 +- sync_on_cancel_states[tgt->lut_sync_lock_cancel]);
12853 +- return rc;
12854 ++ return seq_printf(m, "%s\n",
12855 ++ sync_on_cancel_states[tgt->lut_sync_lock_cancel]);
12856 + }
12857 +
12858 +-int lprocfs_ofd_wr_sync_lock_cancel(struct file *file, const char *buffer,
12859 +- unsigned long count, void *data)
12860 ++static ssize_t
12861 ++ofd_sync_lock_cancel_seq_write(struct file *file, const char *buffer,
12862 ++ size_t count, loff_t *off)
12863 + {
12864 +- struct obd_device *obd = data;
12865 ++ struct seq_file *m = file->private_data;
12866 ++ struct obd_device *obd = m->private;
12867 + struct lu_target *tgt = obd->u.obt.obt_lut;
12868 + int val = -1;
12869 + int i;
12870 +@@ -436,22 +430,22 @@ int lprocfs_ofd_wr_sync_lock_cancel(struct file *file, const char *buffer,
12871 + spin_unlock(&tgt->lut_flags_lock);
12872 + return count;
12873 + }
12874 ++LPROC_SEQ_FOPS(ofd_sync_lock_cancel);
12875 +
12876 +-int lprocfs_ofd_rd_grant_compat_disable(char *page, char **start, off_t off,
12877 +- int count, int *eof, void *data)
12878 ++static int ofd_grant_compat_disable_seq_show(struct seq_file *m, void *data)
12879 + {
12880 +- struct obd_device *obd = data;
12881 ++ struct obd_device *obd = m->private;
12882 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12883 +- int rc;
12884 +
12885 +- rc = snprintf(page, count, "%u\n", ofd->ofd_grant_compat_disable);
12886 +- return rc;
12887 ++ return seq_printf(m, "%u\n", ofd->ofd_grant_compat_disable);
12888 + }
12889 +
12890 +-int lprocfs_ofd_wr_grant_compat_disable(struct file *file, const char *buffer,
12891 +- unsigned long count, void *data)
12892 ++static ssize_t
12893 ++ofd_grant_compat_disable_seq_write(struct file *file, const char *buffer,
12894 ++ size_t count, loff_t *off)
12895 + {
12896 +- struct obd_device *obd = data;
12897 ++ struct seq_file *m = file->private_data;
12898 ++ struct obd_device *obd = m->private;
12899 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12900 + int val;
12901 + int rc;
12902 +@@ -469,41 +463,43 @@ int lprocfs_ofd_wr_grant_compat_disable(struct file *file, const char *buffer,
12903 +
12904 + return count;
12905 + }
12906 ++LPROC_SEQ_FOPS(ofd_grant_compat_disable);
12907 +
12908 +-int lprocfs_ofd_rd_soft_sync_limit(char *page, char **start, off_t off,
12909 +- int count, int *eof, void *data)
12910 ++static int ofd_soft_sync_limit_seq_show(struct seq_file *m, void *data)
12911 + {
12912 +- struct obd_device *obd = data;
12913 ++ struct obd_device *obd = m->private;
12914 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12915 +
12916 +- return lprocfs_rd_uint(page, start, off, count, eof,
12917 +- &ofd->ofd_soft_sync_limit);
12918 ++ return lprocfs_uint_seq_show(m, &ofd->ofd_soft_sync_limit);
12919 + }
12920 +
12921 +-int lprocfs_ofd_wr_soft_sync_limit(struct file *file, const char *buffer,
12922 +- unsigned long count, void *data)
12923 ++static ssize_t
12924 ++ofd_soft_sync_limit_seq_write(struct file *file, const char *buffer,
12925 ++ size_t count, loff_t *off)
12926 + {
12927 +- struct obd_device *obd = data;
12928 ++ struct seq_file *m = file->private_data;
12929 ++ struct obd_device *obd = m->private;
12930 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12931 +
12932 +- return lprocfs_wr_uint(file, buffer, count, &ofd->ofd_soft_sync_limit);
12933 ++ return lprocfs_uint_seq_write(file, buffer, count,
12934 ++ (loff_t *) &ofd->ofd_soft_sync_limit);
12935 + }
12936 ++LPROC_SEQ_FOPS(ofd_soft_sync_limit);
12937 +
12938 +-static int lprocfs_rd_lfsck_speed_limit(char *page, char **start, off_t off,
12939 +- int count, int *eof, void *data)
12940 ++static int ofd_lfsck_speed_limit_seq_show(struct seq_file *m, void *data)
12941 + {
12942 +- struct obd_device *obd = data;
12943 ++ struct obd_device *obd = m->private;
12944 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12945 +
12946 +- *eof = 1;
12947 +-
12948 +- return lfsck_get_speed(ofd->ofd_osd, page, count);
12949 ++ return lfsck_get_speed(m, ofd->ofd_osd);
12950 + }
12951 +
12952 +-static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer,
12953 +- unsigned long count, void *data)
12954 ++static ssize_t
12955 ++ofd_lfsck_speed_limit_seq_write(struct file *file, const char *buffer,
12956 ++ size_t count, loff_t *off)
12957 + {
12958 +- struct obd_device *obd = data;
12959 ++ struct seq_file *m = file->private_data;
12960 ++ struct obd_device *obd = m->private;
12961 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12962 + __u32 val;
12963 + int rc;
12964 +@@ -516,84 +512,108 @@ static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer,
12965 +
12966 + return rc != 0 ? rc : count;
12967 + }
12968 ++LPROC_SEQ_FOPS(ofd_lfsck_speed_limit);
12969 +
12970 +-static int lprocfs_rd_lfsck_layout(char *page, char **start, off_t off,
12971 +- int count, int *eof, void *data)
12972 ++static int ofd_lfsck_layout_seq_show(struct seq_file *m, void *data)
12973 + {
12974 +- struct obd_device *obd = data;
12975 ++ struct obd_device *obd = m->private;
12976 + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
12977 +
12978 +- *eof = 1;
12979 +-
12980 +- return lfsck_dump(ofd->ofd_osd, page, count, LT_LAYOUT);
12981 +-}
12982 +-
12983 +-static struct lprocfs_vars lprocfs_ofd_obd_vars[] = {
12984 +- { "uuid", lprocfs_rd_uuid, 0, 0 },
12985 +- { "blocksize", lprocfs_rd_blksize, 0, 0 },
12986 +- { "kbytestotal", lprocfs_rd_kbytestotal, 0, 0 },
12987 +- { "kbytesfree", lprocfs_rd_kbytesfree, 0, 0 },
12988 +- { "kbytesavail", lprocfs_rd_kbytesavail, 0, 0 },
12989 +- { "filestotal", lprocfs_rd_filestotal, 0, 0 },
12990 +- { "filesfree", lprocfs_rd_filesfree, 0, 0 },
12991 +- { "seqs_allocated", lprocfs_ofd_rd_seqs, 0, 0 },
12992 +- { "fstype", lprocfs_ofd_rd_fstype, 0, 0 },
12993 +- { "last_id", lprocfs_ofd_rd_last_id, 0, 0 },
12994 +- { "tot_dirty", lprocfs_ofd_rd_tot_dirty, 0, 0 },
12995 +- { "tot_pending", lprocfs_ofd_rd_tot_pending, 0, 0 },
12996 +- { "tot_granted", lprocfs_ofd_rd_tot_granted, 0, 0 },
12997 +- { "grant_precreate", lprocfs_ofd_rd_grant_precreate, 0, 0 },
12998 +- { "grant_ratio", lprocfs_ofd_rd_grant_ratio,
12999 +- lprocfs_ofd_wr_grant_ratio, 0, 0 },
13000 +- { "precreate_batch", lprocfs_ofd_rd_precreate_batch,
13001 +- lprocfs_ofd_wr_precreate_batch, 0 },
13002 +- { "recovery_status", lprocfs_obd_rd_recovery_status, 0, 0 },
13003 +- { "recovery_time_soft", lprocfs_obd_rd_recovery_time_soft,
13004 +- lprocfs_obd_wr_recovery_time_soft, 0},
13005 +- { "recovery_time_hard", lprocfs_obd_rd_recovery_time_hard,
13006 +- lprocfs_obd_wr_recovery_time_hard, 0},
13007 +- { "evict_client", 0, lprocfs_wr_evict_client, 0,
13008 +- &lprocfs_evict_client_fops},
13009 +- { "num_exports", lprocfs_rd_num_exports, 0, 0 },
13010 +- { "degraded", lprocfs_ofd_rd_degraded,
13011 +- lprocfs_ofd_wr_degraded, 0},
13012 +- { "sync_journal", lprocfs_ofd_rd_syncjournal,
13013 +- lprocfs_ofd_wr_syncjournal, 0 },
13014 +- { "sync_on_lock_cancel", lprocfs_ofd_rd_sync_lock_cancel,
13015 +- lprocfs_ofd_wr_sync_lock_cancel, 0 },
13016 +- { "instance", lprocfs_target_rd_instance, 0 },
13017 +- { "ir_factor", lprocfs_obd_rd_ir_factor,
13018 +- lprocfs_obd_wr_ir_factor, 0},
13019 +- { "grant_compat_disable", lprocfs_ofd_rd_grant_compat_disable,
13020 +- lprocfs_ofd_wr_grant_compat_disable, 0 },
13021 +- { "client_cache_count", lprocfs_ofd_rd_fmd_max_num,
13022 +- lprocfs_ofd_wr_fmd_max_num, 0 },
13023 +- { "client_cache_seconds", lprocfs_ofd_rd_fmd_max_age,
13024 +- lprocfs_ofd_wr_fmd_max_age, 0 },
13025 +- { "capa", lprocfs_ofd_rd_capa,
13026 +- lprocfs_ofd_wr_capa, 0 },
13027 +- { "capa_count", lprocfs_ofd_rd_capa_count, 0, 0 },
13028 +- { "job_cleanup_interval", lprocfs_rd_job_interval,
13029 +- lprocfs_wr_job_interval, 0},
13030 +- { "soft_sync_limit", lprocfs_ofd_rd_soft_sync_limit,
13031 +- lprocfs_ofd_wr_soft_sync_limit, 0},
13032 +- { "lfsck_speed_limit", lprocfs_rd_lfsck_speed_limit,
13033 +- lprocfs_wr_lfsck_speed_limit, 0 },
13034 +- { "lfsck_layout", lprocfs_rd_lfsck_layout, 0, 0 },
13035 +- { 0 }
13036 +-};
13037 +-
13038 +-static struct lprocfs_vars lprocfs_ofd_module_vars[] = {
13039 +- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
13040 ++ return lfsck_dump(m, ofd->ofd_osd, LT_LAYOUT);
13041 ++}
13042 ++LPROC_SEQ_FOPS_RO(ofd_lfsck_layout);
13043 ++
13044 ++LPROC_SEQ_FOPS_RO_TYPE(ofd, uuid);
13045 ++LPROC_SEQ_FOPS_RO_TYPE(ofd, blksize);
13046 ++LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytestotal);
13047 ++LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytesfree);
13048 ++LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytesavail);
13049 ++LPROC_SEQ_FOPS_RO_TYPE(ofd, filestotal);
13050 ++LPROC_SEQ_FOPS_RO_TYPE(ofd, filesfree);
13051 ++
13052 ++LPROC_SEQ_FOPS_RO_TYPE(ofd, recovery_status);
13053 ++LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_soft);
13054 ++LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_hard);
13055 ++LPROC_SEQ_FOPS_WO_TYPE(ofd, evict_client);
13056 ++LPROC_SEQ_FOPS_RO_TYPE(ofd, num_exports);
13057 ++LPROC_SEQ_FOPS_RO_TYPE(ofd, target_instance);
13058 ++LPROC_SEQ_FOPS_RW_TYPE(ofd, ir_factor);
13059 ++LPROC_SEQ_FOPS_RW_TYPE(ofd, job_interval);
13060 ++
13061 ++struct lprocfs_seq_vars lprocfs_ofd_obd_vars[] = {
13062 ++ { .name = "uuid",
13063 ++ .fops = &ofd_uuid_fops },
13064 ++ { .name = "blocksize",
13065 ++ .fops = &ofd_blksize_fops },
13066 ++ { .name = "kbytestotal",
13067 ++ .fops = &ofd_kbytestotal_fops },
13068 ++ { .name = "kbytesfree",
13069 ++ .fops = &ofd_kbytesfree_fops },
13070 ++ { .name = "kbytesavail",
13071 ++ .fops = &ofd_kbytesavail_fops },
13072 ++ { .name = "filestotal",
13073 ++ .fops = &ofd_filestotal_fops },
13074 ++ { .name = "filesfree",
13075 ++ .fops = &ofd_filesfree_fops },
13076 ++ { .name = "seqs_allocated",
13077 ++ .fops = &ofd_seqs_fops },
13078 ++ { .name = "fstype",
13079 ++ .fops = &ofd_fstype_fops },
13080 ++ { .name = "last_id",
13081 ++ .fops = &ofd_last_id_fops },
13082 ++ { .name = "tot_dirty",
13083 ++ .fops = &ofd_tot_dirty_fops },
13084 ++ { .name = "tot_pending",
13085 ++ .fops = &ofd_tot_pending_fops },
13086 ++ { .name = "tot_granted",
13087 ++ .fops = &ofd_tot_granted_fops },
13088 ++ { .name = "grant_precreate",
13089 ++ .fops = &ofd_grant_precreate_fops },
13090 ++ { .name = "grant_ratio",
13091 ++ .fops = &ofd_grant_ratio_fops },
13092 ++ { .name = "precreate_batch",
13093 ++ .fops = &ofd_precreate_batch_fops },
13094 ++ { .name = "recovery_status",
13095 ++ .fops = &ofd_recovery_status_fops },
13096 ++ { .name = "recovery_time_soft",
13097 ++ .fops = &ofd_recovery_time_soft_fops },
13098 ++ { .name = "recovery_time_hard",
13099 ++ .fops = &ofd_recovery_time_hard_fops },
13100 ++ { .name = "evict_client",
13101 ++ .fops = &ofd_evict_client_fops },
13102 ++ { .name = "num_exports",
13103 ++ .fops = &ofd_num_exports_fops },
13104 ++ { .name = "degraded",
13105 ++ .fops = &ofd_degraded_fops },
13106 ++ { .name = "sync_journal",
13107 ++ .fops = &ofd_syncjournal_fops },
13108 ++ { .name = "sync_on_lock_cancel",
13109 ++ .fops = &ofd_sync_lock_cancel_fops },
13110 ++ { .name = "instance",
13111 ++ .fops = &ofd_target_instance_fops },
13112 ++ { .name = "ir_factor",
13113 ++ .fops = &ofd_ir_factor_fops },
13114 ++ { .name = "grant_compat_disable",
13115 ++ .fops = &ofd_grant_compat_disable_fops },
13116 ++ { .name = "client_cache_count",
13117 ++ .fops = &ofd_fmd_max_num_fops },
13118 ++ { .name = "client_cache_seconds",
13119 ++ .fops = &ofd_fmd_max_age_fops },
13120 ++ { .name = "capa",
13121 ++ .fops = &ofd_capa_fops },
13122 ++ { .name = "capa_count",
13123 ++ .fops = &ofd_capa_count_fops },
13124 ++ { .name = "job_cleanup_interval",
13125 ++ .fops = &ofd_job_interval_fops },
13126 ++ { .name = "soft_sync_limit",
13127 ++ .fops = &ofd_soft_sync_limit_fops },
13128 ++ { .name = "lfsck_speed_limit",
13129 ++ .fops = &ofd_lfsck_speed_limit_fops },
13130 ++ { .name = "lfsck_layout",
13131 ++ .fops = &ofd_lfsck_layout_fops },
13132 + { 0 }
13133 + };
13134 +
13135 +-void lprocfs_ofd_init_vars(struct lprocfs_static_vars *lvars)
13136 +-{
13137 +- lvars->module_vars = lprocfs_ofd_module_vars;
13138 +- lvars->obd_vars = lprocfs_ofd_obd_vars;
13139 +-}
13140 +-
13141 + void ofd_stats_counter_init(struct lprocfs_stats *stats)
13142 + {
13143 + LASSERT(stats && stats->ls_num >= LPROC_OFD_STATS_LAST);
13144 +diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c
13145 +index 3559991..f59f843 100644
13146 +--- a/lustre/ofd/ofd_dev.c
13147 ++++ b/lustre/ofd/ofd_dev.c
13148 +@@ -240,8 +240,7 @@ static int ofd_process_config(const struct lu_env *env, struct lu_device *d,
13149 +
13150 + switch (cfg->lcfg_command) {
13151 + case LCFG_PARAM: {
13152 +- struct lprocfs_static_vars lvars;
13153 +-
13154 ++ struct obd_device *obd = ofd_obd(m);
13155 + /* For interoperability */
13156 + struct cfg_interop_param *ptr = NULL;
13157 + struct lustre_cfg *old_cfg = NULL;
13158 +@@ -279,8 +278,7 @@ static int ofd_process_config(const struct lu_env *env, struct lu_device *d,
13159 + break;
13160 + }
13161 +
13162 +- lprocfs_ofd_init_vars(&lvars);
13163 +- rc = class_process_proc_param(PARAM_OST, lvars.obd_vars, cfg,
13164 ++ rc = class_process_proc_seq_param(PARAM_OST, obd->obd_vars, cfg,
13165 + d->ld_obd);
13166 + if (rc > 0 || rc == -ENOSYS) {
13167 + CDEBUG(D_CONFIG, "pass param %s down the stack.\n",
13168 +@@ -492,9 +490,10 @@ static struct lu_device_operations ofd_lu_ops = {
13169 + .ldo_prepare = ofd_prepare,
13170 + };
13171 +
13172 ++LPROC_SEQ_FOPS(lprocfs_nid_stats_clear);
13173 ++
13174 + static int ofd_procfs_init(struct ofd_device *ofd)
13175 + {
13176 +- struct lprocfs_static_vars lvars;
13177 + struct obd_device *obd = ofd_obd(ofd);
13178 + cfs_proc_dir_entry_t *entry;
13179 + int rc = 0;
13180 +@@ -503,8 +502,8 @@ static int ofd_procfs_init(struct ofd_device *ofd)
13181 +
13182 + /* lprocfs must be setup before the ofd so state can be safely added
13183 + * to /proc incrementally as the ofd is setup */
13184 +- lprocfs_ofd_init_vars(&lvars);
13185 +- rc = lprocfs_obd_setup(obd, lvars.obd_vars);
13186 ++ obd->obd_vars = lprocfs_ofd_obd_vars;
13187 ++ rc = lprocfs_seq_obd_setup(obd);
13188 + if (rc) {
13189 + CERROR("%s: lprocfs_obd_setup failed: %d.\n",
13190 + obd->obd_name, rc);
13191 +@@ -520,7 +519,7 @@ static int ofd_procfs_init(struct ofd_device *ofd)
13192 +
13193 + obd->obd_uses_nid_stats = 1;
13194 +
13195 +- entry = lprocfs_register("exports", obd->obd_proc_entry, NULL, NULL);
13196 ++ entry = lprocfs_seq_register("exports", obd->obd_proc_entry, NULL, NULL);
13197 + if (IS_ERR(entry)) {
13198 + rc = PTR_ERR(entry);
13199 + CERROR("%s: error %d setting up lprocfs for %s\n",
13200 +@@ -530,8 +529,10 @@ static int ofd_procfs_init(struct ofd_device *ofd)
13201 + obd->obd_proc_exports_entry = entry;
13202 +
13203 + entry = lprocfs_add_simple(obd->obd_proc_exports_entry, "clear",
13204 +- lprocfs_nid_stats_clear_read,
13205 +- lprocfs_nid_stats_clear_write, obd, NULL);
13206 ++#ifndef HAVE_ONLY_PROCFS_SEQ
13207 ++ NULL, NULL,
13208 ++#endif
13209 ++ obd, &lprocfs_nid_stats_clear_fops);
13210 + if (IS_ERR(entry)) {
13211 + rc = PTR_ERR(entry);
13212 + CERROR("%s: add proc entry 'clear' failed: %d.\n",
13213 +@@ -547,7 +548,7 @@ static int ofd_procfs_init(struct ofd_device *ofd)
13214 + GOTO(remove_entry_clear, rc);
13215 + RETURN(0);
13216 + remove_entry_clear:
13217 +- lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
13218 ++ lprocfs_remove(&obd->obd_proc_exports_entry);
13219 + obd_cleanup:
13220 + lprocfs_obd_cleanup(obd);
13221 + lprocfs_free_obd_stats(obd);
13222 +@@ -560,29 +561,28 @@ static void ofd_procfs_add_brw_stats_symlink(struct ofd_device *ofd)
13223 + struct obd_device *obd = ofd_obd(ofd);
13224 + struct obd_device *osd_obd = ofd->ofd_osd_exp->exp_obd;
13225 + cfs_proc_dir_entry_t *osd_root = osd_obd->obd_type->typ_procroot;
13226 +- cfs_proc_dir_entry_t *osd_dir;
13227 ++ cfs_proc_dir_entry_t *osd_dir = osd_obd->obd_type->typ_procsym;
13228 +
13229 +- osd_dir = lprocfs_srch(osd_root, obd->obd_name);
13230 + if (osd_dir == NULL)
13231 + return;
13232 +
13233 +- if (lprocfs_srch(osd_dir, "brw_stats") != NULL)
13234 ++ //if (lprocfs_srch(osd_dir, "brw_stats") != NULL)
13235 + lprocfs_add_symlink("brw_stats", obd->obd_proc_entry,
13236 + "../../%s/%s/brw_stats",
13237 + osd_root->name, osd_dir->name);
13238 +
13239 +- if (lprocfs_srch(osd_dir, "read_cache_enable") != NULL)
13240 ++ //if (lprocfs_srch(osd_dir, "read_cache_enable") != NULL)
13241 + lprocfs_add_symlink("read_cache_enable", obd->obd_proc_entry,
13242 + "../../%s/%s/read_cache_enable",
13243 + osd_root->name, osd_dir->name);
13244 +
13245 +- if (lprocfs_srch(osd_dir, "readcache_max_filesize") != NULL)
13246 ++ //if (lprocfs_srch(osd_dir, "readcache_max_filesize") != NULL)
13247 + lprocfs_add_symlink("readcache_max_filesize",
13248 + obd->obd_proc_entry,
13249 + "../../%s/%s/readcache_max_filesize",
13250 + osd_root->name, osd_dir->name);
13251 +
13252 +- if (lprocfs_srch(osd_dir, "writethrough_cache_enable") != NULL)
13253 ++ //if (lprocfs_srch(osd_dir, "writethrough_cache_enable") != NULL)
13254 + lprocfs_add_symlink("writethrough_cache_enable",
13255 + obd->obd_proc_entry,
13256 + "../../%s/%s/writethrough_cache_enable",
13257 +@@ -593,13 +593,8 @@ static void ofd_procfs_fini(struct ofd_device *ofd)
13258 + {
13259 + struct obd_device *obd = ofd_obd(ofd);
13260 +
13261 +- lprocfs_remove_proc_entry("writethrough_cache_enable",
13262 +- obd->obd_proc_entry);
13263 +- lprocfs_remove_proc_entry("readcache_max_filesize",
13264 +- obd->obd_proc_entry);
13265 +- lprocfs_remove_proc_entry("read_cache_enable", obd->obd_proc_entry);
13266 +- lprocfs_remove_proc_entry("brw_stats", obd->obd_proc_entry);
13267 +- lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
13268 ++ lprocfs_remove(&obd->obd_proc_exports_entry);
13269 ++ lprocfs_remove(&obd->obd_proc_entry);
13270 + lprocfs_free_per_client_stats(obd);
13271 + lprocfs_obd_cleanup(obd);
13272 + lprocfs_free_obd_stats(obd);
13273 +@@ -2363,7 +2358,6 @@ static struct lu_device_type ofd_device_type = {
13274 +
13275 + int __init ofd_init(void)
13276 + {
13277 +- struct lprocfs_static_vars lvars;
13278 + int rc;
13279 +
13280 + rc = lu_kmem_init(ofd_caches);
13281 +@@ -2376,11 +2370,9 @@ int __init ofd_init(void)
13282 + return(rc);
13283 + }
13284 +
13285 +- lprocfs_ofd_init_vars(&lvars);
13286 +-
13287 + rc = class_register_type(&ofd_obd_ops, NULL, NULL,
13288 + #ifndef HAVE_ONLY_PROCFS_SEQ
13289 +- lvars.module_vars,
13290 ++ NULL,
13291 + #endif
13292 + LUSTRE_OST_NAME, &ofd_device_type);
13293 + return rc;
13294 +diff --git a/lustre/ofd/ofd_internal.h b/lustre/ofd/ofd_internal.h
13295 +index b22ceec..79dfaa9 100644
13296 +--- a/lustre/ofd/ofd_internal.h
13297 ++++ b/lustre/ofd/ofd_internal.h
13298 +@@ -390,13 +390,9 @@ int ofd_txn_stop_cb(const struct lu_env *env, struct thandle *txn,
13299 +
13300 + /* lproc_ofd.c */
13301 + #ifdef LPROCFS
13302 +-void lprocfs_ofd_init_vars(struct lprocfs_static_vars *lvars);
13303 ++extern struct lprocfs_seq_vars lprocfs_ofd_obd_vars[];
13304 + void ofd_stats_counter_init(struct lprocfs_stats *stats);
13305 + #else
13306 +-static void lprocfs_ofd_init_vars(struct lprocfs_static_vars *lvars)
13307 +-{
13308 +- memset(lvars, 0, sizeof(*lvars));
13309 +-}
13310 + static inline void ofd_stats_counter_init(struct lprocfs_stats *stats) {}
13311 + #endif
13312 +
13313 +diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c
13314 +index 6f369d0..9027533 100644
13315 +--- a/lustre/osd-ldiskfs/osd_handler.c
13316 ++++ b/lustre/osd-ldiskfs/osd_handler.c
13317 +@@ -5882,6 +5882,7 @@ static int osd_obd_connect(const struct lu_env *env, struct obd_export **exp,
13318 + osd->od_connects++;
13319 + spin_unlock(&osd->od_osfs_lock);
13320 +
13321 ++ obd->obd_type->typ_procsym = osd->od_proc_entry;
13322 + RETURN(0);
13323 + }
13324 +
13325 +diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c
13326 +index 36bf6a4..40d2c67 100644
13327 +--- a/lustre/osd-zfs/osd_handler.c
13328 ++++ b/lustre/osd-zfs/osd_handler.c
13329 +@@ -813,6 +813,7 @@ static int osd_obd_connect(const struct lu_env *env, struct obd_export **exp,
13330 + osd->od_connects++;
13331 + spin_unlock(&osd->od_objset.lock);
13332 +
13333 ++ obd->obd_type->typ_procsym = osd->od_proc_entry;
13334 + RETURN(0);
13335 + }
13336 +
13337 +--
13338 +1.8.5.3
13339 +
13340
13341 diff --git a/sys-cluster/lustre/files/0009-LU-3319-procfs-move-ost-proc-handling-over-to-seq_fi.patch b/sys-cluster/lustre/files/0009-LU-3319-procfs-move-ost-proc-handling-over-to-seq_fi.patch
13342 deleted file mode 100644
13343 index 59eeb06..0000000
13344 --- a/sys-cluster/lustre/files/0009-LU-3319-procfs-move-ost-proc-handling-over-to-seq_fi.patch
13345 +++ /dev/null
13346 @@ -1,174 +0,0 @@
13347 -From 917c26236db7d3684733f693ccc579c3dd41f26c Mon Sep 17 00:00:00 2001
13348 -From: James Simmons <uja.ornl@×××××.com>
13349 -Date: Thu, 14 Nov 2013 09:48:08 -0500
13350 -Subject: [PATCH 09/18] LU-3319 procfs: move ost proc handling over to seq_file
13351 -
13352 -Most of the current proc handling of the OST is already
13353 -based on seq_file handling except for the reporting of
13354 -the UUID of the OST. This patch moves this last piece
13355 -so that the OST layer will use strictly proc files with
13356 -seq_files.
13357 -
13358 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
13359 -Change-Id: Idf2bc014ada9292d545f761aa27c777412a66671
13360 ----
13361 - lustre/ost/Makefile.in | 2 +-
13362 - lustre/ost/lproc_ost.c | 58 -----------------------------------------------
13363 - lustre/ost/ost_handler.c | 21 +++++++++++------
13364 - lustre/ost/ost_internal.h | 9 --------
13365 - 4 files changed, 15 insertions(+), 75 deletions(-)
13366 - delete mode 100644 lustre/ost/lproc_ost.c
13367 -
13368 -diff --git a/lustre/ost/Makefile.in b/lustre/ost/Makefile.in
13369 -index 6bd8be3..bae023e 100644
13370 ---- a/lustre/ost/Makefile.in
13371 -+++ b/lustre/ost/Makefile.in
13372 -@@ -1,5 +1,5 @@
13373 - MODULES := ost
13374 --ost-objs := ost_handler.o lproc_ost.o
13375 -+ost-objs := ost_handler.o
13376 -
13377 - EXTRA_DIST = $(ost-objs:%.o=%.c) ost_internal.h
13378 -
13379 -diff --git a/lustre/ost/lproc_ost.c b/lustre/ost/lproc_ost.c
13380 -deleted file mode 100644
13381 -index a978c51..0000000
13382 ---- a/lustre/ost/lproc_ost.c
13383 -+++ /dev/null
13384 -@@ -1,58 +0,0 @@
13385 --/*
13386 -- * GPL HEADER START
13387 -- *
13388 -- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13389 -- *
13390 -- * This program is free software; you can redistribute it and/or modify
13391 -- * it under the terms of the GNU General Public License version 2 only,
13392 -- * as published by the Free Software Foundation.
13393 -- *
13394 -- * This program is distributed in the hope that it will be useful, but
13395 -- * WITHOUT ANY WARRANTY; without even the implied warranty of
13396 -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13397 -- * General Public License version 2 for more details (a copy is included
13398 -- * in the LICENSE file that accompanied this code).
13399 -- *
13400 -- * You should have received a copy of the GNU General Public License
13401 -- * version 2 along with this program; If not, see
13402 -- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
13403 -- *
13404 -- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
13405 -- * CA 95054 USA or visit www.sun.com if you need additional information or
13406 -- * have any questions.
13407 -- *
13408 -- * GPL HEADER END
13409 -- */
13410 --/*
13411 -- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
13412 -- * Use is subject to license terms.
13413 -- */
13414 --/*
13415 -- * This file is part of Lustre, http://www.lustre.org/
13416 -- * Lustre is a trademark of Sun Microsystems, Inc.
13417 -- */
13418 --#define DEBUG_SUBSYSTEM S_OST
13419 --
13420 --#include <obd_class.h>
13421 --#include <lprocfs_status.h>
13422 --#include <linux/seq_file.h>
13423 --#include "ost_internal.h"
13424 --
13425 --#ifdef LPROCFS
13426 --static struct lprocfs_vars lprocfs_ost_obd_vars[] = {
13427 -- { "uuid", lprocfs_rd_uuid, 0, 0 },
13428 -- { 0 }
13429 --};
13430 --
13431 --static struct lprocfs_vars lprocfs_ost_module_vars[] = {
13432 -- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
13433 -- { 0 }
13434 --};
13435 --
13436 --void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars)
13437 --{
13438 -- lvars->module_vars = lprocfs_ost_module_vars;
13439 -- lvars->obd_vars = lprocfs_ost_obd_vars;
13440 --}
13441 --
13442 --#endif /* LPROCFS */
13443 -diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c
13444 -index 662a489..7567acf 100644
13445 ---- a/lustre/ost/ost_handler.c
13446 -+++ b/lustre/ost/ost_handler.c
13447 -@@ -538,12 +538,20 @@ static int ost_io_hpreq_handler(struct ptlrpc_request *req)
13448 -
13449 - static struct cfs_cpt_table *ost_io_cptable;
13450 -
13451 -+#ifdef LPROCFS
13452 -+LPROC_SEQ_FOPS_RO_TYPE(ost, uuid);
13453 -+
13454 -+static struct lprocfs_seq_vars lprocfs_ost_obd_vars[] = {
13455 -+ { "uuid", &ost_uuid_fops },
13456 -+ { 0 }
13457 -+};
13458 -+#endif /* LPROCFS */
13459 -+
13460 - /* Sigh - really, this is an OSS, the _server_, not the _target_ */
13461 - static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
13462 - {
13463 - static struct ptlrpc_service_conf svc_conf;
13464 - struct ost_obd *ost = &obd->u.ost;
13465 -- struct lprocfs_static_vars lvars;
13466 - nodemask_t *mask;
13467 - int rc;
13468 - ENTRY;
13469 -@@ -552,9 +560,10 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
13470 - if (rc)
13471 - RETURN(rc);
13472 -
13473 -- lprocfs_ost_init_vars(&lvars);
13474 -- lprocfs_obd_setup(obd, lvars.obd_vars);
13475 --
13476 -+#ifdef LPROCFS
13477 -+ obd->obd_vars = lprocfs_ost_obd_vars;
13478 -+ lprocfs_seq_obd_setup(obd);
13479 -+#endif
13480 - mutex_init(&ost->ost_health_mutex);
13481 -
13482 - svc_conf = (typeof(svc_conf)) {
13483 -@@ -877,15 +886,13 @@ static struct obd_ops ost_obd_ops = {
13484 -
13485 - static int __init ost_init(void)
13486 - {
13487 -- struct lprocfs_static_vars lvars;
13488 - int rc;
13489 -
13490 - ENTRY;
13491 -
13492 -- lprocfs_ost_init_vars(&lvars);
13493 - rc = class_register_type(&ost_obd_ops, NULL, NULL,
13494 - #ifndef HAVE_ONLY_PROCFS_SEQ
13495 -- lvars.module_vars,
13496 -+ NULL,
13497 - #endif
13498 - LUSTRE_OSS_NAME, NULL);
13499 -
13500 -diff --git a/lustre/ost/ost_internal.h b/lustre/ost/ost_internal.h
13501 -index 8b475a1..63c8415 100644
13502 ---- a/lustre/ost/ost_internal.h
13503 -+++ b/lustre/ost/ost_internal.h
13504 -@@ -39,13 +39,4 @@
13505 -
13506 - #define OSS_SERVICE_WATCHDOG_FACTOR 2
13507 -
13508 --#ifdef LPROCFS
13509 --void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars);
13510 --#else
13511 --static void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars)
13512 --{
13513 -- memset(lvars, 0, sizeof(*lvars));
13514 --}
13515 --#endif
13516 --
13517 - #endif /* OST_INTERNAL_H */
13518 ---
13519 -1.8.5.1
13520 -
13521
13522 diff --git a/sys-cluster/lustre/files/0018-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch b/sys-cluster/lustre/files/0010-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch
13523 similarity index 79%
13524 rename from sys-cluster/lustre/files/0018-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch
13525 rename to sys-cluster/lustre/files/0010-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch
13526 index c74a18b..acfa04f 100644
13527 --- a/sys-cluster/lustre/files/0018-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch
13528 +++ b/sys-cluster/lustre/files/0010-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch
13529 @@ -1,7 +1,7 @@
13530 -From 40b657155058d824c3ef8e4f22955eacca5eeb79 Mon Sep 17 00:00:00 2001
13531 +From 5a0b800373ce5e05f6ac64686e6381f7d2706044 Mon Sep 17 00:00:00 2001
13532 From: James Simmons <uja.ornl@×××××.com>
13533 -Date: Thu, 14 Nov 2013 19:41:12 -0500
13534 -Subject: [PATCH 18/18] LU-3319 procfs: update ldiskfs proc handling to
13535 +Date: Fri, 31 Jan 2014 10:38:14 -0500
13536 +Subject: [PATCH 10/13] LU-3319 procfs: update ldiskfs proc handling to
13537 seq_files
13538
13539 Migrate all ldiskfs proc handling to using strictly
13540 @@ -10,58 +10,103 @@ seq_files.
13541 Signed-off-by: James Simmons <uja.ornl@×××××.com>
13542 Change-Id: Ia296a4682e2feda02bcfbe0100de8a89404cd731
13543 ---
13544 - lustre/osd-ldiskfs/osd_handler.c | 7 +-
13545 + lustre/osd-ldiskfs/osd_compat.c | 6 +-
13546 + lustre/osd-ldiskfs/osd_handler.c | 16 +-
13547 lustre/osd-ldiskfs/osd_internal.h | 6 +-
13548 - lustre/osd-ldiskfs/osd_lproc.c | 321 +++++++++++++++++++-------------------
13549 - lustre/osd-ldiskfs/osd_scrub.c | 73 +++------
13550 - 4 files changed, 192 insertions(+), 215 deletions(-)
13551 + lustre/osd-ldiskfs/osd_lproc.c | 338 ++++++++++++++++++++------------------
13552 + lustre/osd-ldiskfs/osd_scrub.c | 73 +++-----
13553 + 5 files changed, 222 insertions(+), 217 deletions(-)
13554
13555 +diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c
13556 +index b4a018c..6ca1304 100644
13557 +--- a/lustre/osd-ldiskfs/osd_compat.c
13558 ++++ b/lustre/osd-ldiskfs/osd_compat.c
13559 +@@ -1168,7 +1168,7 @@ int osd_obj_spec_update(struct osd_thread_info *info, struct osd_device *osd,
13560 + handle_t *th)
13561 + {
13562 + struct dentry *root;
13563 +- char *name;
13564 ++ char *name = NULL;
13565 + int rc;
13566 + ENTRY;
13567 +
13568 +@@ -1189,7 +1189,7 @@ int osd_obj_spec_insert(struct osd_thread_info *info, struct osd_device *osd,
13569 + handle_t *th)
13570 + {
13571 + struct dentry *root;
13572 +- char *name;
13573 ++ char *name = NULL;
13574 + int rc;
13575 + ENTRY;
13576 +
13577 +@@ -1211,7 +1211,7 @@ int osd_obj_spec_lookup(struct osd_thread_info *info, struct osd_device *osd,
13578 + struct dentry *root;
13579 + struct dentry *dentry;
13580 + struct inode *inode;
13581 +- char *name;
13582 ++ char *name = NULL;
13583 + int rc = -ENOENT;
13584 + ENTRY;
13585 +
13586 diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c
13587 -index c13c682..7f8748d 100644
13588 +index 9027533..dfaa542 100644
13589 --- a/lustre/osd-ldiskfs/osd_handler.c
13590 +++ b/lustre/osd-ldiskfs/osd_handler.c
13591 -@@ -5820,19 +5820,18 @@ static struct obd_ops osd_obd_device_ops = {
13592 -
13593 - static int __init osd_mod_init(void)
13594 +@@ -5814,6 +5814,7 @@ static struct lu_device *osd_device_free(const struct lu_env *env,
13595 + static int osd_process_config(const struct lu_env *env,
13596 + struct lu_device *d, struct lustre_cfg *cfg)
13597 {
13598 -- struct lprocfs_static_vars lvars;
13599 - int rc;
13600 -
13601 - osd_oi_mod_init();
13602 -- lprocfs_osd_init_vars(&lvars);
13603 -
13604 - rc = lu_kmem_init(ldiskfs_caches);
13605 ++ struct obd_device *obd = d->ld_obd;
13606 + struct osd_device *o = osd_dev(d);
13607 + int rc;
13608 + ENTRY;
13609 +@@ -5828,12 +5829,12 @@ static int osd_process_config(const struct lu_env *env,
13610 + break;
13611 + case LCFG_PARAM:
13612 + LASSERT(&o->od_dt_dev);
13613 +- rc = class_process_proc_param(PARAM_OSD, lprocfs_osd_obd_vars,
13614 +- cfg, &o->od_dt_dev);
13615 ++ rc = class_process_proc_seq_param(PARAM_OSD, obd->obd_vars,
13616 ++ cfg, &o->od_dt_dev);
13617 + if (rc > 0 || rc == -ENOSYS)
13618 +- rc = class_process_proc_param(PARAM_OST,
13619 +- lprocfs_osd_obd_vars,
13620 +- cfg, &o->od_dt_dev);
13621 ++ rc = class_process_proc_seq_param(PARAM_OST,
13622 ++ obd->obd_vars, cfg,
13623 ++ &o->od_dt_dev);
13624 + break;
13625 + default:
13626 + rc = -ENOSYS;
13627 +@@ -5981,9 +5982,10 @@ static int __init osd_mod_init(void)
13628 if (rc)
13629 return rc;
13630
13631 - rc = class_register_type(&osd_obd_device_ops, NULL, NULL,
13632 +-#ifndef HAVE_ONLY_PROCFS_SEQ
13633 + rc = class_register_type(&osd_obd_device_ops, NULL,
13634 -+ lprocfs_osd_module_vars,
13635 - #ifndef HAVE_ONLY_PROCFS_SEQ
13636 -- lvars.module_vars,
13637 + lprocfs_osd_module_vars,
13638 ++#ifndef HAVE_ONLY_PROCFS_SEQ
13639 + NULL,
13640 #endif
13641 LUSTRE_OSD_LDISKFS_NAME, &osd_device_type);
13642 if (rc)
13643 diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h
13644 -index 8d5ca40..35d1b10 100644
13645 +index 8436d1f..c90147f 100644
13646 --- a/lustre/osd-ldiskfs/osd_internal.h
13647 +++ b/lustre/osd-ldiskfs/osd_internal.h
13648 -@@ -623,11 +623,11 @@ static inline int __osd_xattr_set(struct osd_thread_info *info,
13649 +@@ -623,8 +623,8 @@ static inline int __osd_xattr_set(struct osd_thread_info *info,
13650
13651 #ifdef LPROCFS
13652 /* osd_lproc.c */
13653 --void lprocfs_osd_init_vars(struct lprocfs_static_vars *lvars);
13654 +-extern struct lprocfs_vars lprocfs_osd_obd_vars[];
13655 +-extern struct lprocfs_vars lprocfs_osd_module_vars[];
13656 ++extern struct lprocfs_seq_vars lprocfs_osd_obd_vars[];
13657 +extern struct lprocfs_seq_vars lprocfs_osd_module_vars[];
13658 -+
13659 int osd_procfs_init(struct osd_device *osd, const char *name);
13660 int osd_procfs_fini(struct osd_device *osd);
13661 void osd_brw_stats_update(struct osd_device *osd, struct osd_iobuf *iobuf);
13662 --
13663 - #endif
13664 - int osd_statfs(const struct lu_env *env, struct dt_device *dev,
13665 - struct obd_statfs *sfs);
13666 -@@ -678,7 +678,7 @@ int osd_oii_insert(struct osd_device *dev, struct osd_idmap_cache *oic,
13667 +@@ -679,7 +679,7 @@ int osd_oii_insert(struct osd_device *dev, struct osd_idmap_cache *oic,
13668 int insert);
13669 int osd_oii_lookup(struct osd_device *dev, const struct lu_fid *fid,
13670 struct osd_inode_id *id);
13671 @@ -71,16 +116,15 @@ index 8d5ca40..35d1b10 100644
13672 int osd_fld_lookup(const struct lu_env *env, struct osd_device *osd,
13673 obd_seq seq, struct lu_seq_range *range);
13674 diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c
13675 -index 83bb586..528f60e 100644
13676 +index b9b4e3d..67f3423 100644
13677 --- a/lustre/osd-ldiskfs/osd_lproc.c
13678 +++ b/lustre/osd-ldiskfs/osd_lproc.c
13679 -@@ -237,93 +237,45 @@ out:
13680 +@@ -237,92 +237,46 @@ out:
13681 RETURN(result);
13682 }
13683
13684 -int osd_procfs_init(struct osd_device *osd, const char *name)
13685 -{
13686 -- struct lprocfs_static_vars lvars;
13687 - struct obd_type *type;
13688 - int rc;
13689 - ENTRY;
13690 @@ -93,9 +137,9 @@ index 83bb586..528f60e 100644
13691 - LASSERT(type != NULL);
13692 -
13693 - /* Find the type procroot and add the proc entry for this device */
13694 -- lprocfs_osd_init_vars(&lvars);
13695 - osd->od_proc_entry = lprocfs_register(name, type->typ_procroot,
13696 -- lvars.obd_vars, &osd->od_dt_dev);
13697 +- lprocfs_osd_obd_vars,
13698 +- &osd->od_dt_dev);
13699 - if (IS_ERR(osd->od_proc_entry)) {
13700 - rc = PTR_ERR(osd->od_proc_entry);
13701 - CERROR("Error %d setting up lprocfs for %s\n",
13702 @@ -155,7 +199,7 @@ index 83bb586..528f60e 100644
13703 + return -EINPROGRESS;
13704
13705 - return snprintf(page, count, "%s\n", osd->od_mntdev);
13706 -+ return seq_printf(m, "%s\n", osd->od_mntdev);
13707 ++ return seq_printf(m, "%u\n", osd->od_read_cache);
13708 }
13709 +LPROC_SEQ_FOPS_RO(ldiskfs_osd_mntdev);
13710
13711 @@ -178,17 +222,18 @@ index 83bb586..528f60e 100644
13712 - unsigned long count, void *data)
13713 +static ssize_t
13714 +ldiskfs_osd_cache_seq_write(struct file *file, const char *buffer,
13715 -+ size_t count, loff_t *off)
13716 ++ size_t count, loff_t *off)
13717 {
13718 - struct osd_device *osd = osd_dt_dev(data);
13719 - int val, rc;
13720 -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private;
13721 ++ struct seq_file *m = file->private_data;
13722 ++ struct dt_device *dt = m->private;
13723 + struct osd_device *osd = osd_dt_dev(dt);
13724 + int val, rc;
13725
13726 LASSERT(osd != NULL);
13727 if (unlikely(osd->od_mnt == NULL))
13728 -@@ -336,24 +288,26 @@ static int lprocfs_osd_wr_cache(struct file *file, const char *buffer,
13729 +@@ -335,24 +289,26 @@ static int lprocfs_osd_wr_cache(struct file *file, const char *buffer,
13730 osd->od_read_cache = !!val;
13731 return count;
13732 }
13733 @@ -223,7 +268,7 @@ index 83bb586..528f60e 100644
13734
13735 LASSERT(osd != NULL);
13736 if (unlikely(osd->od_mnt == NULL))
13737 -@@ -366,14 +320,16 @@ static int lprocfs_osd_wr_wcache(struct file *file, const char *buffer,
13738 +@@ -365,14 +321,16 @@ static int lprocfs_osd_wr_wcache(struct file *file, const char *buffer,
13739 osd->od_writethrough_cache = !!val;
13740 return count;
13741 }
13742 @@ -246,7 +291,7 @@ index 83bb586..528f60e 100644
13743
13744 LASSERT(osd != NULL);
13745 if (unlikely(osd->od_mnt == NULL))
13746 -@@ -387,20 +343,18 @@ static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer,
13747 +@@ -386,20 +344,18 @@ static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer,
13748
13749 return rc == 0 ? count : rc;
13750 }
13751 @@ -274,7 +319,7 @@ index 83bb586..528f60e 100644
13752
13753 rc = lprocfs_write_helper(buffer, count, &pdo);
13754 if (rc != 0)
13755 -@@ -410,24 +364,25 @@ static int lprocfs_osd_wr_pdo(struct file *file, const char *buffer,
13756 +@@ -409,24 +365,25 @@ static int lprocfs_osd_wr_pdo(struct file *file, const char *buffer,
13757
13758 return count;
13759 }
13760 @@ -308,7 +353,7 @@ index 83bb586..528f60e 100644
13761 int val, rc;
13762
13763 LASSERT(dev != NULL);
13764 -@@ -441,19 +396,18 @@ static int lprocfs_osd_wr_auto_scrub(struct file *file, const char *buffer,
13765 +@@ -440,19 +397,18 @@ static int lprocfs_osd_wr_auto_scrub(struct file *file, const char *buffer,
13766 dev->od_noscrub = !val;
13767 return count;
13768 }
13769 @@ -335,7 +380,7 @@ index 83bb586..528f60e 100644
13770 {
13771 int track_declares_assert;
13772 int rc;
13773 -@@ -466,38 +420,39 @@ static int lprocfs_osd_wr_track_declares_assert(struct file *file,
13774 +@@ -465,38 +421,39 @@ static int lprocfs_osd_wr_track_declares_assert(struct file *file,
13775
13776 return count;
13777 }
13778 @@ -389,7 +434,7 @@ index 83bb586..528f60e 100644
13779 __u64 val;
13780 int rc;
13781
13782 -@@ -513,24 +468,25 @@ int lprocfs_osd_wr_readcache(struct file *file, const char *buffer,
13783 +@@ -512,24 +469,25 @@ int lprocfs_osd_wr_readcache(struct file *file, const char *buffer,
13784 OSD_MAX_CACHE_SIZE : val;
13785 return count;
13786 }
13787 @@ -423,7 +468,7 @@ index 83bb586..528f60e 100644
13788 int val;
13789 int rc;
13790
13791 -@@ -545,43 +501,86 @@ static int lprocfs_osd_wr_lma_self_repair(struct file *file, const char *buffer,
13792 +@@ -544,38 +502,104 @@ static int lprocfs_osd_wr_lma_self_repair(struct file *file, const char *buffer,
13793 dev->od_lma_self_repair = !!val;
13794 return count;
13795 }
13796 @@ -459,23 +504,39 @@ index 83bb586..528f60e 100644
13797 +LPROC_SEQ_FOPS_RO_TYPE(ldiskfs, dt_filestotal);
13798 +LPROC_SEQ_FOPS_RO_TYPE(ldiskfs, dt_filesfree);
13799 +
13800 -+static struct lprocfs_seq_vars lprocfs_osd_obd_vars[] = {
13801 -+ { "blocksize", &ldiskfs_dt_blksize_fops },
13802 -+ { "kbytestotal", &ldiskfs_dt_kbytestotal_fops },
13803 -+ { "kbytesfree", &ldiskfs_dt_kbytesfree_fops },
13804 -+ { "kbytesavail", &ldiskfs_dt_kbytesavail_fops },
13805 -+ { "filestotal", &ldiskfs_dt_filestotal_fops },
13806 -+ { "filesfree", &ldiskfs_dt_filesfree_fops },
13807 -+ { "fstype", &ldiskfs_osd_fstype_fops },
13808 -+ { "mntdev", &ldiskfs_osd_mntdev_fops },
13809 -+ { "force_sync", &ldiskfs_osd_force_sync_fops },
13810 -+ { "pdo", &ldiskfs_osd_pdo_fops },
13811 -+ { "auto_scrub", &ldiskfs_osd_auto_scrub_fops },
13812 -+ { "oi_scrub", &ldiskfs_osd_oi_scrub_fops },
13813 -+ { "read_cache_enable", &ldiskfs_osd_cache_fops },
13814 -+ { "writethrough_cache_enable", &ldiskfs_osd_wcache_fops },
13815 -+ { "readcache_max_filesize", &ldiskfs_osd_readcache_fops },
13816 -+ { "lma_self_repair", &ldiskfs_osd_lma_self_repair_fops },
13817 ++struct lprocfs_seq_vars lprocfs_osd_obd_vars[] = {
13818 ++ { .name = "blocksize",
13819 ++ .fops = &ldiskfs_dt_blksize_fops },
13820 ++ { .name = "kbytestotal",
13821 ++ .fops = &ldiskfs_dt_kbytestotal_fops },
13822 ++ { .name = "kbytesfree",
13823 ++ .fops = &ldiskfs_dt_kbytesfree_fops },
13824 ++ { .name = "kbytesavail",
13825 ++ .fops = &ldiskfs_dt_kbytesavail_fops },
13826 ++ { .name = "filestotal",
13827 ++ .fops = &ldiskfs_dt_filestotal_fops },
13828 ++ { .name = "filesfree",
13829 ++ .fops = &ldiskfs_dt_filesfree_fops },
13830 ++ { .name = "fstype",
13831 ++ .fops = &ldiskfs_osd_fstype_fops },
13832 ++ { .name = "mntdev",
13833 ++ .fops = &ldiskfs_osd_mntdev_fops },
13834 ++ { .name = "force_sync",
13835 ++ .fops = &ldiskfs_osd_force_sync_fops },
13836 ++ { .name = "pdo",
13837 ++ .fops = &ldiskfs_osd_pdo_fops },
13838 ++ { .name = "auto_scrub",
13839 ++ .fops = &ldiskfs_osd_auto_scrub_fops },
13840 ++ { .name = "oi_scrub",
13841 ++ .fops = &ldiskfs_osd_oi_scrub_fops },
13842 ++ { .name = "read_cache_enable",
13843 ++ .fops = &ldiskfs_osd_cache_fops },
13844 ++ { .name = "writethrough_cache_enable",
13845 ++ .fops = &ldiskfs_osd_wcache_fops },
13846 ++ { .name = "readcache_max_filesize",
13847 ++ .fops = &ldiskfs_osd_readcache_fops },
13848 ++ { .name = "lma_self_repair",
13849 ++ .fops = &ldiskfs_osd_lma_self_repair_fops },
13850 { 0 }
13851 };
13852
13853 @@ -486,11 +547,12 @@ index 83bb586..528f60e 100644
13854 - 0 },
13855 - { 0 }
13856 +struct lprocfs_seq_vars lprocfs_osd_module_vars[] = {
13857 -+ { "track_declares_assert", &ldiskfs_osd_track_declares_assert_fops },
13858 ++ { .name = "track_declares_assert",
13859 ++ .fops = &ldiskfs_osd_track_declares_assert_fops },
13860 + { 0 }
13861 };
13862
13863 --void lprocfs_osd_init_vars(struct lprocfs_static_vars *lvars)
13864 ++
13865 +int osd_procfs_init(struct osd_device *osd, const char *name)
13866 +{
13867 + struct obd_type *type;
13868 @@ -509,12 +571,12 @@ index 83bb586..528f60e 100644
13869 +
13870 + /* Find the type procroot and add the proc entry for this device */
13871 + osd->od_proc_entry = lprocfs_seq_register(name, type->typ_procroot,
13872 -+ lprocfs_osd_obd_vars,
13873 -+ &osd->od_dt_dev);
13874 ++ lprocfs_osd_obd_vars,
13875 ++ &osd->od_dt_dev);
13876 + if (IS_ERR(osd->od_proc_entry)) {
13877 + rc = PTR_ERR(osd->od_proc_entry);
13878 + CERROR("Error %d setting up lprocfs for %s\n",
13879 -+ rc, name);
13880 ++ rc, name);
13881 + osd->od_proc_entry = NULL;
13882 + GOTO(out, rc);
13883 + }
13884 @@ -529,9 +591,7 @@ index 83bb586..528f60e 100644
13885 +}
13886 +
13887 +int osd_procfs_fini(struct osd_device *osd)
13888 - {
13889 -- lvars->module_vars = lprocfs_osd_module_vars;
13890 -- lvars->obd_vars = lprocfs_osd_obd_vars;
13891 ++{
13892 + if (osd->od_stats)
13893 + lprocfs_free_stats(&osd->od_stats);
13894 +
13895 @@ -540,13 +600,13 @@ index 83bb586..528f60e 100644
13896 + osd->od_proc_entry = NULL;
13897 + }
13898 + RETURN(0);
13899 - }
13900 ++}
13901 #endif
13902 diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c
13903 -index 18a0a2a..38f5d29 100644
13904 +index cce33af..1002913 100644
13905 --- a/lustre/osd-ldiskfs/osd_scrub.c
13906 +++ b/lustre/osd-ldiskfs/osd_scrub.c
13907 -@@ -2508,80 +2508,69 @@ static const char *scrub_param_names[] = {
13908 +@@ -2578,80 +2578,69 @@ static const char *scrub_param_names[] = {
13909 NULL
13910 };
13911
13912 @@ -641,7 +701,7 @@ index 18a0a2a..38f5d29 100644
13913 "name: OI_scrub\n"
13914 "magic: 0x%x\n"
13915 "oi_files: %d\n"
13916 -@@ -2591,51 +2580,48 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
13917 +@@ -2661,51 +2650,48 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
13918 if (rc <= 0)
13919 goto out;
13920
13921 @@ -702,7 +762,7 @@ index 18a0a2a..38f5d29 100644
13922 "updated: "LPU64"\n"
13923 "failed: "LPU64"\n"
13924 "prior_updated: "LPU64"\n"
13925 -@@ -2648,8 +2634,6 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
13926 +@@ -2718,8 +2704,6 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
13927 if (rc <= 0)
13928 goto out;
13929
13930 @@ -711,7 +771,7 @@ index 18a0a2a..38f5d29 100644
13931 speed = checked;
13932 if (thread_is_running(&scrub->os_thread)) {
13933 cfs_duration_t duration = cfs_time_current() -
13934 -@@ -2662,8 +2646,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
13935 +@@ -2732,8 +2716,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
13936 do_div(new_checked, duration);
13937 if (rtime != 0)
13938 do_div(speed, rtime);
13939 @@ -721,7 +781,7 @@ index 18a0a2a..38f5d29 100644
13940 "average_speed: "LPU64" objects/sec\n"
13941 "real-time_speed: "LPU64" objects/sec\n"
13942 "current_position: %u\n"
13943 -@@ -2676,8 +2659,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
13944 +@@ -2746,8 +2729,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
13945 } else {
13946 if (sf->sf_run_time != 0)
13947 do_div(speed, sf->sf_run_time);
13948 @@ -731,7 +791,7 @@ index 18a0a2a..38f5d29 100644
13949 "average_speed: "LPU64" objects/sec\n"
13950 "real-time_speed: N/A\n"
13951 "current_position: N/A\n"
13952 -@@ -2689,10 +2671,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
13953 +@@ -2759,10 +2741,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len)
13954 }
13955 if (rc <= 0)
13956 goto out;
13957 @@ -744,5 +804,5 @@ index 18a0a2a..38f5d29 100644
13958 out:
13959 up_read(&scrub->os_rwsem);
13960 --
13961 -1.8.5.1
13962 +1.8.5.3
13963
13964
13965 diff --git a/sys-cluster/lustre/files/0010-LU-3319-procfs-update-shared-server-side-core-proc-h.patch b/sys-cluster/lustre/files/0010-LU-3319-procfs-update-shared-server-side-core-proc-h.patch
13966 deleted file mode 100644
13967 index 01afb45..0000000
13968 --- a/sys-cluster/lustre/files/0010-LU-3319-procfs-update-shared-server-side-core-proc-h.patch
13969 +++ /dev/null
13970 @@ -1,1260 +0,0 @@
13971 -From 7ae65a1edcb16232d34ead46860f6390ce93f583 Mon Sep 17 00:00:00 2001
13972 -From: James Simmons <uja.ornl@×××××.com>
13973 -Date: Tue, 3 Dec 2013 16:30:21 -0500
13974 -Subject: [PATCH 10/18] LU-3319 procfs: update shared server side core proc
13975 - handling to seq_files
13976 -
13977 -Several of the server side abstact layers such as mdt,mgs
13978 -etc share several common proc handling routines. This patch
13979 -adds the seq_file version so that the stack can gradually
13980 -be ported over to these new methods.
13981 -
13982 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
13983 -Change-Id: I2dd64046fdd4d2bb6f7550bb49cf1c9ef703c157
13984 ----
13985 - libcfs/include/libcfs/libcfs_hash.h | 5 +
13986 - libcfs/libcfs/hash.c | 80 ++++++
13987 - lustre/include/dt_object.h | 8 +
13988 - lustre/include/lprocfs_status.h | 101 ++++++--
13989 - lustre/obdclass/dt_object.c | 96 +++++++-
13990 - lustre/obdclass/lprocfs_jobstats.c | 47 +++-
13991 - lustre/obdclass/lprocfs_status.c | 467 ++++++++++++++++++++++++++++++++----
13992 - lustre/ptlrpc/lproc_ptlrpc.c | 43 ----
13993 - 8 files changed, 724 insertions(+), 123 deletions(-)
13994 -
13995 -diff --git a/libcfs/include/libcfs/libcfs_hash.h b/libcfs/include/libcfs/libcfs_hash.h
13996 -index e7d2dc8..07a12f6 100644
13997 ---- a/libcfs/include/libcfs/libcfs_hash.h
13998 -+++ b/libcfs/include/libcfs/libcfs_hash.h
13999 -@@ -840,8 +840,13 @@ static inline void __cfs_hash_set_theta(cfs_hash_t *hs, int min, int max)
14000 - }
14001 -
14002 - /* Generic debug formatting routines mainly for proc handler */
14003 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14004 - int cfs_hash_debug_header(char *str, int size);
14005 - int cfs_hash_debug_str(cfs_hash_t *hs, char *str, int size);
14006 -+#endif
14007 -+struct seq_file;
14008 -+int cfs_hash_debug_header_seq(struct seq_file *m);
14009 -+int cfs_hash_debug_str_seq(cfs_hash_t *hs, struct seq_file *m);
14010 -
14011 - /*
14012 - * Generic djb2 hash algorithm for character arrays.
14013 -diff --git a/libcfs/libcfs/hash.c b/libcfs/libcfs/hash.c
14014 -index 35c64a0..0c4faf8 100644
14015 ---- a/libcfs/libcfs/hash.c
14016 -+++ b/libcfs/libcfs/hash.c
14017 -@@ -2026,6 +2026,7 @@ void cfs_hash_rehash_key(cfs_hash_t *hs, const void *old_key,
14018 - }
14019 - EXPORT_SYMBOL(cfs_hash_rehash_key);
14020 -
14021 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14022 - int cfs_hash_debug_header(char *str, int size)
14023 - {
14024 - return snprintf(str, size, "%-*s%6s%6s%6s%6s%6s%6s%6s%7s%8s%8s%8s%s\n",
14025 -@@ -2035,6 +2036,17 @@ int cfs_hash_debug_header(char *str, int size)
14026 - " distribution");
14027 - }
14028 - EXPORT_SYMBOL(cfs_hash_debug_header);
14029 -+#endif
14030 -+
14031 -+int cfs_hash_debug_header_seq(struct seq_file *m)
14032 -+{
14033 -+ return seq_printf(m, "%-*s%6s%6s%6s%6s%6s%6s%6s%7s%8s%8s%8s%s\n",
14034 -+ CFS_HASH_BIGNAME_LEN,
14035 -+ "name", "cur", "min", "max", "theta", "t-min", "t-max",
14036 -+ "flags", "rehash", "count", "maxdep", "maxdepb",
14037 -+ " distribution");
14038 -+}
14039 -+EXPORT_SYMBOL(cfs_hash_debug_header_seq);
14040 -
14041 - static cfs_hash_bucket_t **
14042 - cfs_hash_full_bkts(cfs_hash_t *hs)
14043 -@@ -2060,6 +2072,7 @@ cfs_hash_full_nbkt(cfs_hash_t *hs)
14044 - CFS_HASH_RH_NBKT(hs) : CFS_HASH_NBKT(hs);
14045 - }
14046 -
14047 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14048 - int cfs_hash_debug_str(cfs_hash_t *hs, char *str, int size)
14049 - {
14050 - int dist[8] = { 0, };
14051 -@@ -2134,3 +2147,70 @@ int cfs_hash_debug_str(cfs_hash_t *hs, char *str, int size)
14052 - return c;
14053 - }
14054 - EXPORT_SYMBOL(cfs_hash_debug_str);
14055 -+#endif
14056 -+
14057 -+int cfs_hash_debug_str_seq(cfs_hash_t *hs, struct seq_file *m)
14058 -+{
14059 -+ int dist[8] = { 0, };
14060 -+ int maxdep = -1;
14061 -+ int maxdepb = -1;
14062 -+ int total = 0;
14063 -+ int c = 0;
14064 -+ int theta;
14065 -+ int i;
14066 -+
14067 -+ cfs_hash_lock(hs, 0);
14068 -+ theta = __cfs_hash_theta(hs);
14069 -+
14070 -+ c += seq_printf(m, "%-*s ", CFS_HASH_BIGNAME_LEN, hs->hs_name);
14071 -+ c += seq_printf(m, "%5d ", 1 << hs->hs_cur_bits);
14072 -+ c += seq_printf(m, "%5d ", 1 << hs->hs_min_bits);
14073 -+ c += seq_printf(m, "%5d ", 1 << hs->hs_max_bits);
14074 -+ c += seq_printf(m, "%d.%03d ", __cfs_hash_theta_int(theta),
14075 -+ __cfs_hash_theta_frac(theta));
14076 -+ c += seq_printf(m, "%d.%03d ", __cfs_hash_theta_int(hs->hs_min_theta),
14077 -+ __cfs_hash_theta_frac(hs->hs_min_theta));
14078 -+ c += seq_printf(m, "%d.%03d ", __cfs_hash_theta_int(hs->hs_max_theta),
14079 -+ __cfs_hash_theta_frac(hs->hs_max_theta));
14080 -+ c += seq_printf(m, " 0x%02x ", hs->hs_flags);
14081 -+ c += seq_printf(m, "%6d ", hs->hs_rehash_count);
14082 -+
14083 -+ /*
14084 -+ * The distribution is a summary of the chained hash depth in
14085 -+ * each of the libcfs hash buckets. Each buckets hsb_count is
14086 -+ * divided by the hash theta value and used to generate a
14087 -+ * histogram of the hash distribution. A uniform hash will
14088 -+ * result in all hash buckets being close to the average thus
14089 -+ * only the first few entries in the histogram will be non-zero.
14090 -+ * If you hash function results in a non-uniform hash the will
14091 -+ * be observable by outlier bucks in the distribution histogram.
14092 -+ *
14093 -+ * Uniform hash distribution: 128/128/0/0/0/0/0/0
14094 -+ * Non-Uniform hash distribution: 128/125/0/0/0/0/2/1
14095 -+ */
14096 -+ for (i = 0; i < cfs_hash_full_nbkt(hs); i++) {
14097 -+ cfs_hash_bd_t bd;
14098 -+
14099 -+ bd.bd_bucket = cfs_hash_full_bkts(hs)[i];
14100 -+ cfs_hash_bd_lock(hs, &bd, 0);
14101 -+ if (maxdep < bd.bd_bucket->hsb_depmax) {
14102 -+ maxdep = bd.bd_bucket->hsb_depmax;
14103 -+#ifdef __KERNEL__
14104 -+ maxdepb = ffz(~maxdep);
14105 -+#endif
14106 -+ }
14107 -+ total += bd.bd_bucket->hsb_count;
14108 -+ dist[min(fls(bd.bd_bucket->hsb_count/max(theta,1)),7)]++;
14109 -+ cfs_hash_bd_unlock(hs, &bd, 0);
14110 -+ }
14111 -+
14112 -+ c += seq_printf(m, "%7d ", total);
14113 -+ c += seq_printf(m, "%7d ", maxdep);
14114 -+ c += seq_printf(m, "%7d ", maxdepb);
14115 -+ for (i = 0; i < 8; i++)
14116 -+ c += seq_printf(m, "%d%c", dist[i], (i == 7) ? '\n' : '/');
14117 -+
14118 -+ cfs_hash_unlock(hs, 0);
14119 -+ return c;
14120 -+}
14121 -+EXPORT_SYMBOL(cfs_hash_debug_str_seq);
14122 -diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h
14123 -index bdf559d..ba88a80 100644
14124 ---- a/lustre/include/dt_object.h
14125 -+++ b/lustre/include/dt_object.h
14126 -@@ -1489,6 +1489,7 @@ int dt_global_init(void);
14127 - void dt_global_fini(void);
14128 -
14129 - # ifdef LPROCFS
14130 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14131 - int lprocfs_dt_rd_blksize(char *page, char **start, off_t off,
14132 - int count, int *eof, void *data);
14133 - int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off,
14134 -@@ -1501,6 +1502,13 @@ int lprocfs_dt_rd_filestotal(char *page, char **start, off_t off,
14135 - int count, int *eof, void *data);
14136 - int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off,
14137 - int count, int *eof, void *data);
14138 -+#endif
14139 -+int lprocfs_dt_blksize_seq_show(struct seq_file *m, void *v);
14140 -+int lprocfs_dt_kbytestotal_seq_show(struct seq_file *m, void *v);
14141 -+int lprocfs_dt_kbytesfree_seq_show(struct seq_file *m, void *v);
14142 -+int lprocfs_dt_kbytesavail_seq_show(struct seq_file *m, void *v);
14143 -+int lprocfs_dt_filestotal_seq_show(struct seq_file *m, void *v);
14144 -+int lprocfs_dt_filesfree_seq_show(struct seq_file *m, void *v);
14145 - # endif /* LPROCFS */
14146 -
14147 - #endif /* __LUSTRE_DT_OBJECT_H */
14148 -diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h
14149 -index 2080592..70f10a9 100644
14150 ---- a/lustre/include/lprocfs_status.h
14151 -+++ b/lustre/include/lprocfs_status.h
14152 -@@ -603,12 +603,19 @@ extern struct proc_dir_entry *
14153 - lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
14154 - const char *format, ...);
14155 - extern void lprocfs_free_per_client_stats(struct obd_device *obd);
14156 -+#ifdef HAVE_SERVER_SUPPORT
14157 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14158 - extern int
14159 - lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
14160 - unsigned long count, void *data);
14161 - extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
14162 - int count, int *eof, void *data);
14163 --
14164 -+#endif
14165 -+extern ssize_t
14166 -+lprocfs_nid_stats_clear_seq_write(struct file *file, const char *buffer,
14167 -+ size_t count, loff_t *off);
14168 -+extern int lprocfs_nid_stats_clear_seq_show(struct seq_file *file, void *data);
14169 -+#endif
14170 - extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
14171 - struct lprocfs_stats *stats);
14172 -
14173 -@@ -700,6 +707,9 @@ extern int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data);
14174 - extern int lprocfs_import_seq_show(struct seq_file *m, void *data);
14175 - extern int lprocfs_state_seq_show(struct seq_file *m, void *data);
14176 - extern int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data);
14177 -+#ifdef HAVE_SERVER_SUPPORT
14178 -+extern int lprocfs_num_exports_seq_show(struct seq_file *m, void *data);
14179 -+#endif
14180 - struct adaptive_timeout;
14181 - #ifndef HAVE_ONLY_PROCFS_SEQ
14182 - extern int lprocfs_at_hist_helper(char *page, int count, int rc,
14183 -@@ -715,9 +725,11 @@ extern int lprocfs_timeouts_seq_show(struct seq_file *m, void *data);
14184 - extern ssize_t
14185 - lprocfs_timeouts_seq_write(struct file *file, const char *buffer,
14186 - size_t count, loff_t *off);
14187 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14188 -+#ifdef HAVE_SERVER_SUPPORT
14189 - extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
14190 - unsigned long count, void *data);
14191 --#ifndef HAVE_ONLY_PROCFS_SEQ
14192 -+#endif
14193 - extern int lprocfs_wr_ping(struct file *file, const char *buffer,
14194 - unsigned long count, void *data);
14195 - extern int lprocfs_wr_import(struct file *file, const char *buffer,
14196 -@@ -727,6 +739,11 @@ extern int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
14197 - extern int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
14198 - unsigned long count, void *data);
14199 - #endif
14200 -+#ifdef HAVE_SERVER_SUPPORT
14201 -+extern ssize_t
14202 -+lprocfs_evict_client_seq_write(struct file *file, const char *buffer,
14203 -+ size_t count, loff_t *off);
14204 -+#endif
14205 - extern ssize_t
14206 - lprocfs_ping_seq_write(struct file *file, const char *buffer,
14207 - size_t count, loff_t *off);
14208 -@@ -785,10 +802,10 @@ void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
14209 - struct lprocfs_counter *cnt);
14210 -
14211 - #ifdef HAVE_SERVER_SUPPORT
14212 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14213 - /* lprocfs_status.c: recovery status */
14214 - int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
14215 - int count, int *eof, void *data);
14216 --#endif
14217 - /* lprocfs_statuc.c: hash statistics */
14218 - int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
14219 - int count, int *eof, void *data);
14220 -@@ -798,7 +815,19 @@ int lprocfs_obd_rd_ir_factor(char *page, char **start, off_t off,
14221 - int count, int *eof, void *data);
14222 - int lprocfs_obd_wr_ir_factor(struct file *file, const char *buffer,
14223 - unsigned long count, void *data);
14224 -+#endif
14225 -+/* lprocfs_status.c: recovery status */
14226 -+int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data);
14227 -
14228 -+/* lprocfs_status.c: hash statistics */
14229 -+int lprocfs_hash_seq_show(struct seq_file *m, void *data);
14230 -+
14231 -+/* lprocfs_status.c: IR factor */
14232 -+int lprocfs_ir_factor_seq_show(struct seq_file *m, void *data);
14233 -+ssize_t
14234 -+lprocfs_ir_factor_seq_write(struct file *file, const char *buffer,
14235 -+ size_t count, loff_t *off);
14236 -+#endif
14237 - extern int lprocfs_single_release(cfs_inode_t *, struct file *);
14238 - extern int lprocfs_seq_release(cfs_inode_t *, struct file *);
14239 -
14240 -@@ -874,21 +903,23 @@ struct file_operations name##_fops = { \
14241 - .release = lprocfs_single_release, \
14242 - };
14243 -
14244 -+/* lproc_ptlrpc.c */
14245 -+struct ptlrpc_request;
14246 -+extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
14247 -+
14248 -+#ifdef HAVE_SERVER_SUPPORT
14249 - /* lprocfs_jobstats.c */
14250 - int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
14251 - int event, long amount);
14252 - void lprocfs_job_stats_fini(struct obd_device *obd);
14253 - int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
14254 - cntr_init_callback fn);
14255 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14256 - int lprocfs_rd_job_interval(char *page, char **start, off_t off,
14257 - int count, int *eof, void *data);
14258 - int lprocfs_wr_job_interval(struct file *file, const char *buffer,
14259 - unsigned long count, void *data);
14260 -
14261 --/* lproc_ptlrpc.c */
14262 --struct ptlrpc_request;
14263 --extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
14264 --
14265 - /* lproc_status.c */
14266 - int lprocfs_obd_rd_recovery_time_soft(char *page, char **start, off_t off,
14267 - int count, int *eof, void *data);
14268 -@@ -900,6 +931,24 @@ int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off,
14269 - int lprocfs_obd_wr_recovery_time_hard(struct file *file,
14270 - const char *buffer,
14271 - unsigned long count, void *data);
14272 -+int lprocfs_target_rd_instance(char *page, char **start, off_t off,
14273 -+ int count, int *eof, void *data);
14274 -+#endif
14275 -+int lprocfs_job_interval_seq_show(struct seq_file *m, void *data);
14276 -+ssize_t
14277 -+lprocfs_job_interval_seq_write(struct file *file, const char *buffer,
14278 -+ size_t count, loff_t *off);
14279 -+/* lproc_status.c */
14280 -+int lprocfs_recovery_time_soft_seq_show(struct seq_file *m, void *data);
14281 -+ssize_t lprocfs_recovery_time_soft_seq_write(struct file *file,
14282 -+ const char *buffer,
14283 -+ size_t count, loff_t *off);
14284 -+int lprocfs_recovery_time_hard_seq_show(struct seq_file *m, void *data);
14285 -+ssize_t
14286 -+lprocfs_recovery_time_hard_seq_write(struct file *file, const char *buffer,
14287 -+ size_t count, loff_t *off);
14288 -+int lprocfs_target_instance_seq_show(struct seq_file *m, void *data);
14289 -+#endif
14290 - #ifndef HAVE_ONLY_PROCFS_SEQ
14291 - int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off,
14292 - int count, int *eof, void *data);
14293 -@@ -910,8 +959,6 @@ int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data);
14294 - ssize_t
14295 - lprocfs_obd_max_pages_per_rpc_seq_write(struct file *file, const char *buffer,
14296 - size_t count, loff_t *off);
14297 --int lprocfs_target_rd_instance(char *page, char **start, off_t off,
14298 -- int count, int *eof, void *data);
14299 -
14300 - /* all quota proc functions */
14301 - extern int lprocfs_quota_rd_bunit(char *page, char **start,
14302 -@@ -1032,7 +1079,26 @@ static inline void lprocfs_free_md_stats(struct obd_device *obddev)
14303 - struct obd_export;
14304 - static inline int lprocfs_add_clear_entry(struct obd_export *exp)
14305 - { return 0; }
14306 -+static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
14307 -+{ return; }
14308 - #ifdef HAVE_SERVER_SUPPORT
14309 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14310 -+static inline
14311 -+int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
14312 -+ unsigned long count, void *data)
14313 -+{return count;}
14314 -+static inline
14315 -+int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
14316 -+ int count, int *eof, void *data)
14317 -+{return count;}
14318 -+#endif
14319 -+static inline
14320 -+ssize_t lprocfs_nid_stats_seq_write(struct file *file, const char *buffer,
14321 -+ size_t count, loff_t *off)
14322 -+{return 0;}
14323 -+static inline
14324 -+int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
14325 -+{return 0;}
14326 - static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid,
14327 - int *newnid)
14328 - { return 0; }
14329 -@@ -1050,17 +1116,6 @@ static inline struct proc_dir_entry *
14330 - lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
14331 - const char *format, ...)
14332 - {return NULL; }
14333 --static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
14334 --{ return; }
14335 --static inline
14336 --int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
14337 -- unsigned long count, void *data)
14338 --{return count;}
14339 --static inline
14340 --int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
14341 -- int count, int *eof, void *data)
14342 --{return count;}
14343 --
14344 - #ifndef HAVE_ONLY_PROCFS_SEQ
14345 - static inline cfs_proc_dir_entry_t *
14346 - lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
14347 -@@ -1145,10 +1200,12 @@ static inline int lprocfs_wr_timeouts(struct file *file,
14348 - const char *buffer,
14349 - unsigned long count, void *data)
14350 - { return 0; }
14351 -+#ifdef HAVE_SERVER_SUPPORT
14352 - static inline int lprocfs_wr_evict_client(struct file *file,
14353 - const char *buffer,
14354 - unsigned long count, void *data)
14355 - { return 0; }
14356 -+#endif
14357 - static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
14358 - unsigned long count, void *data)
14359 - { return 0; }
14360 -@@ -1173,8 +1230,10 @@ static inline int lprocfs_state_seq_show(struct seq_file *m, void *data)
14361 - { return 0; }
14362 - static inline int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data)
14363 - { return 0; }
14364 -+#ifdef HAVE_SERVER_SUPPORT
14365 - static inline int lprocfs_num_exports_seq_show(struct seq_file *m, void *data)
14366 - { return 0; }
14367 -+#endif
14368 - struct adaptive_timeout;
14369 - static inline int lprocfs_seq_at_hist_helper(struct seq_file *m,
14370 - struct adaptive_timeout *at)
14371 -@@ -1185,10 +1244,12 @@ static inline ssize_t
14372 - lprocfs_timeouts_seq_write(struct file *file, const char *buffer,
14373 - size_t count, loff_t *off)
14374 - { return 0; }
14375 -+#ifdef HAVE_SERVER_SUPPORT
14376 - static inline ssize_t
14377 - lprocfs_evict_client_seq_write(struct file *file, const char *buffer,
14378 - size_t count, loff_t *off)
14379 - { return 0; }
14380 -+#endif
14381 - static inline ssize_t
14382 - lprocfs_ping_seq_write(struct file *file, const char *buffer,
14383 - size_t count, loff_t *off)
14384 -diff --git a/lustre/obdclass/dt_object.c b/lustre/obdclass/dt_object.c
14385 -index deb5863..242a45d 100644
14386 ---- a/lustre/obdclass/dt_object.c
14387 -+++ b/lustre/obdclass/dt_object.c
14388 -@@ -936,7 +936,7 @@ out:
14389 - EXPORT_SYMBOL(dt_index_read);
14390 -
14391 - #ifdef LPROCFS
14392 --
14393 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14394 - int lprocfs_dt_rd_blksize(char *page, char **start, off_t off,
14395 - int count, int *eof, void *data)
14396 - {
14397 -@@ -1051,5 +1051,99 @@ int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off,
14398 - return rc;
14399 - }
14400 - EXPORT_SYMBOL(lprocfs_dt_rd_filesfree);
14401 -+#endif
14402 -+
14403 -+int lprocfs_dt_blksize_seq_show(struct seq_file *m, void *v)
14404 -+{
14405 -+ struct dt_device *dt = m->private;
14406 -+ struct obd_statfs osfs;
14407 -+
14408 -+ int rc = dt_statfs(NULL, dt, &osfs);
14409 -+ if (rc == 0)
14410 -+ seq_printf(m, "%u\n", (unsigned) osfs.os_bsize);
14411 -+ return rc;
14412 -+}
14413 -+EXPORT_SYMBOL(lprocfs_dt_blksize_seq_show);
14414 -+
14415 -+int lprocfs_dt_kbytestotal_seq_show(struct seq_file *m, void *v)
14416 -+{
14417 -+ struct dt_device *dt = m->private;
14418 -+ struct obd_statfs osfs;
14419 -+
14420 -+ int rc = dt_statfs(NULL, dt, &osfs);
14421 -+ if (rc == 0) {
14422 -+ __u32 blk_size = osfs.os_bsize >> 10;
14423 -+ __u64 result = osfs.os_blocks;
14424 -+
14425 -+ while (blk_size >>= 1)
14426 -+ result <<= 1;
14427 -+
14428 -+ seq_printf(m, LPU64"\n", result);
14429 -+ }
14430 -+ return rc;
14431 -+}
14432 -+EXPORT_SYMBOL(lprocfs_dt_kbytestotal_seq_show);
14433 -+
14434 -+int lprocfs_dt_kbytesfree_seq_show(struct seq_file *m, void *v)
14435 -+{
14436 -+ struct dt_device *dt = m->private;
14437 -+ struct obd_statfs osfs;
14438 -+
14439 -+ int rc = dt_statfs(NULL, dt, &osfs);
14440 -+ if (rc == 0) {
14441 -+ __u32 blk_size = osfs.os_bsize >> 10;
14442 -+ __u64 result = osfs.os_bfree;
14443 -+
14444 -+ while (blk_size >>= 1)
14445 -+ result <<= 1;
14446 -+
14447 -+ seq_printf(m, LPU64"\n", result);
14448 -+ }
14449 -+ return rc;
14450 -+}
14451 -+EXPORT_SYMBOL(lprocfs_dt_kbytesfree_seq_show);
14452 -+
14453 -+int lprocfs_dt_kbytesavail_seq_show(struct seq_file *m, void *v)
14454 -+{
14455 -+ struct dt_device *dt = m->private;
14456 -+ struct obd_statfs osfs;
14457 -+
14458 -+ int rc = dt_statfs(NULL, dt, &osfs);
14459 -+ if (rc == 0) {
14460 -+ __u32 blk_size = osfs.os_bsize >> 10;
14461 -+ __u64 result = osfs.os_bavail;
14462 -+
14463 -+ while (blk_size >>= 1)
14464 -+ result <<= 1;
14465 -+
14466 -+ seq_printf(m, LPU64"\n", result);
14467 -+ }
14468 -+ return rc;
14469 -+}
14470 -+EXPORT_SYMBOL(lprocfs_dt_kbytesavail_seq_show);
14471 -+
14472 -+int lprocfs_dt_filestotal_seq_show(struct seq_file *m, void *v)
14473 -+{
14474 -+ struct dt_device *dt = m->private;
14475 -+ struct obd_statfs osfs;
14476 -+
14477 -+ int rc = dt_statfs(NULL, dt, &osfs);
14478 -+ if (rc == 0)
14479 -+ seq_printf(m, LPU64"\n", osfs.os_files);
14480 -+ return rc;
14481 -+}
14482 -+EXPORT_SYMBOL(lprocfs_dt_filestotal_seq_show);
14483 -+
14484 -+int lprocfs_dt_filesfree_seq_show(struct seq_file *m, void *v)
14485 -+{
14486 -+ struct dt_device *dt = m->private;
14487 -+ struct obd_statfs osfs;
14488 -+
14489 -+ int rc = dt_statfs(NULL, dt, &osfs);
14490 -+ if (rc == 0)
14491 -+ seq_printf(m, LPU64"\n", osfs.os_ffree);
14492 -+ return rc;
14493 -+}
14494 -+EXPORT_SYMBOL(lprocfs_dt_filesfree_seq_show);
14495 -
14496 - #endif /* LPROCFS */
14497 -diff --git a/lustre/obdclass/lprocfs_jobstats.c b/lustre/obdclass/lprocfs_jobstats.c
14498 -index f67e426..4e16a17 100644
14499 ---- a/lustre/obdclass/lprocfs_jobstats.c
14500 -+++ b/lustre/obdclass/lprocfs_jobstats.c
14501 -@@ -416,18 +416,17 @@ struct seq_operations lprocfs_jobstats_seq_sops = {
14502 -
14503 - static int lprocfs_jobstats_seq_open(struct inode *inode, struct file *file)
14504 - {
14505 -- struct proc_dir_entry *dp = PDE(inode);
14506 - struct seq_file *seq;
14507 - int rc;
14508 -
14509 -- if (LPROCFS_ENTRY_CHECK(dp))
14510 -+ if (LPROCFS_ENTRY_CHECK(PDE(inode)))
14511 - return -ENOENT;
14512 -
14513 - rc = seq_open(file, &lprocfs_jobstats_seq_sops);
14514 - if (rc)
14515 - return rc;
14516 - seq = file->private_data;
14517 -- seq->private = dp->data;
14518 -+ seq->private = PDE_DATA(inode);
14519 - return 0;
14520 - }
14521 -
14522 -@@ -520,19 +519,18 @@ int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
14523 - stats->ojs_last_cleanup = cfs_time_current_sec();
14524 -
14525 - LPROCFS_WRITE_ENTRY();
14526 -- entry = create_proc_entry("job_stats", 0644, obd->obd_proc_entry);
14527 -+ entry = proc_create_data("job_stats", 0644, obd->obd_proc_entry,
14528 -+ &lprocfs_jobstats_seq_fops, stats);
14529 - LPROCFS_WRITE_EXIT();
14530 -- if (entry) {
14531 -- entry->proc_fops = &lprocfs_jobstats_seq_fops;
14532 -- entry->data = stats;
14533 -- RETURN(0);
14534 -- } else {
14535 -+ if (entry == NULL) {
14536 - lprocfs_job_stats_fini(obd);
14537 - RETURN(-ENOMEM);
14538 - }
14539 -+ RETURN(0);
14540 - }
14541 - EXPORT_SYMBOL(lprocfs_job_stats_init);
14542 -
14543 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14544 - int lprocfs_rd_job_interval(char *page, char **start, off_t off,
14545 - int count, int *eof, void *data)
14546 - {
14547 -@@ -567,5 +565,36 @@ int lprocfs_wr_job_interval(struct file *file, const char *buffer,
14548 -
14549 - }
14550 - EXPORT_SYMBOL(lprocfs_wr_job_interval);
14551 -+#endif
14552 -+int lprocfs_job_interval_seq_show(struct seq_file *m, void *data)
14553 -+{
14554 -+ struct obd_device *obd = m->private;
14555 -+ struct obd_job_stats *stats;
14556 -+
14557 -+ LASSERT(obd != NULL);
14558 -+ stats = &obd->u.obt.obt_jobstats;
14559 -+ return seq_printf(m, "%d\n", stats->ojs_cleanup_interval);
14560 -+}
14561 -+EXPORT_SYMBOL(lprocfs_job_interval_seq_show);
14562 -+
14563 -+ssize_t
14564 -+lprocfs_job_interval_seq_write(struct file *file, const char *buffer,
14565 -+ size_t count, loff_t *off)
14566 -+{
14567 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
14568 -+ struct obd_job_stats *stats;
14569 -+ int val, rc;
14570 -+
14571 -+ LASSERT(obd != NULL);
14572 -+ stats = &obd->u.obt.obt_jobstats;
14573 -+
14574 -+ rc = lprocfs_write_helper(buffer, count, &val);
14575 -+ if (rc)
14576 -+ return rc;
14577 -
14578 -+ stats->ojs_cleanup_interval = val;
14579 -+ lprocfs_job_cleanup(stats, true);
14580 -+ return count;
14581 -+}
14582 -+EXPORT_SYMBOL(lprocfs_job_interval_seq_write);
14583 - #endif /* LPROCFS*/
14584 -diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c
14585 -index 0c805be..a33cbf2 100644
14586 ---- a/lustre/obdclass/lprocfs_status.c
14587 -+++ b/lustre/obdclass/lprocfs_status.c
14588 -@@ -288,25 +288,104 @@ static struct file_operations lprocfs_generic_fops = { };
14589 - #ifdef HAVE_SERVER_SUPPORT
14590 - int lprocfs_evict_client_open(struct inode *inode, struct file *f)
14591 - {
14592 -- struct proc_dir_entry *dp = PDE(f->f_dentry->d_inode);
14593 -- struct obd_device *obd = dp->data;
14594 --
14595 -- cfs_atomic_inc(&obd->obd_evict_inprogress);
14596 -+ struct obd_device *obd = PDE_DATA(f->f_dentry->d_inode);
14597 -
14598 -- return 0;
14599 -+ cfs_atomic_inc(&obd->obd_evict_inprogress);
14600 -+ return 0;
14601 - }
14602 -
14603 - int lprocfs_evict_client_release(struct inode *inode, struct file *f)
14604 - {
14605 -- struct proc_dir_entry *dp = PDE(f->f_dentry->d_inode);
14606 -- struct obd_device *obd = dp->data;
14607 -+ struct obd_device *obd = PDE_DATA(f->f_dentry->d_inode);
14608 -
14609 - cfs_atomic_dec(&obd->obd_evict_inprogress);
14610 - wake_up(&obd->obd_evict_inprogress_waitq);
14611 --
14612 - return 0;
14613 - }
14614 -
14615 -+#define BUFLEN (UUID_MAX + 5)
14616 -+
14617 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14618 -+int lprocfs_wr_evict_client(struct file *file, const char *buffer,
14619 -+ unsigned long count, void *data)
14620 -+{
14621 -+ struct obd_device *obd = data;
14622 -+ char *kbuf;
14623 -+ char *tmpbuf;
14624 -+
14625 -+ OBD_ALLOC(kbuf, BUFLEN);
14626 -+ if (kbuf == NULL)
14627 -+ return -ENOMEM;
14628 -+
14629 -+ /*
14630 -+ * OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1
14631 -+ * bytes into kbuf, to ensure that the string is NUL-terminated.
14632 -+ * UUID_MAX should include a trailing NUL already.
14633 -+ */
14634 -+ if (copy_from_user(kbuf, buffer,
14635 -+ min_t(unsigned long, BUFLEN - 1, count))) {
14636 -+ count = -EFAULT;
14637 -+ goto out;
14638 -+ }
14639 -+ tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count));
14640 -+ class_incref(obd, __FUNCTION__, current);
14641 -+
14642 -+ if (strncmp(tmpbuf, "nid:", 4) == 0)
14643 -+ obd_export_evict_by_nid(obd, tmpbuf + 4);
14644 -+ else if (strncmp(tmpbuf, "uuid:", 5) == 0)
14645 -+ obd_export_evict_by_uuid(obd, tmpbuf + 5);
14646 -+ else
14647 -+ obd_export_evict_by_uuid(obd, tmpbuf);
14648 -+
14649 -+ class_decref(obd, __FUNCTION__, current);
14650 -+out:
14651 -+ OBD_FREE(kbuf, BUFLEN);
14652 -+ return count;
14653 -+}
14654 -+EXPORT_SYMBOL(lprocfs_wr_evict_client);
14655 -+#endif
14656 -+
14657 -+ssize_t
14658 -+lprocfs_evict_client_seq_write(struct file *file, const char *buffer,
14659 -+ size_t count, loff_t *off)
14660 -+{
14661 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
14662 -+ char *tmpbuf, *kbuf;
14663 -+
14664 -+ OBD_ALLOC(kbuf, BUFLEN);
14665 -+ if (kbuf == NULL)
14666 -+ return -ENOMEM;
14667 -+
14668 -+ /*
14669 -+ * OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1
14670 -+ * bytes into kbuf, to ensure that the string is NUL-terminated.
14671 -+ * UUID_MAX should include a trailing NUL already.
14672 -+ */
14673 -+ if (copy_from_user(kbuf, buffer,
14674 -+ min_t(unsigned long, BUFLEN - 1, count))) {
14675 -+ count = -EFAULT;
14676 -+ goto out;
14677 -+ }
14678 -+ tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count));
14679 -+ class_incref(obd, __FUNCTION__, current);
14680 -+
14681 -+ if (strncmp(tmpbuf, "nid:", 4) == 0)
14682 -+ obd_export_evict_by_nid(obd, tmpbuf + 4);
14683 -+ else if (strncmp(tmpbuf, "uuid:", 5) == 0)
14684 -+ obd_export_evict_by_uuid(obd, tmpbuf + 5);
14685 -+ else
14686 -+ obd_export_evict_by_uuid(obd, tmpbuf);
14687 -+
14688 -+ class_decref(obd, __FUNCTION__, current);
14689 -+
14690 -+out:
14691 -+ OBD_FREE(kbuf, BUFLEN);
14692 -+ return count;
14693 -+}
14694 -+EXPORT_SYMBOL(lprocfs_evict_client_seq_write);
14695 -+
14696 -+#undef BUFLEN
14697 -+
14698 - struct file_operations lprocfs_evict_client_fops = {
14699 - .owner = THIS_MODULE,
14700 - .read = lprocfs_fops_read,
14701 -@@ -1228,6 +1307,17 @@ int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data)
14702 - }
14703 - EXPORT_SYMBOL(lprocfs_connect_flags_seq_show);
14704 -
14705 -+#ifdef HAVE_SERVER_SUPPORT
14706 -+int lprocfs_num_exports_seq_show(struct seq_file *m, void *data)
14707 -+{
14708 -+ struct obd_device *obd = data;
14709 -+
14710 -+ LASSERT(obd != NULL);
14711 -+ return seq_printf(m, "%u\n", obd->obd_num_exports);
14712 -+}
14713 -+EXPORT_SYMBOL(lprocfs_num_exports_seq_show);
14714 -+#endif
14715 -+
14716 - #ifndef HAVE_ONLY_PROCFS_SEQ
14717 -
14718 - int lprocfs_rd_uint(char *page, char **start, off_t off,
14719 -@@ -1743,6 +1833,7 @@ int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
14720 - }
14721 - EXPORT_SYMBOL(lprocfs_rd_connect_flags);
14722 -
14723 -+#ifdef HAVE_SERVER_SUPPORT
14724 - int lprocfs_rd_num_exports(char *page, char **start, off_t off, int count,
14725 - int *eof, void *data)
14726 - {
14727 -@@ -1753,6 +1844,7 @@ int lprocfs_rd_num_exports(char *page, char **start, off_t off, int count,
14728 - return snprintf(page, count, "%u\n", obd->obd_num_exports);
14729 - }
14730 - EXPORT_SYMBOL(lprocfs_rd_num_exports);
14731 -+#endif
14732 -
14733 - int lprocfs_rd_numrefs(char *page, char **start, off_t off, int count,
14734 - int *eof, void *data)
14735 -@@ -2436,6 +2528,112 @@ void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
14736 - }
14737 - EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
14738 -
14739 -+#ifdef HAVE_SERVER_SUPPORT
14740 -+/* No one appears to be using this ?? */
14741 -+int lprocfs_exp_nid_seq_show(struct seq_file *m, void *data)
14742 -+{
14743 -+ struct obd_export *exp = m->private;
14744 -+ LASSERT(exp != NULL);
14745 -+ return seq_printf(m, "%s\n", obd_export_nid2str(exp));
14746 -+}
14747 -+
14748 -+int lprocfs_exp_print_uuid_seq(cfs_hash_t *hs, cfs_hash_bd_t *bd,
14749 -+ cfs_hlist_node_t *hnode, void *cb_data)
14750 -+
14751 -+{
14752 -+ struct obd_export *exp = cfs_hash_object(hs, hnode);
14753 -+ struct seq_file *m = cb_data;
14754 -+
14755 -+ if (exp->exp_nid_stats)
14756 -+ seq_printf(m, "%s\n", obd_uuid2str(&exp->exp_client_uuid));
14757 -+ return 0;
14758 -+}
14759 -+
14760 -+int lprocfs_exp_uuid_seq_show(struct seq_file *m, void *data)
14761 -+{
14762 -+ struct nid_stat *stats = m->private;
14763 -+ struct obd_device *obd = stats->nid_obd;
14764 -+
14765 -+ cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
14766 -+ lprocfs_exp_print_uuid_seq, m);
14767 -+ return 0;
14768 -+}
14769 -+LPROC_SEQ_FOPS_RO(lprocfs_exp_uuid);
14770 -+
14771 -+int lprocfs_exp_print_hash_seq(cfs_hash_t *hs, cfs_hash_bd_t *bd,
14772 -+ cfs_hlist_node_t *hnode, void *cb_data)
14773 -+
14774 -+{
14775 -+ struct seq_file *m = cb_data;
14776 -+ struct obd_export *exp = cfs_hash_object(hs, hnode);
14777 -+
14778 -+ if (exp->exp_lock_hash != NULL) {
14779 -+ cfs_hash_debug_header_seq(m);
14780 -+ cfs_hash_debug_str_seq(hs, m);
14781 -+ }
14782 -+ return 0;
14783 -+}
14784 -+
14785 -+int lprocfs_exp_hash_seq_show(struct seq_file *m, void *data)
14786 -+{
14787 -+ struct nid_stat *stats = m->private;
14788 -+ struct obd_device *obd = stats->nid_obd;
14789 -+
14790 -+ cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
14791 -+ lprocfs_exp_print_hash_seq, m);
14792 -+ return 0;
14793 -+}
14794 -+LPROC_SEQ_FOPS_RO(lprocfs_exp_hash);
14795 -+
14796 -+int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
14797 -+{
14798 -+ return seq_printf(m, "%s\n", "Write into this file to clear all nid "
14799 -+ "stats and stale nid entries");
14800 -+}
14801 -+EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_show);
14802 -+
14803 -+static int lprocfs_nid_stats_clear_write_cb(void *obj, void *data)
14804 -+{
14805 -+ struct nid_stat *stat = obj;
14806 -+ ENTRY;
14807 -+
14808 -+ CDEBUG(D_INFO,"refcnt %d\n", cfs_atomic_read(&stat->nid_exp_ref_count));
14809 -+ if (cfs_atomic_read(&stat->nid_exp_ref_count) == 1) {
14810 -+ /* object has only hash references. */
14811 -+ spin_lock(&stat->nid_obd->obd_nid_lock);
14812 -+ cfs_list_move(&stat->nid_list, data);
14813 -+ spin_unlock(&stat->nid_obd->obd_nid_lock);
14814 -+ RETURN(1);
14815 -+ }
14816 -+ /* we has reference to object - only clear data*/
14817 -+ if (stat->nid_stats)
14818 -+ lprocfs_clear_stats(stat->nid_stats);
14819 -+
14820 -+ RETURN(0);
14821 -+}
14822 -+
14823 -+ssize_t
14824 -+lprocfs_nid_stats_clear_seq_write(struct file *file, const char *buffer,
14825 -+ size_t count, loff_t *off)
14826 -+{
14827 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
14828 -+ struct nid_stat *client_stat;
14829 -+ CFS_LIST_HEAD(free_list);
14830 -+
14831 -+ cfs_hash_cond_del(obd->obd_nid_stats_hash,
14832 -+ lprocfs_nid_stats_clear_write_cb, &free_list);
14833 -+
14834 -+ while (!cfs_list_empty(&free_list)) {
14835 -+ client_stat = cfs_list_entry(free_list.next, struct nid_stat,
14836 -+ nid_list);
14837 -+ cfs_list_del_init(&client_stat->nid_list);
14838 -+ lprocfs_free_client_stats(client_stat);
14839 -+ }
14840 -+ return count;
14841 -+}
14842 -+EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_write);
14843 -+
14844 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14845 - int lprocfs_exp_rd_nid(char *page, char **start, off_t off, int count,
14846 - int *eof, void *data)
14847 - {
14848 -@@ -2538,26 +2736,6 @@ int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
14849 - }
14850 - EXPORT_SYMBOL(lprocfs_nid_stats_clear_read);
14851 -
14852 --static int lprocfs_nid_stats_clear_write_cb(void *obj, void *data)
14853 --{
14854 -- struct nid_stat *stat = obj;
14855 -- ENTRY;
14856 --
14857 -- CDEBUG(D_INFO,"refcnt %d\n", cfs_atomic_read(&stat->nid_exp_ref_count));
14858 -- if (cfs_atomic_read(&stat->nid_exp_ref_count) == 1) {
14859 -- /* object has only hash references. */
14860 -- spin_lock(&stat->nid_obd->obd_nid_lock);
14861 -- cfs_list_move(&stat->nid_list, data);
14862 -- spin_unlock(&stat->nid_obd->obd_nid_lock);
14863 -- RETURN(1);
14864 -- }
14865 -- /* we has reference to object - only clear data*/
14866 -- if (stat->nid_stats)
14867 -- lprocfs_clear_stats(stat->nid_stats);
14868 --
14869 -- RETURN(0);
14870 --}
14871 --
14872 - int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
14873 - unsigned long count, void *data)
14874 - {
14875 -@@ -2578,8 +2756,8 @@ int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
14876 - return count;
14877 - }
14878 - EXPORT_SYMBOL(lprocfs_nid_stats_clear_write);
14879 -+#endif
14880 -
14881 --#ifdef HAVE_SERVER_SUPPORT
14882 - int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid)
14883 - {
14884 - struct nid_stat *new_stat, *old_stat;
14885 -@@ -2638,11 +2816,17 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid)
14886 - if (buffer == NULL)
14887 - GOTO(destroy_new, rc = -ENOMEM);
14888 -
14889 -- memcpy(buffer, libcfs_nid2str(*nid), LNET_NIDSTR_SIZE);
14890 -+ memcpy(buffer, libcfs_nid2str(*nid), LNET_NIDSTR_SIZE);
14891 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14892 - new_stat->nid_proc = lprocfs_register(buffer,
14893 -- obd->obd_proc_exports_entry,
14894 -- NULL, NULL);
14895 -- OBD_FREE(buffer, LNET_NIDSTR_SIZE);
14896 -+ obd->obd_proc_exports_entry,
14897 -+ NULL, NULL);
14898 -+#else
14899 -+ new_stat->nid_proc = lprocfs_seq_register(buffer,
14900 -+ obd->obd_proc_exports_entry,
14901 -+ NULL, NULL);
14902 -+#endif
14903 -+ OBD_FREE(buffer, LNET_NIDSTR_SIZE);
14904 -
14905 - if (IS_ERR(new_stat->nid_proc)) {
14906 - rc = PTR_ERR(new_stat->nid_proc);
14907 -@@ -2652,16 +2836,26 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid)
14908 - GOTO(destroy_new_ns, rc);
14909 - }
14910 -
14911 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14912 - entry = lprocfs_add_simple(new_stat->nid_proc, "uuid",
14913 - lprocfs_exp_rd_uuid, NULL, new_stat, NULL);
14914 -+#else
14915 -+ entry = lprocfs_add_simple(new_stat->nid_proc, "uuid",
14916 -+ new_stat, &lprocfs_exp_uuid_fops);
14917 -+#endif
14918 - if (IS_ERR(entry)) {
14919 - CWARN("Error adding the NID stats file\n");
14920 - rc = PTR_ERR(entry);
14921 - GOTO(destroy_new_ns, rc);
14922 - }
14923 -
14924 -+#ifndef HAVE_ONLY_PROCFS_SEQ
14925 - entry = lprocfs_add_simple(new_stat->nid_proc, "hash",
14926 - lprocfs_exp_rd_hash, NULL, new_stat, NULL);
14927 -+#else
14928 -+ entry = lprocfs_add_simple(new_stat->nid_proc, "hash",
14929 -+ new_stat, &lprocfs_exp_hash_fops);
14930 -+#endif
14931 - if (IS_ERR(entry)) {
14932 - CWARN("Error adding the hash file\n");
14933 - rc = PTR_ERR(entry);
14934 -@@ -3066,6 +3260,181 @@ void lprocfs_oh_clear(struct obd_histogram *oh)
14935 - }
14936 - EXPORT_SYMBOL(lprocfs_oh_clear);
14937 -
14938 -+#ifdef HAVE_SERVER_SUPPORT
14939 -+int lprocfs_hash_seq_show(struct seq_file *m, void *data)
14940 -+{
14941 -+ struct obd_device *obd = m->private;
14942 -+ int c = 0;
14943 -+
14944 -+ if (obd == NULL)
14945 -+ return 0;
14946 -+
14947 -+ c += cfs_hash_debug_header_seq(m);
14948 -+ c += cfs_hash_debug_str_seq(obd->obd_uuid_hash, m);
14949 -+ c += cfs_hash_debug_str_seq(obd->obd_nid_hash, m);
14950 -+ c += cfs_hash_debug_str_seq(obd->obd_nid_stats_hash, m);
14951 -+ return c;
14952 -+}
14953 -+EXPORT_SYMBOL(lprocfs_hash_seq_show);
14954 -+
14955 -+int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data)
14956 -+{
14957 -+ struct obd_device *obd = m->private;
14958 -+
14959 -+ LASSERT(obd != NULL);
14960 -+
14961 -+ seq_printf(m, "status: \n");
14962 -+ if (obd->obd_max_recoverable_clients == 0) {
14963 -+ seq_printf(m, "INACTIVE\n");
14964 -+ goto out;
14965 -+ }
14966 -+
14967 -+ /* sampled unlocked, but really... */
14968 -+ if (obd->obd_recovering == 0) {
14969 -+ seq_printf(m, "COMPLETE\n");
14970 -+ seq_printf(m, "recovery_start: %lu\n", obd->obd_recovery_start);
14971 -+ seq_printf(m, "recovery_duration: %lu\n",
14972 -+ obd->obd_recovery_end - obd->obd_recovery_start);
14973 -+ /* Number of clients that have completed recovery */
14974 -+ seq_printf(m, "completed_clients: %d/%d\n",
14975 -+ obd->obd_max_recoverable_clients -
14976 -+ obd->obd_stale_clients,
14977 -+ obd->obd_max_recoverable_clients);
14978 -+ seq_printf(m, "replayed_requests: %d\n",
14979 -+ obd->obd_replayed_requests);
14980 -+ seq_printf(m, "last_transno: "LPD64"\n",
14981 -+ obd->obd_next_recovery_transno - 1);
14982 -+ seq_printf(m, "VBR: %s\n", obd->obd_version_recov ?
14983 -+ "ENABLED" : "DISABLED");
14984 -+ seq_printf(m, "IR: %s\n", obd->obd_no_ir ?
14985 -+ "DISABLED" : "ENABLED");
14986 -+ goto out;
14987 -+ }
14988 -+
14989 -+ seq_printf(m, "RECOVERING\n");
14990 -+ seq_printf(m, "recovery_start: %lu\n", obd->obd_recovery_start);
14991 -+ seq_printf(m, "time_remaining: %lu\n",
14992 -+ cfs_time_current_sec() >=
14993 -+ obd->obd_recovery_start +
14994 -+ obd->obd_recovery_timeout ? 0 :
14995 -+ obd->obd_recovery_start +
14996 -+ obd->obd_recovery_timeout -
14997 -+ cfs_time_current_sec());
14998 -+ seq_printf(m, "connected_clients: %d/%d\n",
14999 -+ cfs_atomic_read(&obd->obd_connected_clients),
15000 -+ obd->obd_max_recoverable_clients);
15001 -+ /* Number of clients that have completed recovery */
15002 -+ seq_printf(m, "req_replay_clients: %d\n",
15003 -+ cfs_atomic_read(&obd->obd_req_replay_clients));
15004 -+ seq_printf(m, "lock_repay_clients: %d\n",
15005 -+ cfs_atomic_read(&obd->obd_lock_replay_clients));
15006 -+ seq_printf(m, "completed_clients: %d\n",
15007 -+ cfs_atomic_read(&obd->obd_connected_clients) -
15008 -+ cfs_atomic_read(&obd->obd_lock_replay_clients));
15009 -+ seq_printf(m, "evicted_clients: %d\n", obd->obd_stale_clients);
15010 -+ seq_printf(m, "replayed_requests: %d\n", obd->obd_replayed_requests);
15011 -+ seq_printf(m, "queued_requests: %d\n",
15012 -+ obd->obd_requests_queued_for_recovery);
15013 -+ seq_printf(m, "next_transno: "LPD64"\n",
15014 -+ obd->obd_next_recovery_transno);
15015 -+out:
15016 -+ return 0;
15017 -+}
15018 -+EXPORT_SYMBOL(lprocfs_recovery_status_seq_show);
15019 -+
15020 -+int lprocfs_ir_factor_seq_show(struct seq_file *m, void *data)
15021 -+{
15022 -+ struct obd_device *obd = m->private;
15023 -+
15024 -+ LASSERT(obd != NULL);
15025 -+ return seq_printf(m, "%d\n", obd->obd_recovery_ir_factor);
15026 -+}
15027 -+EXPORT_SYMBOL(lprocfs_ir_factor_seq_show);
15028 -+
15029 -+ssize_t
15030 -+lprocfs_ir_factor_seq_write(struct file *file, const char *buffer,
15031 -+ size_t count, loff_t *off)
15032 -+{
15033 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
15034 -+ int val, rc;
15035 -+
15036 -+ LASSERT(obd != NULL);
15037 -+ rc = lprocfs_write_helper(buffer, count, &val);
15038 -+ if (rc)
15039 -+ return rc;
15040 -+
15041 -+ if (val < OBD_IR_FACTOR_MIN || val > OBD_IR_FACTOR_MAX)
15042 -+ return -EINVAL;
15043 -+
15044 -+ obd->obd_recovery_ir_factor = val;
15045 -+ return count;
15046 -+}
15047 -+EXPORT_SYMBOL(lprocfs_ir_factor_seq_write);
15048 -+
15049 -+int lprocfs_recovery_time_soft_seq_show(struct seq_file *m, void *data)
15050 -+{
15051 -+ struct obd_device *obd = m->private;
15052 -+
15053 -+ LASSERT(obd != NULL);
15054 -+ return seq_printf(m, "%d\n", obd->obd_recovery_timeout);
15055 -+}
15056 -+EXPORT_SYMBOL(lprocfs_recovery_time_soft_seq_show);
15057 -+
15058 -+ssize_t
15059 -+lprocfs_recovery_time_soft_seq_write(struct file *file, const char *buffer,
15060 -+ size_t count, loff_t *off)
15061 -+{
15062 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
15063 -+ int val, rc;
15064 -+
15065 -+ LASSERT(obd != NULL);
15066 -+ rc = lprocfs_write_helper(buffer, count, &val);
15067 -+ if (rc)
15068 -+ return rc;
15069 -+
15070 -+ obd->obd_recovery_timeout = val;
15071 -+ return count;
15072 -+}
15073 -+EXPORT_SYMBOL(lprocfs_recovery_time_soft_seq_write);
15074 -+
15075 -+int lprocfs_recovery_time_hard_seq_show(struct seq_file *m, void *data)
15076 -+{
15077 -+ struct obd_device *obd = m->private;
15078 -+
15079 -+ LASSERT(obd != NULL);
15080 -+ return seq_printf(m, "%u\n", obd->obd_recovery_time_hard);
15081 -+}
15082 -+EXPORT_SYMBOL(lprocfs_recovery_time_hard_seq_show);
15083 -+
15084 -+ssize_t
15085 -+lprocfs_recovery_time_hard_seq_write(struct file *file, const char *buffer,
15086 -+ size_t count, loff_t *off)
15087 -+{
15088 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
15089 -+ int val, rc;
15090 -+
15091 -+ LASSERT(obd != NULL);
15092 -+ rc = lprocfs_write_helper(buffer, count, &val);
15093 -+ if (rc)
15094 -+ return rc;
15095 -+
15096 -+ obd->obd_recovery_time_hard = val;
15097 -+ return count;
15098 -+}
15099 -+EXPORT_SYMBOL(lprocfs_recovery_time_hard_seq_write);
15100 -+
15101 -+int lprocfs_target_instance_seq_show(struct seq_file *m, void *data)
15102 -+{
15103 -+ struct obd_device *obd = m->private;
15104 -+ struct obd_device_target *target = &obd->u.obt;
15105 -+
15106 -+ LASSERT(obd != NULL);
15107 -+ LASSERT(target->obt_magic == OBT_MAGIC);
15108 -+ return seq_printf(m, "%u\n", obd->u.obt.obt_instance);
15109 -+}
15110 -+EXPORT_SYMBOL(lprocfs_target_instance_seq_show);
15111 -+
15112 -+#ifndef HAVE_ONLY_PROCFS_SEQ
15113 - int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
15114 - int count, int *eof, void *data)
15115 - {
15116 -@@ -3084,7 +3453,6 @@ int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
15117 - }
15118 - EXPORT_SYMBOL(lprocfs_obd_rd_hash);
15119 -
15120 --#ifdef HAVE_SERVER_SUPPORT
15121 - int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
15122 - int count, int *eof, void *data)
15123 - {
15124 -@@ -3210,7 +3578,6 @@ out:
15125 - return min(count, len - (int)off);
15126 - }
15127 - EXPORT_SYMBOL(lprocfs_obd_rd_recovery_status);
15128 --#endif
15129 -
15130 - int lprocfs_obd_rd_ir_factor(char *page, char **start, off_t off,
15131 - int count, int *eof, void *data)
15132 -@@ -3295,6 +3662,21 @@ int lprocfs_obd_wr_recovery_time_hard(struct file *file, const char *buffer,
15133 - }
15134 - EXPORT_SYMBOL(lprocfs_obd_wr_recovery_time_hard);
15135 -
15136 -+int lprocfs_target_rd_instance(char *page, char **start, off_t off,
15137 -+ int count, int *eof, void *data)
15138 -+{
15139 -+ struct obd_device *obd = (struct obd_device *)data;
15140 -+ struct obd_device_target *target = &obd->u.obt;
15141 -+
15142 -+ LASSERT(obd != NULL);
15143 -+ LASSERT(target->obt_magic == OBT_MAGIC);
15144 -+ *eof = 1;
15145 -+ return snprintf(page, count, "%u\n", obd->u.obt.obt_instance);
15146 -+}
15147 -+EXPORT_SYMBOL(lprocfs_target_rd_instance);
15148 -+#endif /* HAVE_ONLY_PROCFS_SEQ */
15149 -+#endif /* HAVE_SERVER_SUPPORT */
15150 -+
15151 - int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off,
15152 - int count, int *eof, void *data)
15153 - {
15154 -@@ -3321,19 +3703,4 @@ int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data)
15155 - return rc;
15156 - }
15157 - EXPORT_SYMBOL(lprocfs_obd_max_pages_per_rpc_seq_show);
15158 --
15159 --#ifdef HAVE_SERVER_SUPPORT
15160 --int lprocfs_target_rd_instance(char *page, char **start, off_t off,
15161 -- int count, int *eof, void *data)
15162 --{
15163 -- struct obd_device *obd = (struct obd_device *)data;
15164 -- struct obd_device_target *target = &obd->u.obt;
15165 --
15166 -- LASSERT(obd != NULL);
15167 -- LASSERT(target->obt_magic == OBT_MAGIC);
15168 -- *eof = 1;
15169 -- return snprintf(page, count, "%u\n", obd->u.obt.obt_instance);
15170 --}
15171 --EXPORT_SYMBOL(lprocfs_target_rd_instance);
15172 --#endif
15173 - #endif /* LPROCFS*/
15174 -diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c
15175 -index 024169e..076b5e2 100644
15176 ---- a/lustre/ptlrpc/lproc_ptlrpc.c
15177 -+++ b/lustre/ptlrpc/lproc_ptlrpc.c
15178 -@@ -1170,49 +1170,6 @@ void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd)
15179 - }
15180 - EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd);
15181 -
15182 --#define BUFLEN (UUID_MAX + 5)
15183 --
15184 --int lprocfs_wr_evict_client(struct file *file, const char *buffer,
15185 -- unsigned long count, void *data)
15186 --{
15187 -- struct obd_device *obd = data;
15188 -- char *kbuf;
15189 -- char *tmpbuf;
15190 --
15191 -- OBD_ALLOC(kbuf, BUFLEN);
15192 -- if (kbuf == NULL)
15193 -- return -ENOMEM;
15194 --
15195 -- /*
15196 -- * OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1
15197 -- * bytes into kbuf, to ensure that the string is NUL-terminated.
15198 -- * UUID_MAX should include a trailing NUL already.
15199 -- */
15200 -- if (copy_from_user(kbuf, buffer,
15201 -- min_t(unsigned long, BUFLEN - 1, count))) {
15202 -- count = -EFAULT;
15203 -- goto out;
15204 -- }
15205 -- tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count));
15206 -- class_incref(obd, __FUNCTION__, current);
15207 --
15208 -- if (strncmp(tmpbuf, "nid:", 4) == 0)
15209 -- obd_export_evict_by_nid(obd, tmpbuf + 4);
15210 -- else if (strncmp(tmpbuf, "uuid:", 5) == 0)
15211 -- obd_export_evict_by_uuid(obd, tmpbuf + 5);
15212 -- else
15213 -- obd_export_evict_by_uuid(obd, tmpbuf);
15214 --
15215 -- class_decref(obd, __FUNCTION__, current);
15216 --
15217 --out:
15218 -- OBD_FREE(kbuf, BUFLEN);
15219 -- return count;
15220 --}
15221 --EXPORT_SYMBOL(lprocfs_wr_evict_client);
15222 --
15223 --#undef BUFLEN
15224 --
15225 - #ifndef HAVE_ONLY_PROCFS_SEQ
15226 - int lprocfs_wr_ping(struct file *file, const char *buffer,
15227 - unsigned long count, void *data)
15228 ---
15229 -1.8.5.1
15230 -
15231
15232 diff --git a/sys-cluster/lustre/files/0011-LU-3373-osd-ldiskfs-readdir-replace-by-iterate.patch b/sys-cluster/lustre/files/0011-LU-3373-osd-ldiskfs-readdir-replace-by-iterate.patch
15233 new file mode 100644
15234 index 0000000..3b1a7e5
15235 --- /dev/null
15236 +++ b/sys-cluster/lustre/files/0011-LU-3373-osd-ldiskfs-readdir-replace-by-iterate.patch
15237 @@ -0,0 +1,140 @@
15238 +From 508cde3f8347e7d6a6d299cbdfce537ebc29650c Mon Sep 17 00:00:00 2001
15239 +From: yangsheng <yang.sheng@×××××.com>
15240 +Date: Fri, 8 Nov 2013 22:31:36 +0800
15241 +Subject: [PATCH 11/13] LU-3373 osd-ldiskfs: readdir replace by iterate
15242 +
15243 +Use iterate instead of readdir callback in iop.
15244 +
15245 +Signed-off-by: yang sheng <yang.sheng@×××××.com>
15246 +Change-Id: Icb08292009c965ca693814e854ae2e77b3e7a4f0
15247 +---
15248 + lustre/osd-ldiskfs/osd_handler.c | 32 +++++++++++++++++++++++++-------
15249 + lustre/osd-ldiskfs/osd_scrub.c | 18 +++++++++++++++++-
15250 + 2 files changed, 42 insertions(+), 8 deletions(-)
15251 +
15252 +diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c
15253 +index dfaa542..f635394 100644
15254 +--- a/lustre/osd-ldiskfs/osd_handler.c
15255 ++++ b/lustre/osd-ldiskfs/osd_handler.c
15256 +@@ -4733,6 +4733,12 @@ static void osd_it_ea_put(const struct lu_env *env, struct dt_it *di)
15257 + {
15258 + }
15259 +
15260 ++struct osd_filldir_cbs {
15261 ++#ifdef HAVE_DIR_CONTEXT
15262 ++ struct dir_context ctx;
15263 ++#endif
15264 ++ struct osd_it_ea *it;
15265 ++};
15266 + /**
15267 + * It is called internally by ->readdir(). It fills the
15268 + * iterator's in-memory data structure with required
15269 +@@ -4744,11 +4750,11 @@ static void osd_it_ea_put(const struct lu_env *env, struct dt_it *di)
15270 + * \retval 0 on success
15271 + * \retval 1 on buffer full
15272 + */
15273 +-static int osd_ldiskfs_filldir(char *buf, const char *name, int namelen,
15274 ++static int osd_ldiskfs_filldir(void *buf, const char *name, int namelen,
15275 + loff_t offset, __u64 ino,
15276 + unsigned d_type)
15277 + {
15278 +- struct osd_it_ea *it = (struct osd_it_ea *)buf;
15279 ++ struct osd_it_ea *it = ((struct osd_filldir_cbs *)buf)->it;
15280 + struct osd_object *obj = it->oie_obj;
15281 + struct osd_it_ea_dirent *ent = it->oie_dirent;
15282 + struct lu_fid *fid = &ent->oied_fid;
15283 +@@ -4811,7 +4817,14 @@ static int osd_ldiskfs_it_fill(const struct lu_env *env,
15284 + struct osd_object *obj = it->oie_obj;
15285 + struct inode *inode = obj->oo_inode;
15286 + struct htree_lock *hlock = NULL;
15287 +- int result = 0;
15288 ++ struct file *filp = &it->oie_file;
15289 ++ int rc = 0;
15290 ++ struct osd_filldir_cbs buf = {
15291 ++#ifdef HAVE_DIR_CONTEXT
15292 ++ .ctx.actor = osd_ldiskfs_filldir,
15293 ++#endif
15294 ++ .it = it
15295 ++ };
15296 +
15297 + ENTRY;
15298 + it->oie_dirent = it->oie_buf;
15299 +@@ -4825,8 +4838,13 @@ static int osd_ldiskfs_it_fill(const struct lu_env *env,
15300 + down_read(&obj->oo_ext_idx_sem);
15301 + }
15302 +
15303 +- result = inode->i_fop->readdir(&it->oie_file, it,
15304 +- (filldir_t) osd_ldiskfs_filldir);
15305 ++#ifdef HAVE_DIR_CONTEXT
15306 ++ buf.ctx.pos = filp->f_pos;
15307 ++ rc = inode->i_fop->iterate(filp, &buf.ctx);
15308 ++ filp->f_pos = buf.ctx.pos;
15309 ++#else
15310 ++ rc = inode->i_fop->readdir(filp, &buf, osd_ldiskfs_filldir);
15311 ++#endif
15312 +
15313 + if (hlock != NULL)
15314 + ldiskfs_htree_unlock(hlock);
15315 +@@ -4834,13 +4852,13 @@ static int osd_ldiskfs_it_fill(const struct lu_env *env,
15316 + up_read(&obj->oo_ext_idx_sem);
15317 +
15318 + if (it->oie_rd_dirent == 0) {
15319 +- result = -EIO;
15320 ++ rc = -EIO;
15321 + } else {
15322 + it->oie_dirent = it->oie_buf;
15323 + it->oie_it_dirent = 1;
15324 + }
15325 +
15326 +- RETURN(result);
15327 ++ RETURN(rc);
15328 + }
15329 +
15330 + /**
15331 +diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c
15332 +index 1002913..8d19c1e 100644
15333 +--- a/lustre/osd-ldiskfs/osd_scrub.c
15334 ++++ b/lustre/osd-ldiskfs/osd_scrub.c
15335 +@@ -1465,6 +1465,10 @@ struct osd_ios_item {
15336 + };
15337 +
15338 + struct osd_ios_filldir_buf {
15339 ++#ifdef HAVE_DIR_CONTEXT
15340 ++ /* please keep it as first member */
15341 ++ struct dir_context ctx;
15342 ++#endif
15343 + struct osd_thread_info *oifb_info;
15344 + struct osd_device *oifb_dev;
15345 + struct dentry *oifb_dentry;
15346 +@@ -1760,7 +1764,13 @@ static int
15347 + osd_ios_general_scan(struct osd_thread_info *info, struct osd_device *dev,
15348 + struct dentry *dentry, filldir_t filldir)
15349 + {
15350 +- struct osd_ios_filldir_buf buf = { info, dev, dentry };
15351 ++ struct osd_ios_filldir_buf buf = {
15352 ++#ifdef HAVE_DIR_CONTEXT
15353 ++ .ctx.actor = filldir,
15354 ++#endif
15355 ++ .oifb_info = info,
15356 ++ .oifb_dev = dev,
15357 ++ .oifb_dentry = dentry };
15358 + struct file *filp = &info->oti_it_ea.oie_file;
15359 + struct inode *inode = dentry->d_inode;
15360 + const struct file_operations *fops = inode->i_fop;
15361 +@@ -1777,7 +1787,13 @@ osd_ios_general_scan(struct osd_thread_info *info, struct osd_device *dev,
15362 + filp->private_data = NULL;
15363 + set_file_inode(filp, inode);
15364 +
15365 ++#ifdef HAVE_DIR_CONTEXT
15366 ++ buf.ctx.pos = filp->f_pos;
15367 ++ rc = fops->iterate(filp, &buf.ctx);
15368 ++ filp->f_pos = buf.ctx.pos;
15369 ++#else
15370 + rc = fops->readdir(filp, &buf, filldir);
15371 ++#endif
15372 + fops->release(inode, filp);
15373 +
15374 + RETURN(rc);
15375 +--
15376 +1.8.5.3
15377 +
15378
15379 diff --git a/sys-cluster/lustre/files/0012-LU-3974-llite-use-new-struct-dir_context.patch b/sys-cluster/lustre/files/0012-LU-3974-llite-use-new-struct-dir_context.patch
15380 new file mode 100644
15381 index 0000000..29696dd
15382 --- /dev/null
15383 +++ b/sys-cluster/lustre/files/0012-LU-3974-llite-use-new-struct-dir_context.patch
15384 @@ -0,0 +1,262 @@
15385 +From a93c1a0d6dfaa1a17e0806c5a3f71996af15fb20 Mon Sep 17 00:00:00 2001
15386 +From: James Simmons <uja.ornl@×××××.com>
15387 +Date: Mon, 20 Jan 2014 21:23:00 -0500
15388 +Subject: [PATCH 12/13] LU-3974 llite: use new struct dir_context
15389 +
15390 +The readdir and nfs code over time has added more
15391 +parameters to be passed to be processed. For the 3.11
15392 +kernel a new struct dir_context was introduced to
15393 +minimize the impact of future expansion. This patch
15394 +addresses this change.
15395 +
15396 +Signed-off-by: James Simmons <uja.ornl@×××××.com>
15397 +Change-Id: Ib42bf8cb06635a2a64e63b294d79e66ac82a1a5b
15398 +Signed-off-by: Alexey Shvetsov <alexxy@g.o>
15399 +---
15400 + lustre/autoconf/lustre-core.m4 | 20 +++++++++++++
15401 + lustre/llite/dir.c | 65 ++++++++++++++++++++++++++++++++++--------
15402 + lustre/llite/llite_internal.h | 14 +++++++--
15403 + lustre/llite/llite_nfs.c | 17 +++++++----
15404 + 4 files changed, 96 insertions(+), 20 deletions(-)
15405 +
15406 +diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
15407 +index e6207c9..f44a277 100644
15408 +--- a/lustre/autoconf/lustre-core.m4
15409 ++++ b/lustre/autoconf/lustre-core.m4
15410 +@@ -1349,6 +1349,25 @@ LB_LINUX_TRY_COMPILE([
15411 + ])
15412 +
15413 + #
15414 ++# 3.11 readdir now takes the new struct dir_context
15415 ++#
15416 ++AC_DEFUN([LC_HAVE_DIR_CONTEXT],
15417 ++[AC_MSG_CHECKING([if dir_context exist])
15418 ++LB_LINUX_TRY_COMPILE([
15419 ++ #include <linux/fs.h>
15420 ++],[
15421 ++ struct dir_context ctx;
15422 ++
15423 ++ ctx.pos = 0;
15424 ++],[
15425 ++ AC_DEFINE(HAVE_DIR_CONTEXT, 1, [dir_context exist])
15426 ++ AC_MSG_RESULT([yes])
15427 ++],[
15428 ++ AC_MSG_RESULT([no])
15429 ++])
15430 ++])
15431 ++
15432 ++#
15433 + # 3.11 dentry_operations.d_compare() taken 5 arguments.
15434 + #
15435 + AC_DEFUN([LC_D_COMPARE_5ARGS],
15436 +@@ -1523,6 +1542,7 @@ AC_DEFUN([LC_PROG_LINUX],
15437 + LC_BLKDEV_RELEASE_RETURN_INT
15438 +
15439 + # 3.11
15440 ++ LC_HAVE_DIR_CONTEXT
15441 + LC_D_COMPARE_5ARGS
15442 + LC_HAVE_DCOUNT
15443 +
15444 +diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c
15445 +index dc5d623..5009934 100644
15446 +--- a/lustre/llite/dir.c
15447 ++++ b/lustre/llite/dir.c
15448 +@@ -195,9 +195,27 @@ struct lu_dirent *ll_dir_entry_next(struct inode *dir,
15449 + return entry;
15450 + }
15451 +
15452 ++void ll_dir_entry_end(struct inode *dir, struct md_op_data *op_data,
15453 ++ struct lu_dirent *ent)
15454 ++{
15455 ++ struct lu_dirent *entry;
15456 ++ struct md_callback cb_op;
15457 ++
15458 ++ cb_op.md_blocking_ast = ll_md_blocking_ast;
15459 ++ op_data->op_cli_flags = CLI_READENT_END;
15460 ++ md_read_entry(ll_i2mdexp(dir), op_data, &cb_op, &entry);
15461 ++ return;
15462 ++}
15463 ++
15464 ++#ifdef HAVE_DIR_CONTEXT
15465 ++int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
15466 ++ struct dir_context *ctx)
15467 ++{
15468 ++#else
15469 + int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
15470 + void *cookie, filldir_t filldir)
15471 + {
15472 ++#endif
15473 + struct ll_sb_info *sbi = ll_i2sbi(inode);
15474 + struct ll_dir_chain chain;
15475 + struct lu_dirent *ent;
15476 +@@ -241,12 +259,17 @@ int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
15477 + fid_le_to_cpu(&fid, &ent->lde_fid);
15478 + ino = cl_fid_build_ino(&fid, api32);
15479 + type = ll_dirent_type_get(ent);
15480 ++
15481 ++#ifdef HAVE_DIR_CONTEXT
15482 + /* For 'll_nfs_get_name_filldir()', it will try
15483 + * to access the 'ent' through its 'lde_name',
15484 + * so the parameter 'name' for 'filldir()' must
15485 + * be part of the 'ent'. */
15486 ++ done = !dir_emit(ctx, ent->lde_name, namelen, ino, type);
15487 ++#else
15488 + done = filldir(cookie, ent->lde_name, namelen, lhash,
15489 + ino, type);
15490 ++#endif
15491 + if (done) {
15492 + if (op_data->op_hash_offset != MDS_DIR_END_OFF)
15493 + op_data->op_hash_offset = last_hash;
15494 +@@ -268,7 +291,11 @@ int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
15495 + RETURN(rc);
15496 + }
15497 +
15498 ++#ifdef HAVE_DIR_CONTEXT
15499 ++static int ll_iterate(struct file *filp, struct dir_context *ctx)
15500 ++#else
15501 + static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
15502 ++#endif
15503 + {
15504 + struct inode *inode = filp->f_dentry->d_inode;
15505 + struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp);
15506 +@@ -305,22 +332,32 @@ static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
15507 +
15508 + op_data->op_hash_offset = pos;
15509 + op_data->op_max_pages = sbi->ll_md_brw_size >> PAGE_CACHE_SHIFT;
15510 ++#ifdef HAVE_DIR_CONTEXT
15511 ++ ctx->pos = pos;
15512 ++ rc = ll_dir_read(inode, op_data, ctx);
15513 ++ pos = ctx->pos;
15514 ++#else
15515 + rc = ll_dir_read(inode, op_data, cookie, filldir);
15516 ++#endif
15517 + if (lfd != NULL)
15518 + lfd->lfd_pos = op_data->op_hash_offset;
15519 +
15520 + if (pos == MDS_DIR_END_OFF) {
15521 + if (api32)
15522 +- filp->f_pos = LL_DIR_END_OFF_32BIT;
15523 ++ pos = LL_DIR_END_OFF_32BIT;
15524 + else
15525 +- filp->f_pos = LL_DIR_END_OFF;
15526 ++ pos = LL_DIR_END_OFF;
15527 + } else {
15528 + if (api32 && hash64)
15529 +- filp->f_pos = op_data->op_hash_offset >> 32;
15530 ++ pos = op_data->op_hash_offset >> 32;
15531 + else
15532 +- filp->f_pos = op_data->op_hash_offset;
15533 ++ pos = op_data->op_hash_offset;
15534 + }
15535 +-
15536 ++#ifdef HAVE_DIR_CONTEXT
15537 ++ ctx->pos = pos;
15538 ++#else
15539 ++ filp->f_pos = pos;
15540 ++#endif
15541 + ll_finish_md_op_data(op_data);
15542 + filp->f_version = inode->i_version;
15543 + #ifdef HAVE_TOUCH_ATIME_1ARG
15544 +@@ -1702,11 +1739,15 @@ int ll_dir_release(struct inode *inode, struct file *file)
15545 + }
15546 +
15547 + struct file_operations ll_dir_operations = {
15548 +- .llseek = ll_dir_seek,
15549 +- .open = ll_dir_open,
15550 +- .release = ll_dir_release,
15551 +- .read = generic_read_dir,
15552 +- .readdir = ll_readdir,
15553 +- .unlocked_ioctl = ll_dir_ioctl,
15554 +- .fsync = ll_fsync,
15555 ++ .llseek = ll_dir_seek,
15556 ++ .open = ll_dir_open,
15557 ++ .release = ll_dir_release,
15558 ++ .read = generic_read_dir,
15559 ++#ifdef HAVE_DIR_CONTEXT
15560 ++ .iterate = ll_iterate,
15561 ++#else
15562 ++ .readdir = ll_readdir,
15563 ++#endif
15564 ++ .unlocked_ioctl = ll_dir_ioctl,
15565 ++ .fsync = ll_fsync,
15566 + };
15567 +diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
15568 +index 5c22795..251a218 100644
15569 +--- a/lustre/llite/llite_internal.h
15570 ++++ b/lustre/llite/llite_internal.h
15571 +@@ -91,9 +91,12 @@ extern struct file_operations ll_pgcache_seq_fops;
15572 + #define REMOTE_PERM_HASHSIZE 16
15573 +
15574 + struct ll_getname_data {
15575 +- char *lgd_name; /* points to a buffer with NAME_MAX+1 size */
15576 +- struct lu_fid lgd_fid; /* target fid we are looking for */
15577 +- int lgd_found; /* inode matched? */
15578 ++#ifdef HAVE_DIR_CONTEXT
15579 ++ struct dir_context ctx;
15580 ++#endif
15581 ++ char *lgd_name; /* points to a buffer with NAME_MAX+1 size */
15582 ++ struct lu_fid lgd_fid; /* target fid we are looking for */
15583 ++ int lgd_found; /* inode matched? */
15584 + };
15585 +
15586 + /* llite setxid/access permission for user on remote client */
15587 +@@ -718,8 +721,13 @@ static void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count) {}
15588 + /* llite/dir.c */
15589 + extern struct file_operations ll_dir_operations;
15590 + extern struct inode_operations ll_dir_inode_operations;
15591 ++#ifdef HAVE_DIR_CONTEXT
15592 ++int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
15593 ++ struct dir_context *ctx);
15594 ++#else
15595 + int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
15596 + void *cookie, filldir_t filldir);
15597 ++#endif
15598 + int ll_get_mdt_idx(struct inode *inode);
15599 +
15600 + struct lu_dirent *ll_dir_entry_start(struct inode *dir,
15601 +diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c
15602 +index 68616e9..faad453 100644
15603 +--- a/lustre/llite/llite_nfs.c
15604 ++++ b/lustre/llite/llite_nfs.c
15605 +@@ -236,7 +236,14 @@ static int ll_get_name(struct dentry *dentry, char *name,
15606 + struct dentry *child)
15607 + {
15608 + struct inode *dir = dentry->d_inode;
15609 +- struct ll_getname_data lgd;
15610 ++ struct ll_getname_data lgd = {
15611 ++ .lgd_name = name,
15612 ++ .lgd_fid = ll_i2info(child->d_inode)->lli_fid,
15613 ++#ifdef HAVE_DIR_CONTEXT
15614 ++ .ctx.actor = ll_nfs_get_name_filldir,
15615 ++#endif
15616 ++ .lgd_found = 0,
15617 ++ };
15618 + struct md_op_data *op_data;
15619 + int rc;
15620 + ENTRY;
15621 +@@ -247,10 +254,6 @@ static int ll_get_name(struct dentry *dentry, char *name,
15622 + if (!dir->i_fop)
15623 + GOTO(out, rc = -EINVAL);
15624 +
15625 +- lgd.lgd_name = name;
15626 +- lgd.lgd_fid = ll_i2info(child->d_inode)->lli_fid;
15627 +- lgd.lgd_found = 0;
15628 +-
15629 + op_data = ll_prep_md_op_data(NULL, dir, dir, NULL, 0, 0,
15630 + LUSTRE_OPC_ANY, dir);
15631 + if (IS_ERR(op_data))
15632 +@@ -260,7 +263,11 @@ static int ll_get_name(struct dentry *dentry, char *name,
15633 + op_data->op_max_pages =
15634 + ll_i2sbi(dir)->ll_md_brw_size >> PAGE_CACHE_SHIFT;
15635 + mutex_lock(&dir->i_mutex);
15636 ++#ifdef HAVE_DIR_CONTEXT
15637 ++ rc = ll_dir_read(dir, op_data, &lgd.ctx);
15638 ++#else
15639 + rc = ll_dir_read(dir, op_data, &lgd, ll_nfs_get_name_filldir);
15640 ++#endif
15641 + mutex_unlock(&dir->i_mutex);
15642 + ll_finish_md_op_data(op_data);
15643 + if (!rc && !lgd.lgd_found)
15644 +--
15645 +1.8.5.3
15646 +
15647
15648 diff --git a/sys-cluster/lustre/files/0013-LU-3319-procfs-move-ofd-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0013-LU-3319-procfs-move-ofd-proc-handling-to-seq_files.patch
15649 deleted file mode 100644
15650 index cb8fd79..0000000
15651 --- a/sys-cluster/lustre/files/0013-LU-3319-procfs-move-ofd-proc-handling-to-seq_files.patch
15652 +++ /dev/null
15653 @@ -1,759 +0,0 @@
15654 -From 8fa5fb0ecac2a7b0279e0010bfe74acb107c37d8 Mon Sep 17 00:00:00 2001
15655 -From: James Simmons <uja.ornl@×××××.com>
15656 -Date: Thu, 14 Nov 2013 19:47:36 -0500
15657 -Subject: [PATCH 13/18] LU-3319 procfs: move ofd proc handling to seq_files
15658 -
15659 -With 3.10 linux kernel and above proc handling now only
15660 -uses struct seq_files. This patch migrates the ofd
15661 -layer proc entries over to using seq_files.
15662 -
15663 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
15664 -Change-Id: Id8f77d72fd35755f1b7b1c17fcf27e0731bd5ac1
15665 ----
15666 - lustre/obdclass/lprocfs_status.c | 9 +-
15667 - lustre/ofd/lproc_ofd.c | 352 +++++++++++++++++----------------------
15668 - lustre/ofd/ofd_dev.c | 41 ++---
15669 - lustre/ofd/ofd_internal.h | 7 +-
15670 - 4 files changed, 180 insertions(+), 229 deletions(-)
15671 -
15672 -diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c
15673 -index a33cbf2..bd6741e 100644
15674 ---- a/lustre/obdclass/lprocfs_status.c
15675 -+++ b/lustre/obdclass/lprocfs_status.c
15676 -@@ -387,11 +387,10 @@ EXPORT_SYMBOL(lprocfs_evict_client_seq_write);
15677 - #undef BUFLEN
15678 -
15679 - struct file_operations lprocfs_evict_client_fops = {
15680 -- .owner = THIS_MODULE,
15681 -- .read = lprocfs_fops_read,
15682 -- .write = lprocfs_fops_write,
15683 -- .open = lprocfs_evict_client_open,
15684 -- .release = lprocfs_evict_client_release,
15685 -+ .owner = THIS_MODULE,
15686 -+ .open = lprocfs_evict_client_open,
15687 -+ .release = lprocfs_evict_client_release,
15688 -+ .write = lprocfs_evict_client_seq_write,
15689 - };
15690 - EXPORT_SYMBOL(lprocfs_evict_client_fops);
15691 - #endif
15692 -diff --git a/lustre/ofd/lproc_ofd.c b/lustre/ofd/lproc_ofd.c
15693 -index 4354497..f462d63 100644
15694 ---- a/lustre/ofd/lproc_ofd.c
15695 -+++ b/lustre/ofd/lproc_ofd.c
15696 -@@ -46,80 +46,74 @@
15697 -
15698 - #ifdef LPROCFS
15699 -
15700 --static int lprocfs_ofd_rd_seqs(char *page, char **start, off_t off,
15701 -- int count, int *eof, void *data)
15702 -+static int ofd_seqs_seq_show(struct seq_file *m, void *data)
15703 - {
15704 -- struct obd_device *obd = (struct obd_device *)data;
15705 -+ struct obd_device *obd = m->private;
15706 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
15707 -
15708 -- *eof = 1;
15709 -- return snprintf(page, count, "%u\n", ofd->ofd_seq_count);
15710 -+ return seq_printf(m, "%u\n", ofd->ofd_seq_count);
15711 - }
15712 -+LPROC_SEQ_FOPS_RO(ofd_seqs);
15713 -
15714 --static int lprocfs_ofd_rd_tot_dirty(char *page, char **start, off_t off,
15715 -- int count, int *eof, void *data)
15716 -+static int ofd_tot_dirty_seq_show(struct seq_file *m, void *data)
15717 - {
15718 -- struct obd_device *obd = (struct obd_device *)data;
15719 -+ struct obd_device *obd = m->private;
15720 - struct ofd_device *ofd;
15721 -
15722 - LASSERT(obd != NULL);
15723 - ofd = ofd_dev(obd->obd_lu_dev);
15724 -- *eof = 1;
15725 -- return snprintf(page, count, LPU64"\n", ofd->ofd_tot_dirty);
15726 -+ return seq_printf(m, LPU64"\n", ofd->ofd_tot_dirty);
15727 - }
15728 -+LPROC_SEQ_FOPS_RO(ofd_tot_dirty);
15729 -
15730 --static int lprocfs_ofd_rd_tot_granted(char *page, char **start, off_t off,
15731 -- int count, int *eof, void *data)
15732 -+static int ofd_tot_granted_seq_show(struct seq_file *m, void *data)
15733 - {
15734 -- struct obd_device *obd = (struct obd_device *)data;
15735 -+ struct obd_device *obd = m->private;
15736 - struct ofd_device *ofd;
15737 -
15738 - LASSERT(obd != NULL);
15739 - ofd = ofd_dev(obd->obd_lu_dev);
15740 -- *eof = 1;
15741 -- return snprintf(page, count, LPU64"\n", ofd->ofd_tot_granted);
15742 -+ return seq_printf(m, LPU64"\n", ofd->ofd_tot_granted);
15743 - }
15744 -+LPROC_SEQ_FOPS_RO(ofd_tot_granted);
15745 -
15746 --static int lprocfs_ofd_rd_tot_pending(char *page, char **start, off_t off,
15747 -- int count, int *eof, void *data)
15748 -+static int ofd_tot_pending_seq_show(struct seq_file *m, void *data)
15749 - {
15750 -- struct obd_device *obd = (struct obd_device *)data;
15751 -+ struct obd_device *obd = m->private;
15752 - struct ofd_device *ofd;
15753 -
15754 - LASSERT(obd != NULL);
15755 - ofd = ofd_dev(obd->obd_lu_dev);
15756 -- *eof = 1;
15757 -- return snprintf(page, count, LPU64"\n", ofd->ofd_tot_pending);
15758 -+ return seq_printf(m, LPU64"\n", ofd->ofd_tot_pending);
15759 - }
15760 -+LPROC_SEQ_FOPS_RO(ofd_tot_pending);
15761 -
15762 --static int lprocfs_ofd_rd_grant_precreate(char *page, char **start, off_t off,
15763 -- int count, int *eof, void *data)
15764 -+static int ofd_grant_precreate_seq_show(struct seq_file *m, void *data)
15765 - {
15766 -- struct obd_device *obd = (struct obd_device *)data;
15767 -+ struct obd_device *obd = m->private;
15768 -
15769 - LASSERT(obd != NULL);
15770 -- *eof = 1;
15771 -- return snprintf(page, count, "%ld\n",
15772 -+ return seq_printf(m, "%ld\n",
15773 - obd->obd_self_export->exp_filter_data.fed_grant);
15774 - }
15775 -+LPROC_SEQ_FOPS_RO(ofd_grant_precreate);
15776 -
15777 --static int lprocfs_ofd_rd_grant_ratio(char *page, char **start, off_t off,
15778 -- int count, int *eof, void *data)
15779 -+static int ofd_grant_ratio_seq_show(struct seq_file *m, void *data)
15780 - {
15781 -- struct obd_device *obd = (struct obd_device *)data;
15782 -+ struct obd_device *obd = m->private;
15783 - struct ofd_device *ofd;
15784 -
15785 - LASSERT(obd != NULL);
15786 - ofd = ofd_dev(obd->obd_lu_dev);
15787 -- *eof = 1;
15788 -- return snprintf(page, count, "%d%%\n",
15789 -+ return seq_printf(m, "%d%%\n",
15790 - (int) ofd_grant_reserved(ofd, 100));
15791 - }
15792 -
15793 --static int lprocfs_ofd_wr_grant_ratio(struct file *file, const char *buffer,
15794 -- unsigned long count, void *data)
15795 -+static ssize_t
15796 -+ofd_grant_ratio_seq_write(struct file *file, const char *buffer,
15797 -+ size_t count, loff_t *off)
15798 - {
15799 -- struct obd_device *obd = (struct obd_device *)data;
15800 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
15801 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
15802 - int val;
15803 - int rc;
15804 -@@ -143,23 +137,23 @@ static int lprocfs_ofd_wr_grant_ratio(struct file *file, const char *buffer,
15805 - spin_unlock(&ofd->ofd_grant_lock);
15806 - return count;
15807 - }
15808 -+LPROC_SEQ_FOPS(ofd_grant_ratio);
15809 -
15810 --static int lprocfs_ofd_rd_precreate_batch(char *page, char **start, off_t off,
15811 -- int count, int *eof, void *data)
15812 -+static int ofd_precreate_batch_seq_show(struct seq_file *m, void *data)
15813 - {
15814 -- struct obd_device *obd = (struct obd_device *)data;
15815 -+ struct obd_device *obd = m->private;
15816 - struct ofd_device *ofd;
15817 -
15818 - LASSERT(obd != NULL);
15819 - ofd = ofd_dev(obd->obd_lu_dev);
15820 -- *eof = 1;
15821 -- return snprintf(page, count, "%d\n", ofd->ofd_precreate_batch);
15822 -+ return seq_printf(m, "%d\n", ofd->ofd_precreate_batch);
15823 - }
15824 -
15825 --static int lprocfs_ofd_wr_precreate_batch(struct file *file, const char *buffer,
15826 -- unsigned long count, void *data)
15827 -+static ssize_t
15828 -+ofd_precreate_batch_seq_write(struct file *file, const char *buffer,
15829 -+ size_t count, loff_t *off)
15830 - {
15831 -- struct obd_device *obd = (struct obd_device *)data;
15832 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
15833 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
15834 - int val;
15835 - int rc;
15836 -@@ -176,11 +170,11 @@ static int lprocfs_ofd_wr_precreate_batch(struct file *file, const char *buffer,
15837 - spin_unlock(&ofd->ofd_batch_lock);
15838 - return count;
15839 - }
15840 -+LPROC_SEQ_FOPS(ofd_precreate_batch);
15841 -
15842 --static int lprocfs_ofd_rd_last_id(char *page, char **start, off_t off,
15843 -- int count, int *eof, void *data)
15844 -+static int ofd_last_id_seq_show(struct seq_file *m, void *data)
15845 - {
15846 -- struct obd_device *obd = data;
15847 -+ struct obd_device *obd = m->private;
15848 - struct ofd_device *ofd;
15849 - struct ofd_seq *oseq = NULL;
15850 - int retval = 0, rc;
15851 -@@ -198,35 +192,31 @@ static int lprocfs_ofd_rd_last_id(char *page, char **start, off_t off,
15852 - fid_idif_seq(ostid_id(&oseq->os_oi),
15853 - ofd->ofd_lut.lut_lsd.lsd_osd_index) :
15854 - ostid_seq(&oseq->os_oi);
15855 -- rc = snprintf(page, count, DOSTID"\n", seq,
15856 -- ostid_id(&oseq->os_oi));
15857 -+ rc = seq_printf(m, DOSTID"\n", seq, ostid_id(&oseq->os_oi));
15858 - if (rc < 0) {
15859 - retval = rc;
15860 - break;
15861 - }
15862 -- page += rc;
15863 -- count -= rc;
15864 - retval += rc;
15865 - }
15866 - read_unlock(&ofd->ofd_seq_list_lock);
15867 - return retval;
15868 - }
15869 -+LPROC_SEQ_FOPS_RO(ofd_last_id);
15870 -
15871 --int lprocfs_ofd_rd_fmd_max_num(char *page, char **start, off_t off,
15872 -- int count, int *eof, void *data)
15873 -+int ofd_fmd_max_num_seq_show(struct seq_file *m, void *data)
15874 - {
15875 -- struct obd_device *obd = data;
15876 -+ struct obd_device *obd = m->private;
15877 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
15878 -- int rc;
15879 -
15880 -- rc = snprintf(page, count, "%u\n", ofd->ofd_fmd_max_num);
15881 -- return rc;
15882 -+ return seq_printf(m, "%u\n", ofd->ofd_fmd_max_num);
15883 - }
15884 -
15885 --int lprocfs_ofd_wr_fmd_max_num(struct file *file, const char *buffer,
15886 -- unsigned long count, void *data)
15887 -+ssize_t
15888 -+ofd_fmd_max_num_seq_write(struct file *file, const char *buffer,
15889 -+ size_t count, loff_t *off)
15890 - {
15891 -- struct obd_device *obd = data;
15892 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
15893 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
15894 - int val;
15895 - int rc;
15896 -@@ -241,22 +231,21 @@ int lprocfs_ofd_wr_fmd_max_num(struct file *file, const char *buffer,
15897 - ofd->ofd_fmd_max_num = val;
15898 - return count;
15899 - }
15900 -+LPROC_SEQ_FOPS(ofd_fmd_max_num);
15901 -
15902 --int lprocfs_ofd_rd_fmd_max_age(char *page, char **start, off_t off,
15903 -- int count, int *eof, void *data)
15904 -+int ofd_fmd_max_age_seq_show(struct seq_file *m, void *data)
15905 - {
15906 -- struct obd_device *obd = data;
15907 -+ struct obd_device *obd = m->private;
15908 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
15909 -- int rc;
15910 -
15911 -- rc = snprintf(page, count, "%ld\n", ofd->ofd_fmd_max_age / HZ);
15912 -- return rc;
15913 -+ return seq_printf(m, "%ld\n", ofd->ofd_fmd_max_age / HZ);
15914 - }
15915 -
15916 --int lprocfs_ofd_wr_fmd_max_age(struct file *file, const char *buffer,
15917 -- unsigned long count, void *data)
15918 -+ssize_t
15919 -+ofd_fmd_max_age_seq_write(struct file *file, const char *buffer,
15920 -+ size_t count, loff_t *off)
15921 - {
15922 -- struct obd_device *obd = data;
15923 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
15924 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
15925 - int val;
15926 - int rc;
15927 -@@ -271,22 +260,21 @@ int lprocfs_ofd_wr_fmd_max_age(struct file *file, const char *buffer,
15928 - ofd->ofd_fmd_max_age = val * HZ;
15929 - return count;
15930 - }
15931 -+LPROC_SEQ_FOPS(ofd_fmd_max_age);
15932 -
15933 --static int lprocfs_ofd_rd_capa(char *page, char **start, off_t off,
15934 -- int count, int *eof, void *data)
15935 -+static int ofd_capa_seq_show(struct seq_file *m, void *data)
15936 - {
15937 -- struct obd_device *obd = data;
15938 -- int rc;
15939 -+ struct obd_device *obd = m->private;
15940 -
15941 -- rc = snprintf(page, count, "capability on: %s\n",
15942 -- obd->u.filter.fo_fl_oss_capa ? "oss" : "");
15943 -- return rc;
15944 -+ return seq_printf(m, "capability on: %s\n",
15945 -+ obd->u.filter.fo_fl_oss_capa ? "oss" : "");
15946 - }
15947 -
15948 --static int lprocfs_ofd_wr_capa(struct file *file, const char *buffer,
15949 -- unsigned long count, void *data)
15950 -+static ssize_t
15951 -+ofd_capa_seq_write(struct file *file, const char *buffer, size_t count,
15952 -+ loff_t *off)
15953 - {
15954 -- struct obd_device *obd = data;
15955 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
15956 - int val, rc;
15957 -
15958 - rc = lprocfs_write_helper(buffer, count, &val);
15959 -@@ -305,28 +293,29 @@ static int lprocfs_ofd_wr_capa(struct file *file, const char *buffer,
15960 - val ? "enabled" : "disabled");
15961 - return count;
15962 - }
15963 -+LPROC_SEQ_FOPS(ofd_capa);
15964 -
15965 --static int lprocfs_ofd_rd_capa_count(char *page, char **start, off_t off,
15966 -- int count, int *eof, void *data)
15967 -+static int ofd_capa_count_seq_show(struct seq_file *m, void *data)
15968 - {
15969 -- return snprintf(page, count, "%d %d\n",
15970 -+ return seq_printf(m, "%d %d\n",
15971 - capa_count[CAPA_SITE_CLIENT],
15972 - capa_count[CAPA_SITE_SERVER]);
15973 - }
15974 -+LPROC_SEQ_FOPS_RO(ofd_capa_count);
15975 -
15976 --int lprocfs_ofd_rd_degraded(char *page, char **start, off_t off,
15977 -- int count, int *eof, void *data)
15978 -+int ofd_degraded_seq_show(struct seq_file *m, void *data)
15979 - {
15980 -- struct obd_device *obd = data;
15981 -+ struct obd_device *obd = m->private;
15982 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
15983 -
15984 -- return snprintf(page, count, "%u\n", ofd->ofd_raid_degraded);
15985 -+ return seq_printf(m, "%u\n", ofd->ofd_raid_degraded);
15986 - }
15987 -
15988 --int lprocfs_ofd_wr_degraded(struct file *file, const char *buffer,
15989 -- unsigned long count, void *data)
15990 -+ssize_t
15991 -+ofd_degraded_seq_write(struct file *file, const char *buffer,
15992 -+ size_t count, loff_t *off)
15993 - {
15994 -- struct obd_device *obd = data;
15995 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
15996 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
15997 - int val, rc;
15998 -
15999 -@@ -337,38 +326,35 @@ int lprocfs_ofd_wr_degraded(struct file *file, const char *buffer,
16000 - spin_lock(&ofd->ofd_flags_lock);
16001 - ofd->ofd_raid_degraded = !!val;
16002 - spin_unlock(&ofd->ofd_flags_lock);
16003 --
16004 - return count;
16005 - }
16006 -+LPROC_SEQ_FOPS(ofd_degraded);
16007 -
16008 --int lprocfs_ofd_rd_fstype(char *page, char **start, off_t off, int count,
16009 -- int *eof, void *data)
16010 -+int ofd_fstype_seq_show(struct seq_file *m, void *data)
16011 - {
16012 -- struct obd_device *obd = data;
16013 -+ struct obd_device *obd = m->private;
16014 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
16015 - struct lu_device *d;
16016 -
16017 - LASSERT(ofd->ofd_osd);
16018 - d = &ofd->ofd_osd->dd_lu_dev;
16019 - LASSERT(d->ld_type);
16020 -- return snprintf(page, count, "%s\n", d->ld_type->ldt_name);
16021 -+ return seq_printf(m, "%s\n", d->ld_type->ldt_name);
16022 - }
16023 -+LPROC_SEQ_FOPS_RO(ofd_fstype);
16024 -
16025 --int lprocfs_ofd_rd_syncjournal(char *page, char **start, off_t off,
16026 -- int count, int *eof, void *data)
16027 -+int ofd_syncjournal_seq_show(struct seq_file *m, void *data)
16028 - {
16029 -- struct obd_device *obd = data;
16030 -+ struct obd_device *obd = m->private;
16031 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
16032 -- int rc;
16033 -
16034 -- rc = snprintf(page, count, "%u\n", ofd->ofd_syncjournal);
16035 -- return rc;
16036 -+ return seq_printf(m, "%u\n", ofd->ofd_syncjournal);
16037 - }
16038 -
16039 --int lprocfs_ofd_wr_syncjournal(struct file *file, const char *buffer,
16040 -- unsigned long count, void *data)
16041 -+ssize_t ofd_syncjournal_seq_write(struct file *file, const char *buffer,
16042 -+ size_t count, loff_t *off)
16043 - {
16044 -- struct obd_device *obd = data;
16045 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
16046 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
16047 - int val;
16048 - int rc;
16049 -@@ -387,27 +373,26 @@ int lprocfs_ofd_wr_syncjournal(struct file *file, const char *buffer,
16050 -
16051 - return count;
16052 - }
16053 -+LPROC_SEQ_FOPS(ofd_syncjournal);
16054 -
16055 - static char *sync_on_cancel_states[] = {"never",
16056 - "blocking",
16057 - "always" };
16058 -
16059 --int lprocfs_ofd_rd_sync_lock_cancel(char *page, char **start, off_t off,
16060 -- int count, int *eof, void *data)
16061 -+int ofd_sync_lock_cancel_seq_show(struct seq_file *m, void *data)
16062 - {
16063 -- struct obd_device *obd = data;
16064 -+ struct obd_device *obd = m->private;
16065 - struct lu_target *tgt = obd->u.obt.obt_lut;
16066 -- int rc;
16067 -
16068 -- rc = snprintf(page, count, "%s\n",
16069 -- sync_on_cancel_states[tgt->lut_sync_lock_cancel]);
16070 -- return rc;
16071 -+ return seq_printf(m, "%s\n",
16072 -+ sync_on_cancel_states[tgt->lut_sync_lock_cancel]);
16073 - }
16074 -
16075 --int lprocfs_ofd_wr_sync_lock_cancel(struct file *file, const char *buffer,
16076 -- unsigned long count, void *data)
16077 -+ssize_t
16078 -+ofd_sync_lock_cancel_seq_write(struct file *file, const char *buffer,
16079 -+ size_t count, loff_t *off)
16080 - {
16081 -- struct obd_device *obd = data;
16082 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
16083 - struct lu_target *tgt = obd->u.obt.obt_lut;
16084 - int val = -1;
16085 - int i;
16086 -@@ -435,22 +420,21 @@ int lprocfs_ofd_wr_sync_lock_cancel(struct file *file, const char *buffer,
16087 - spin_unlock(&tgt->lut_flags_lock);
16088 - return count;
16089 - }
16090 -+LPROC_SEQ_FOPS(ofd_sync_lock_cancel);
16091 -
16092 --int lprocfs_ofd_rd_grant_compat_disable(char *page, char **start, off_t off,
16093 -- int count, int *eof, void *data)
16094 -+int ofd_grant_compat_disable_seq_show(struct seq_file *m, void *data)
16095 - {
16096 -- struct obd_device *obd = data;
16097 -+ struct obd_device *obd = m->private;
16098 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
16099 -- int rc;
16100 -
16101 -- rc = snprintf(page, count, "%u\n", ofd->ofd_grant_compat_disable);
16102 -- return rc;
16103 -+ return seq_printf(m, "%u\n", ofd->ofd_grant_compat_disable);
16104 - }
16105 -
16106 --int lprocfs_ofd_wr_grant_compat_disable(struct file *file, const char *buffer,
16107 -- unsigned long count, void *data)
16108 -+ssize_t
16109 -+ofd_grant_compat_disable_seq_write(struct file *file, const char *buffer,
16110 -+ size_t count, loff_t *off)
16111 - {
16112 -- struct obd_device *obd = data;
16113 -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
16114 - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
16115 - int val;
16116 - int rc;
16117 -@@ -469,86 +453,64 @@ int lprocfs_ofd_wr_grant_compat_disable(struct file *file, const char *buffer,
16118 - return count;
16119 - }
16120 -
16121 --int lprocfs_ofd_rd_soft_sync_limit(char *page, char **start, off_t off,
16122 -- int count, int *eof, void *data)
16123 --{
16124 -- struct obd_device *obd = data;
16125 -- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
16126 --
16127 -- return lprocfs_rd_uint(page, start, off, count, eof,
16128 -- &ofd->ofd_soft_sync_limit);
16129 --}
16130 --
16131 --int lprocfs_ofd_wr_soft_sync_limit(struct file *file, const char *buffer,
16132 -- unsigned long count, void *data)
16133 --{
16134 -- struct obd_device *obd = data;
16135 -- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
16136 --
16137 -- return lprocfs_wr_uint(file, buffer, count, &ofd->ofd_soft_sync_limit);
16138 --}
16139 --
16140 --static struct lprocfs_vars lprocfs_ofd_obd_vars[] = {
16141 -- { "uuid", lprocfs_rd_uuid, 0, 0 },
16142 -- { "blocksize", lprocfs_rd_blksize, 0, 0 },
16143 -- { "kbytestotal", lprocfs_rd_kbytestotal, 0, 0 },
16144 -- { "kbytesfree", lprocfs_rd_kbytesfree, 0, 0 },
16145 -- { "kbytesavail", lprocfs_rd_kbytesavail, 0, 0 },
16146 -- { "filestotal", lprocfs_rd_filestotal, 0, 0 },
16147 -- { "filesfree", lprocfs_rd_filesfree, 0, 0 },
16148 -- { "seqs_allocated", lprocfs_ofd_rd_seqs, 0, 0 },
16149 -- { "fstype", lprocfs_ofd_rd_fstype, 0, 0 },
16150 -- { "last_id", lprocfs_ofd_rd_last_id, 0, 0 },
16151 -- { "tot_dirty", lprocfs_ofd_rd_tot_dirty, 0, 0 },
16152 -- { "tot_pending", lprocfs_ofd_rd_tot_pending, 0, 0 },
16153 -- { "tot_granted", lprocfs_ofd_rd_tot_granted, 0, 0 },
16154 -- { "grant_precreate", lprocfs_ofd_rd_grant_precreate, 0, 0 },
16155 -- { "grant_ratio", lprocfs_ofd_rd_grant_ratio,
16156 -- lprocfs_ofd_wr_grant_ratio, 0, 0 },
16157 -- { "precreate_batch", lprocfs_ofd_rd_precreate_batch,
16158 -- lprocfs_ofd_wr_precreate_batch, 0 },
16159 -- { "recovery_status", lprocfs_obd_rd_recovery_status, 0, 0 },
16160 -- { "recovery_time_soft", lprocfs_obd_rd_recovery_time_soft,
16161 -- lprocfs_obd_wr_recovery_time_soft, 0},
16162 -- { "recovery_time_hard", lprocfs_obd_rd_recovery_time_hard,
16163 -- lprocfs_obd_wr_recovery_time_hard, 0},
16164 -- { "evict_client", 0, lprocfs_wr_evict_client, 0,
16165 -- &lprocfs_evict_client_fops},
16166 -- { "num_exports", lprocfs_rd_num_exports, 0, 0 },
16167 -- { "degraded", lprocfs_ofd_rd_degraded,
16168 -- lprocfs_ofd_wr_degraded, 0},
16169 -- { "sync_journal", lprocfs_ofd_rd_syncjournal,
16170 -- lprocfs_ofd_wr_syncjournal, 0 },
16171 -- { "sync_on_lock_cancel", lprocfs_ofd_rd_sync_lock_cancel,
16172 -- lprocfs_ofd_wr_sync_lock_cancel, 0 },
16173 -- { "instance", lprocfs_target_rd_instance, 0 },
16174 -- { "ir_factor", lprocfs_obd_rd_ir_factor,
16175 -- lprocfs_obd_wr_ir_factor, 0},
16176 -- { "grant_compat_disable", lprocfs_ofd_rd_grant_compat_disable,
16177 -- lprocfs_ofd_wr_grant_compat_disable, 0 },
16178 -- { "client_cache_count", lprocfs_ofd_rd_fmd_max_num,
16179 -- lprocfs_ofd_wr_fmd_max_num, 0 },
16180 -- { "client_cache_seconds", lprocfs_ofd_rd_fmd_max_age,
16181 -- lprocfs_ofd_wr_fmd_max_age, 0 },
16182 -- { "capa", lprocfs_ofd_rd_capa,
16183 -- lprocfs_ofd_wr_capa, 0 },
16184 -- { "capa_count", lprocfs_ofd_rd_capa_count, 0, 0 },
16185 -- { "job_cleanup_interval", lprocfs_rd_job_interval,
16186 -- lprocfs_wr_job_interval, 0},
16187 -- { "soft_sync_limit", lprocfs_ofd_rd_soft_sync_limit,
16188 -- lprocfs_ofd_wr_soft_sync_limit, 0},
16189 -- { 0 }
16190 --};
16191 --
16192 --static struct lprocfs_vars lprocfs_ofd_module_vars[] = {
16193 -- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
16194 -+LPROC_SEQ_FOPS(ofd_grant_compat_disable);
16195 -+
16196 -+LPROC_SEQ_FOPS_RO_TYPE(ofd, uuid);
16197 -+LPROC_SEQ_FOPS_RO_TYPE(ofd, blksize);
16198 -+LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytestotal);
16199 -+LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytesfree);
16200 -+LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytesavail);
16201 -+LPROC_SEQ_FOPS_RO_TYPE(ofd, filestotal);
16202 -+LPROC_SEQ_FOPS_RO_TYPE(ofd, filesfree);
16203 -+
16204 -+LPROC_SEQ_FOPS_RO_TYPE(ofd, recovery_status);
16205 -+LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_soft);
16206 -+LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_hard);
16207 -+LPROC_SEQ_FOPS_WO_TYPE(ofd, evict_client);
16208 -+LPROC_SEQ_FOPS_RO_TYPE(ofd, num_exports);
16209 -+LPROC_SEQ_FOPS_RO_TYPE(ofd, target_instance);
16210 -+LPROC_SEQ_FOPS_RW_TYPE(ofd, ir_factor);
16211 -+LPROC_SEQ_FOPS_RW_TYPE(ofd, job_interval);
16212 -+
16213 -+static struct lprocfs_seq_vars lprocfs_ofd_obd_vars[] = {
16214 -+ { "uuid", &ofd_uuid_fops },
16215 -+ { "blocksize", &ofd_blksize_fops },
16216 -+ { "kbytestotal", &ofd_kbytestotal_fops },
16217 -+ { "kbytesfree", &ofd_kbytesfree_fops },
16218 -+ { "kbytesavail", &ofd_kbytesavail_fops },
16219 -+ { "filestotal", &ofd_filestotal_fops },
16220 -+ { "filesfree", &ofd_filesfree_fops },
16221 -+ { "seqs_allocated", &ofd_seqs_fops },
16222 -+ { "fstype", &ofd_fstype_fops },
16223 -+ { "last_id", &ofd_last_id_fops },
16224 -+ { "tot_dirty", &ofd_tot_dirty_fops },
16225 -+ { "tot_pending", &ofd_tot_pending_fops },
16226 -+ { "tot_granted", &ofd_tot_granted_fops },
16227 -+ { "grant_precreate", &ofd_grant_precreate_fops },
16228 -+ { "grant_ratio", &ofd_grant_ratio_fops },
16229 -+ { "precreate_batch", &ofd_precreate_batch_fops },
16230 -+ { "recovery_status", &ofd_recovery_status_fops },
16231 -+ { "recovery_time_soft", &ofd_recovery_time_soft_fops },
16232 -+ { "recovery_time_hard", &ofd_recovery_time_hard_fops },
16233 -+ { "evict_client", &ofd_evict_client_fops },
16234 -+ { "num_exports", &ofd_num_exports_fops },
16235 -+ { "degraded", &ofd_degraded_fops },
16236 -+ { "sync_journal", &ofd_syncjournal_fops },
16237 -+ { "sync_on_lock_cancel", &ofd_sync_lock_cancel_fops },
16238 -+ { "instance", &ofd_target_instance_fops },
16239 -+ { "ir_factor", &ofd_ir_factor_fops },
16240 -+ { "grant_compat_disable", &ofd_grant_compat_disable_fops },
16241 -+ { "client_cache_count", &ofd_fmd_max_num_fops },
16242 -+ { "client_cache_seconds", &ofd_fmd_max_age_fops },
16243 -+ { "capa", &ofd_capa_fops },
16244 -+ { "capa_count", &ofd_capa_count_fops },
16245 -+ { "job_cleanup_interval", &ofd_job_interval_fops },
16246 - { 0 }
16247 - };
16248 -
16249 --void lprocfs_ofd_init_vars(struct lprocfs_static_vars *lvars)
16250 -+void lprocfs_ofd_init_vars(struct obd_device *obd)
16251 - {
16252 -- lvars->module_vars = lprocfs_ofd_module_vars;
16253 -- lvars->obd_vars = lprocfs_ofd_obd_vars;
16254 -+ obd->obd_vars = lprocfs_ofd_obd_vars;
16255 - }
16256 -
16257 - void ofd_stats_counter_init(struct lprocfs_stats *stats)
16258 -diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c
16259 -index 2bdbde6..e3b8358 100644
16260 ---- a/lustre/ofd/ofd_dev.c
16261 -+++ b/lustre/ofd/ofd_dev.c
16262 -@@ -206,8 +206,7 @@ static int ofd_process_config(const struct lu_env *env, struct lu_device *d,
16263 -
16264 - switch (cfg->lcfg_command) {
16265 - case LCFG_PARAM: {
16266 -- struct lprocfs_static_vars lvars;
16267 --
16268 -+ struct obd_device *obd = ofd_obd(m);
16269 - /* For interoperability */
16270 - struct cfg_interop_param *ptr = NULL;
16271 - struct lustre_cfg *old_cfg = NULL;
16272 -@@ -240,8 +239,7 @@ static int ofd_process_config(const struct lu_env *env, struct lu_device *d,
16273 - }
16274 - }
16275 -
16276 -- lprocfs_ofd_init_vars(&lvars);
16277 -- rc = class_process_proc_param(PARAM_OST, lvars.obd_vars, cfg,
16278 -+ rc = class_process_proc_seq_param(PARAM_OST, obd->obd_vars, cfg,
16279 - d->ld_obd);
16280 - if (rc > 0 || rc == -ENOSYS)
16281 - /* we don't understand; pass it on */
16282 -@@ -422,9 +420,10 @@ static struct lu_device_operations ofd_lu_ops = {
16283 - .ldo_prepare = ofd_prepare,
16284 - };
16285 -
16286 -+LPROC_SEQ_FOPS(lprocfs_nid_stats_clear);
16287 -+
16288 - static int ofd_procfs_init(struct ofd_device *ofd)
16289 - {
16290 -- struct lprocfs_static_vars lvars;
16291 - struct obd_device *obd = ofd_obd(ofd);
16292 - cfs_proc_dir_entry_t *entry;
16293 - int rc = 0;
16294 -@@ -433,8 +432,8 @@ static int ofd_procfs_init(struct ofd_device *ofd)
16295 -
16296 - /* lprocfs must be setup before the ofd so state can be safely added
16297 - * to /proc incrementally as the ofd is setup */
16298 -- lprocfs_ofd_init_vars(&lvars);
16299 -- rc = lprocfs_obd_setup(obd, lvars.obd_vars);
16300 -+ lprocfs_ofd_init_vars(obd);
16301 -+ rc = lprocfs_seq_obd_setup(obd);
16302 - if (rc) {
16303 - CERROR("%s: lprocfs_obd_setup failed: %d.\n",
16304 - obd->obd_name, rc);
16305 -@@ -450,7 +449,7 @@ static int ofd_procfs_init(struct ofd_device *ofd)
16306 -
16307 - obd->obd_uses_nid_stats = 1;
16308 -
16309 -- entry = lprocfs_register("exports", obd->obd_proc_entry, NULL, NULL);
16310 -+ entry = lprocfs_seq_register("exports", obd->obd_proc_entry, NULL, NULL);
16311 - if (IS_ERR(entry)) {
16312 - rc = PTR_ERR(entry);
16313 - CERROR("%s: error %d setting up lprocfs for %s\n",
16314 -@@ -460,8 +459,10 @@ static int ofd_procfs_init(struct ofd_device *ofd)
16315 - obd->obd_proc_exports_entry = entry;
16316 -
16317 - entry = lprocfs_add_simple(obd->obd_proc_exports_entry, "clear",
16318 -- lprocfs_nid_stats_clear_read,
16319 -- lprocfs_nid_stats_clear_write, obd, NULL);
16320 -+#ifndef HAVE_ONLY_PROCFS_SEQ
16321 -+ NULL, NULL,
16322 -+#endif
16323 -+ obd, &lprocfs_nid_stats_clear_fops);
16324 - if (IS_ERR(entry)) {
16325 - rc = PTR_ERR(entry);
16326 - CERROR("%s: add proc entry 'clear' failed: %d.\n",
16327 -@@ -477,7 +478,7 @@ static int ofd_procfs_init(struct ofd_device *ofd)
16328 - GOTO(remove_entry_clear, rc);
16329 - RETURN(0);
16330 - remove_entry_clear:
16331 -- lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
16332 -+ lprocfs_remove(&obd->obd_proc_exports_entry);
16333 - obd_cleanup:
16334 - lprocfs_obd_cleanup(obd);
16335 - lprocfs_free_obd_stats(obd);
16336 -@@ -487,7 +488,7 @@ obd_cleanup:
16337 -
16338 - static void ofd_procfs_add_brw_stats_symlink(struct ofd_device *ofd)
16339 - {
16340 -- struct obd_device *obd = ofd_obd(ofd);
16341 -+ /*struct obd_device *obd = ofd_obd(ofd);
16342 - struct obd_device *osd_obd = ofd->ofd_osd_exp->exp_obd;
16343 - cfs_proc_dir_entry_t *osd_root = osd_obd->obd_type->typ_procroot;
16344 - cfs_proc_dir_entry_t *osd_dir;
16345 -@@ -516,20 +517,15 @@ static void ofd_procfs_add_brw_stats_symlink(struct ofd_device *ofd)
16346 - lprocfs_add_symlink("writethrough_cache_enable",
16347 - obd->obd_proc_entry,
16348 - "../../%s/%s/writethrough_cache_enable",
16349 -- osd_root->name, osd_dir->name);
16350 -+ osd_root->name, osd_dir->name);*/
16351 - }
16352 -
16353 - static void ofd_procfs_fini(struct ofd_device *ofd)
16354 - {
16355 - struct obd_device *obd = ofd_obd(ofd);
16356 -
16357 -- lprocfs_remove_proc_entry("writethrough_cache_enable",
16358 -- obd->obd_proc_entry);
16359 -- lprocfs_remove_proc_entry("readcache_max_filesize",
16360 -- obd->obd_proc_entry);
16361 -- lprocfs_remove_proc_entry("read_cache_enable", obd->obd_proc_entry);
16362 -- lprocfs_remove_proc_entry("brw_stats", obd->obd_proc_entry);
16363 -- lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
16364 -+ lprocfs_remove(&obd->obd_proc_exports_entry);
16365 -+ lprocfs_remove(&obd->obd_proc_entry);
16366 - lprocfs_free_per_client_stats(obd);
16367 - lprocfs_obd_cleanup(obd);
16368 - lprocfs_free_obd_stats(obd);
16369 -@@ -1889,7 +1885,6 @@ static struct lu_device_type ofd_device_type = {
16370 -
16371 - int __init ofd_init(void)
16372 - {
16373 -- struct lprocfs_static_vars lvars;
16374 - int rc;
16375 -
16376 - rc = lu_kmem_init(ofd_caches);
16377 -@@ -1902,11 +1897,9 @@ int __init ofd_init(void)
16378 - return(rc);
16379 - }
16380 -
16381 -- lprocfs_ofd_init_vars(&lvars);
16382 --
16383 - rc = class_register_type(&ofd_obd_ops, NULL, NULL,
16384 - #ifndef HAVE_ONLY_PROCFS_SEQ
16385 -- lvars.module_vars,
16386 -+ NULL,
16387 - #endif
16388 - LUSTRE_OST_NAME, &ofd_device_type);
16389 - return rc;
16390 -diff --git a/lustre/ofd/ofd_internal.h b/lustre/ofd/ofd_internal.h
16391 -index 9285a1f..6acae49 100644
16392 ---- a/lustre/ofd/ofd_internal.h
16393 -+++ b/lustre/ofd/ofd_internal.h
16394 -@@ -383,13 +383,10 @@ int ofd_txn_stop_cb(const struct lu_env *env, struct thandle *txn,
16395 -
16396 - /* lproc_ofd.c */
16397 - #ifdef LPROCFS
16398 --void lprocfs_ofd_init_vars(struct lprocfs_static_vars *lvars);
16399 -+void lprocfs_ofd_init_vars(struct obd_device *obd);
16400 - void ofd_stats_counter_init(struct lprocfs_stats *stats);
16401 - #else
16402 --static void lprocfs_ofd_init_vars(struct lprocfs_static_vars *lvars)
16403 --{
16404 -- memset(lvars, 0, sizeof(*lvars));
16405 --}
16406 -+static void lprocfs_ofd_init_vars(struct obd_device *obd) {}
16407 - static inline void ofd_stats_counter_init(struct lprocfs_stats *stats) {}
16408 - #endif
16409 -
16410 ---
16411 -1.8.5.1
16412 -
16413
16414 diff --git a/sys-cluster/lustre/files/0005-LU-3974-llite-invalidatepage-api-changed.patch b/sys-cluster/lustre/files/0013-LU-3974-llite-invalidatepage-api-changed.patch
16415 similarity index 94%
16416 rename from sys-cluster/lustre/files/0005-LU-3974-llite-invalidatepage-api-changed.patch
16417 rename to sys-cluster/lustre/files/0013-LU-3974-llite-invalidatepage-api-changed.patch
16418 index 63efe17..2886b55 100644
16419 --- a/sys-cluster/lustre/files/0005-LU-3974-llite-invalidatepage-api-changed.patch
16420 +++ b/sys-cluster/lustre/files/0013-LU-3974-llite-invalidatepage-api-changed.patch
16421 @@ -1,7 +1,7 @@
16422 -From 2725bc0f3bc5fa7706b9a475ccb0c191f21ca884 Mon Sep 17 00:00:00 2001
16423 +From 48a712836dff9f15b8d17b9e34caa6acfebf22ce Mon Sep 17 00:00:00 2001
16424 From: James Simmons <uja.ornl@×××××.com>
16425 Date: Tue, 24 Sep 2013 12:29:47 -0400
16426 -Subject: [PATCH 05/18] LU-3974 llite: invalidatepage api changed
16427 +Subject: [PATCH 13/13] LU-3974 llite: invalidatepage api changed
16428
16429 Until recently invalidating pages from the buffer cache
16430 was dependent only on the page passed in and the start
16431 @@ -19,10 +19,10 @@ Change-Id: Iedf458b20b2604bc3099d5ae38bf0ad07df83bd3
16432 3 files changed, 48 insertions(+), 15 deletions(-)
16433
16434 diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
16435 -index 3ac55d6..ab94acd 100644
16436 +index f44a277..5409fde 100644
16437 --- a/lustre/autoconf/lustre-core.m4
16438 +++ b/lustre/autoconf/lustre-core.m4
16439 -@@ -1287,6 +1287,25 @@ LB_LINUX_TRY_COMPILE([
16440 +@@ -1349,6 +1349,25 @@ LB_LINUX_TRY_COMPILE([
16441 ])
16442
16443 #
16444 @@ -48,7 +48,7 @@ index 3ac55d6..ab94acd 100644
16445 # 3.11 readdir now takes the new struct dir_context
16446 #
16447 AC_DEFUN([LC_HAVE_DIR_CONTEXT],
16448 -@@ -1442,6 +1461,7 @@ AC_DEFUN([LC_PROG_LINUX],
16449 +@@ -1542,6 +1561,7 @@ AC_DEFUN([LC_PROG_LINUX],
16450 LC_BLKDEV_RELEASE_RETURN_INT
16451
16452 # 3.11
16453 @@ -130,5 +130,5 @@ index 9365c74..bee7996 100644
16454 if (!IS_ERR(env)) {
16455 inode = vmpage->mapping->host;
16456 --
16457 -1.8.5.1
16458 +1.8.5.3
16459
16460
16461 diff --git a/sys-cluster/lustre/files/0017-LU-3319-procfs-move-mdd-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0017-LU-3319-procfs-move-mdd-proc-handling-to-seq_files.patch
16462 deleted file mode 100644
16463 index aff2b85..0000000
16464 --- a/sys-cluster/lustre/files/0017-LU-3319-procfs-move-mdd-proc-handling-to-seq_files.patch
16465 +++ /dev/null
16466 @@ -1,788 +0,0 @@
16467 -From d32db1df1792f96fa9aa88ca949b403946a92eef Mon Sep 17 00:00:00 2001
16468 -From: James Simmons <uja.ornl@×××××.com>
16469 -Date: Mon, 2 Dec 2013 12:40:35 -0500
16470 -Subject: [PATCH 17/18] LU-3319 procfs: move mdd proc handling to seq_files
16471 -
16472 -With 3.10 linux kernel and above proc handling now only
16473 -uses struct seq_files. This patch migrates the mdd
16474 -layer proc entries over to using seq_files.
16475 -
16476 -Signed-off-by: James Simmons <uja.ornl@×××××.com>
16477 -Change-Id: I61b7df6bfd5efd0f12e3ca1a1813b7b62d493168
16478 ----
16479 - lustre/include/lustre_lfsck.h | 4 +-
16480 - lustre/lfsck/lfsck_internal.h | 9 +-
16481 - lustre/lfsck/lfsck_lib.c | 68 ++++-------
16482 - lustre/lfsck/lfsck_namespace.c | 61 +++-------
16483 - lustre/mdd/mdd_device.c | 25 ++--
16484 - lustre/mdd/mdd_internal.h | 1 -
16485 - lustre/mdd/mdd_lproc.c | 259 +++++++++++++++++------------------------
16486 - 7 files changed, 162 insertions(+), 265 deletions(-)
16487 -
16488 -diff --git a/lustre/include/lustre_lfsck.h b/lustre/include/lustre_lfsck.h
16489 -index f75d507..e491933 100644
16490 ---- a/lustre/include/lustre_lfsck.h
16491 -+++ b/lustre/include/lustre_lfsck.h
16492 -@@ -52,9 +52,9 @@ int lfsck_start(const struct lu_env *env, struct dt_device *key,
16493 - int lfsck_stop(const struct lu_env *env, struct dt_device *key,
16494 - bool pause);
16495 -
16496 --int lfsck_get_speed(struct dt_device *key, void *buf, int len);
16497 -+int lfsck_get_speed(struct seq_file *m, struct dt_device *key);
16498 - int lfsck_set_speed(struct dt_device *key, int val);
16499 -
16500 --int lfsck_dump(struct dt_device *key, void *buf, int len, __u16 type);
16501 -+int lfsck_dump(struct seq_file *m, struct dt_device *key, __u16 type);
16502 -
16503 - #endif /* _LUSTRE_LFSCK_H */
16504 -diff --git a/lustre/lfsck/lfsck_internal.h b/lustre/lfsck/lfsck_internal.h
16505 -index 56cdff0..50eb341 100644
16506 ---- a/lustre/lfsck/lfsck_internal.h
16507 -+++ b/lustre/lfsck/lfsck_internal.h
16508 -@@ -229,8 +229,7 @@ struct lfsck_operations {
16509 -
16510 - int (*lfsck_dump)(const struct lu_env *env,
16511 - struct lfsck_component *com,
16512 -- char *buf,
16513 -- int len);
16514 -+ struct seq_file *m);
16515 -
16516 - int (*lfsck_double_scan)(const struct lu_env *env,
16517 - struct lfsck_component *com);
16518 -@@ -361,10 +360,10 @@ struct lfsck_thread_info {
16519 - /* lfsck_lib.c */
16520 - void lfsck_component_cleanup(const struct lu_env *env,
16521 - struct lfsck_component *com);
16522 --int lfsck_bits_dump(char **buf, int *len, int bits, const char *names[],
16523 -+int lfsck_bits_dump(struct seq_file *m, int bits, const char *names[],
16524 - const char *prefix);
16525 --int lfsck_time_dump(char **buf, int *len, __u64 time, const char *prefix);
16526 --int lfsck_pos_dump(char **buf, int *len, struct lfsck_position *pos,
16527 -+int lfsck_time_dump(struct seq_file *m, __u64 time, const char *prefix);
16528 -+int lfsck_pos_dump(struct seq_file *m, struct lfsck_position *pos,
16529 - const char *prefix);
16530 - void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck,
16531 - struct lfsck_position *pos, bool init);
16532 -diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c
16533 -index 0da2614..da68358 100644
16534 ---- a/lustre/lfsck/lfsck_lib.c
16535 -+++ b/lustre/lfsck/lfsck_lib.c
16536 -@@ -258,75 +258,49 @@ static inline int lfsck_instance_add(struct lfsck_instance *lfsck)
16537 - return 0;
16538 - }
16539 -
16540 --int lfsck_bits_dump(char **buf, int *len, int bits, const char *names[],
16541 -+int lfsck_bits_dump(struct seq_file *m, int bits, const char *names[],
16542 - const char *prefix)
16543 - {
16544 -- int save = *len;
16545 - int flag;
16546 -- int rc;
16547 - int i;
16548 -
16549 -- rc = snprintf(*buf, *len, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
16550 -- if (rc <= 0)
16551 -- return -ENOSPC;
16552 -+ seq_printf(m, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
16553 -
16554 -- *buf += rc;
16555 -- *len -= rc;
16556 - for (i = 0, flag = 1; bits != 0; i++, flag = 1 << i) {
16557 - if (flag & bits) {
16558 - bits &= ~flag;
16559 -- rc = snprintf(*buf, *len, "%s%c", names[i],
16560 -+ seq_printf(m, "%s%c", names[i],
16561 - bits != 0 ? ',' : '\n');
16562 -- if (rc <= 0)
16563 -- return -ENOSPC;
16564 --
16565 -- *buf += rc;
16566 -- *len -= rc;
16567 - }
16568 - }
16569 -- return save - *len;
16570 -+ return 0;
16571 - }
16572 -
16573 --int lfsck_time_dump(char **buf, int *len, __u64 time, const char *prefix)
16574 -+int lfsck_time_dump(struct seq_file *m, __u64 time, const char *prefix)
16575 - {
16576 -- int rc;
16577 --
16578 - if (time != 0)
16579 -- rc = snprintf(*buf, *len, "%s: "LPU64" seconds\n", prefix,
16580 -- cfs_time_current_sec() - time);
16581 -+ seq_printf(m, "%s: "LPU64" seconds\n", prefix,
16582 -+ cfs_time_current_sec() - time);
16583 - else
16584 -- rc = snprintf(*buf, *len, "%s: N/A\n", prefix);
16585 -- if (rc <= 0)
16586 -- return -ENOSPC;
16587 --
16588 -- *buf += rc;
16589 -- *len -= rc;
16590 -- return rc;
16591 -+ seq_printf(m, "%s: N/A\n", prefix);
16592 -+ return 0;
16593 - }
16594 -
16595 --int lfsck_pos_dump(char **buf, int *len, struct lfsck_position *pos,
16596 -+int lfsck_pos_dump(struct seq_file *m, struct lfsck_position *pos,
16597 - const char *prefix)
16598 - {
16599 -- int rc;
16600 --
16601 - if (fid_is_zero(&pos->lp_dir_parent)) {
16602 - if (pos->lp_oit_cookie == 0)
16603 -- rc = snprintf(*buf, *len, "%s: N/A, N/A, N/A\n",
16604 -- prefix);
16605 -+ seq_printf(m, "%s: N/A, N/A, N/A\n", prefix);
16606 - else
16607 -- rc = snprintf(*buf, *len, "%s: "LPU64", N/A, N/A\n",
16608 -- prefix, pos->lp_oit_cookie);
16609 -+ seq_printf(m, "%s: "LPU64", N/A, N/A\n",
16610 -+ prefix, pos->lp_oit_cookie);
16611 - } else {
16612 -- rc = snprintf(*buf, *len, "%s: "LPU64", "DFID", "LPU64"\n",
16613 -- prefix, pos->lp_oit_cookie,
16614 -- PFID(&pos->lp_dir_parent), pos->lp_dir_cookie);
16615 -+ seq_printf(m, "%s: "LPU64", "DFID", "LPU64"\n",
16616 -+ prefix, pos->lp_oit_cookie,
16617 -+ PFID(&pos->lp_dir_parent), pos->lp_dir_cookie);
16618 - }
16619 -- if (rc <= 0)
16620 -- return -ENOSPC;
16621 --
16622 -- *buf += rc;
16623 -- *len -= rc;
16624 -- return rc;
16625 -+ return 0;
16626 - }
16627 -
16628 - void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck,
16629 -@@ -765,7 +739,7 @@ int lfsck_double_scan(const struct lu_env *env, struct lfsck_instance *lfsck)
16630 -
16631 - /* external interfaces */
16632 -
16633 --int lfsck_get_speed(struct dt_device *key, void *buf, int len)
16634 -+int lfsck_get_speed(struct seq_file *m, struct dt_device *key)
16635 - {
16636 - struct lu_env env;
16637 - struct lfsck_instance *lfsck;
16638 -@@ -780,7 +754,7 @@ int lfsck_get_speed(struct dt_device *key, void *buf, int len)
16639 - if (rc != 0)
16640 - GOTO(out, rc);
16641 -
16642 -- rc = snprintf(buf, len, "%u\n", lfsck->li_bookmark_ram.lb_speed_limit);
16643 -+ seq_printf(m, "%u\n", lfsck->li_bookmark_ram.lb_speed_limit);
16644 - lu_env_fini(&env);
16645 -
16646 - GOTO(out, rc);
16647 -@@ -820,7 +794,7 @@ out:
16648 - }
16649 - EXPORT_SYMBOL(lfsck_set_speed);
16650 -
16651 --int lfsck_dump(struct dt_device *key, void *buf, int len, __u16 type)
16652 -+int lfsck_dump(struct seq_file *m, struct dt_device *key, __u16 type)
16653 - {
16654 - struct lu_env env;
16655 - struct lfsck_instance *lfsck;
16656 -@@ -840,7 +814,7 @@ int lfsck_dump(struct dt_device *key, void *buf, int len, __u16 type)
16657 - if (rc != 0)
16658 - GOTO(out, rc);
16659 -
16660 -- rc = com->lc_ops->lfsck_dump(&env, com, buf, len);
16661 -+ rc = com->lc_ops->lfsck_dump(&env, com, m);
16662 - lu_env_fini(&env);
16663 -
16664 - GOTO(out, rc);
16665 -diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c
16666 -index 3cc043d..225351f 100644
16667 ---- a/lustre/lfsck/lfsck_namespace.c
16668 -+++ b/lustre/lfsck/lfsck_namespace.c
16669 -@@ -1092,66 +1092,57 @@ static int lfsck_namespace_post(const struct lu_env *env,
16670 -
16671 - static int
16672 - lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
16673 -- char *buf, int len)
16674 -+ struct seq_file *m)
16675 - {
16676 - struct lfsck_instance *lfsck = com->lc_lfsck;
16677 - struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram;
16678 - struct lfsck_namespace *ns =
16679 - (struct lfsck_namespace *)com->lc_file_ram;
16680 -- int save = len;
16681 -- int ret = -ENOSPC;
16682 - int rc;
16683 -
16684 - down_read(&com->lc_sem);
16685 -- rc = snprintf(buf, len,
16686 -- "name: lfsck_namespace\n"
16687 -+ seq_printf(m, "name: lfsck_namespace\n"
16688 - "magic: 0x%x\n"
16689 - "version: %d\n"
16690 - "status: %s\n",
16691 - ns->ln_magic,
16692 - bk->lb_version,
16693 - lfsck_status_names[ns->ln_status]);
16694 -- if (rc <= 0)
16695 -- goto out;
16696 -
16697 -- buf += rc;
16698 -- len -= rc;
16699 -- rc = lfsck_bits_dump(&buf, &len, ns->ln_flags, lfsck_flags_names,
16700 -- "flags");
16701 -+ rc = lfsck_bits_dump(m, ns->ln_flags, lfsck_flags_names, "flags");
16702 - if (rc < 0)
16703 - goto out;
16704 -
16705 -- rc = lfsck_bits_dump(&buf, &len, bk->lb_param, lfsck_param_names,
16706 -- "param");
16707 -+ rc = lfsck_bits_dump(m, bk->lb_param, lfsck_param_names, "param");
16708 - if (rc < 0)
16709 - goto out;
16710 -
16711 -- rc = lfsck_time_dump(&buf, &len, ns->ln_time_last_complete,
16712 -+ rc = lfsck_time_dump(m, ns->ln_time_last_complete,
16713 - "time_since_last_completed");
16714 - if (rc < 0)
16715 - goto out;
16716 -
16717 -- rc = lfsck_time_dump(&buf, &len, ns->ln_time_latest_start,
16718 -+ rc = lfsck_time_dump(m, ns->ln_time_latest_start,
16719 - "time_since_latest_start");
16720 - if (rc < 0)
16721 - goto out;
16722 -
16723 -- rc = lfsck_time_dump(&buf, &len, ns->ln_time_last_checkpoint,
16724 -+ rc = lfsck_time_dump(m, ns->ln_time_last_checkpoint,
16725 - "time_since_last_checkpoint");
16726 - if (rc < 0)
16727 - goto out;
16728 -
16729 -- rc = lfsck_pos_dump(&buf, &len, &ns->ln_pos_latest_start,
16730 -+ rc = lfsck_pos_dump(m, &ns->ln_pos_latest_start,
16731 - "latest_start_position");
16732 - if (rc < 0)
16733 - goto out;
16734 -
16735 -- rc = lfsck_pos_dump(&buf, &len, &ns->ln_pos_last_checkpoint,
16736 -+ rc = lfsck_pos_dump(m, &ns->ln_pos_last_checkpoint,
16737 - "last_checkpoint_position");
16738 - if (rc < 0)
16739 - goto out;
16740 -
16741 -- rc = lfsck_pos_dump(&buf, &len, &ns->ln_pos_first_inconsistent,
16742 -+ rc = lfsck_pos_dump(m, &ns->ln_pos_first_inconsistent,
16743 - "first_failure_position");
16744 - if (rc < 0)
16745 - goto out;
16746 -@@ -1171,8 +1162,7 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
16747 - do_div(new_checked, duration);
16748 - if (rtime != 0)
16749 - do_div(speed, rtime);
16750 -- rc = snprintf(buf, len,
16751 -- "checked_phase1: "LPU64"\n"
16752 -+ seq_printf(m, "checked_phase1: "LPU64"\n"
16753 - "checked_phase2: "LPU64"\n"
16754 - "updated_phase1: "LPU64"\n"
16755 - "updated_phase2: "LPU64"\n"
16756 -@@ -1204,11 +1194,6 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
16757 - ns->ln_run_time_phase2,
16758 - speed,
16759 - new_checked);
16760 -- if (rc <= 0)
16761 -- goto out;
16762 --
16763 -- buf += rc;
16764 -- len -= rc;
16765 -
16766 - LASSERT(lfsck->li_di_oit != NULL);
16767 -
16768 -@@ -1237,9 +1222,7 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
16769 - pos.lp_dir_cookie = 0;
16770 - }
16771 - spin_unlock(&lfsck->li_lock);
16772 -- rc = lfsck_pos_dump(&buf, &len, &pos, "current_position");
16773 -- if (rc <= 0)
16774 -- goto out;
16775 -+ lfsck_pos_dump(m, &pos, "current_position");
16776 - } else if (ns->ln_status == LS_SCANNING_PHASE2) {
16777 - cfs_duration_t duration = cfs_time_current() -
16778 - lfsck->li_time_last_checkpoint;
16779 -@@ -1257,8 +1240,7 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
16780 - do_div(speed1, ns->ln_run_time_phase1);
16781 - if (rtime != 0)
16782 - do_div(speed2, rtime);
16783 -- rc = snprintf(buf, len,
16784 -- "checked_phase1: "LPU64"\n"
16785 -+ seq_printf(m, "checked_phase1: "LPU64"\n"
16786 - "checked_phase2: "LPU64"\n"
16787 - "updated_phase1: "LPU64"\n"
16788 - "updated_phase2: "LPU64"\n"
16789 -@@ -1293,11 +1275,6 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
16790 - speed2,
16791 - new_checked,
16792 - PFID(&ns->ln_fid_latest_scanned_phase2));
16793 -- if (rc <= 0)
16794 -- goto out;
16795 --
16796 -- buf += rc;
16797 -- len -= rc;
16798 - } else {
16799 - __u64 speed1 = ns->ln_items_checked;
16800 - __u64 speed2 = ns->ln_objs_checked_phase2;
16801 -@@ -1306,8 +1283,7 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
16802 - do_div(speed1, ns->ln_run_time_phase1);
16803 - if (ns->ln_run_time_phase2 != 0)
16804 - do_div(speed2, ns->ln_run_time_phase2);
16805 -- rc = snprintf(buf, len,
16806 -- "checked_phase1: "LPU64"\n"
16807 -+ seq_printf(m, "checked_phase1: "LPU64"\n"
16808 - "checked_phase2: "LPU64"\n"
16809 - "updated_phase1: "LPU64"\n"
16810 - "updated_phase2: "LPU64"\n"
16811 -@@ -1340,17 +1316,10 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
16812 - ns->ln_run_time_phase2,
16813 - speed1,
16814 - speed2);
16815 -- if (rc <= 0)
16816 -- goto out;
16817 --
16818 -- buf += rc;
16819 -- len -= rc;
16820 - }
16821 -- ret = save - len;
16822 --
16823 - out:
16824 - up_read(&com->lc_sem);
16825 -- return ret;
16826 -+ return 0;
16827 - }
16828 -
16829 - static int lfsck_namespace_double_scan(const struct lu_env *env,
16830 -diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c
16831 -index 750281a..ee82f71 100644
16832 ---- a/lustre/mdd/mdd_device.c
16833 -+++ b/lustre/mdd/mdd_device.c
16834 -@@ -812,16 +812,16 @@ static int mdd_process_config(const struct lu_env *env,
16835 - ENTRY;
16836 -
16837 - switch (cfg->lcfg_command) {
16838 -- case LCFG_PARAM: {
16839 -- struct lprocfs_static_vars lvars;
16840 --
16841 -- lprocfs_mdd_init_vars(&lvars);
16842 -- rc = class_process_proc_param(PARAM_MDD, lvars.obd_vars, cfg,m);
16843 -- if (rc > 0 || rc == -ENOSYS)
16844 -- /* we don't understand; pass it on */
16845 -- rc = next->ld_ops->ldo_process_config(env, next, cfg);
16846 -- break;
16847 -- }
16848 -+ case LCFG_PARAM: {
16849 -+ struct obd_device *obd = mdd2obd_dev(m);
16850 -+
16851 -+ rc = class_process_proc_seq_param(PARAM_MDD, obd->obd_vars,
16852 -+ cfg, m);
16853 -+ if (rc > 0 || rc == -ENOSYS)
16854 -+ /* we don't understand; pass it on */
16855 -+ rc = next->ld_ops->ldo_process_config(env, next, cfg);
16856 -+ break;
16857 -+ }
16858 - case LCFG_SETUP:
16859 - rc = next->ld_ops->ldo_process_config(env, next, cfg);
16860 - if (rc)
16861 -@@ -1492,11 +1492,8 @@ LU_CONTEXT_KEY_DEFINE(mdd, LCT_MD_THREAD);
16862 -
16863 - static int __init mdd_mod_init(void)
16864 - {
16865 -- struct lprocfs_static_vars lvars;
16866 - int rc;
16867 -
16868 -- lprocfs_mdd_init_vars(&lvars);
16869 --
16870 - rc = lu_kmem_init(mdd_caches);
16871 - if (rc)
16872 - return rc;
16873 -@@ -1512,7 +1509,7 @@ static int __init mdd_mod_init(void)
16874 -
16875 - rc = class_register_type(&mdd_obd_device_ops, NULL, NULL,
16876 - #ifndef HAVE_ONLY_PROCFS_SEQ
16877 -- lvars.module_vars,
16878 -+ NULL,
16879 - #endif
16880 - LUSTRE_MDD_NAME, &mdd_device_type);
16881 - if (rc)
16882 -diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h
16883 -index daa1dcb..5332b2c 100644
16884 ---- a/lustre/mdd/mdd_internal.h
16885 -+++ b/lustre/mdd/mdd_internal.h
16886 -@@ -340,7 +340,6 @@ int orph_declare_index_delete(const struct lu_env *, struct mdd_object *,
16887 - struct thandle *);
16888 -
16889 - /* mdd_lproc.c */
16890 --void lprocfs_mdd_init_vars(struct lprocfs_static_vars *lvars);
16891 - int mdd_procfs_init(struct mdd_device *mdd, const char *name);
16892 - int mdd_procfs_fini(struct mdd_device *mdd);
16893 -
16894 -diff --git a/lustre/mdd/mdd_lproc.c b/lustre/mdd/mdd_lproc.c
16895 -index bd23302..6ddacf7 100644
16896 ---- a/lustre/mdd/mdd_lproc.c
16897 -+++ b/lustre/mdd/mdd_lproc.c
16898 -@@ -49,56 +49,13 @@
16899 - #include <libcfs/libcfs_string.h>
16900 - #include "mdd_internal.h"
16901 -
16902 --int mdd_procfs_init(struct mdd_device *mdd, const char *name)
16903 -+static ssize_t
16904 -+mdd_atime_diff_seq_write(struct file *file, const char *buffer,
16905 -+ size_t count, loff_t *off)
16906 - {
16907 -- struct lprocfs_static_vars lvars;
16908 -- struct obd_type *type;
16909 -- int rc;
16910 -- ENTRY;
16911 --
16912 -- /* at the moment there is no linkage between lu_type
16913 -- * and obd_type, so we lookup obd_type this way */
16914 -- type = class_search_type(LUSTRE_MDD_NAME);
16915 --
16916 -- LASSERT(name != NULL);
16917 -- LASSERT(type != NULL);
16918 --
16919 -- /* Find the type procroot and add the proc entry for this device */
16920 -- lprocfs_mdd_init_vars(&lvars);
16921 -- mdd->mdd_proc_entry = lprocfs_register(name, type->typ_procroot,
16922 -- lvars.obd_vars, mdd);
16923 -- if (IS_ERR(mdd->mdd_proc_entry)) {
16924 -- rc = PTR_ERR(mdd->mdd_proc_entry);
16925 -- CERROR("Error %d setting up lprocfs for %s\n",
16926 -- rc, name);
16927 -- mdd->mdd_proc_entry = NULL;
16928 -- GOTO(out, rc);
16929 -- }
16930 --
16931 -- rc = 0;
16932 --
16933 -- EXIT;
16934 --out:
16935 -- if (rc)
16936 -- mdd_procfs_fini(mdd);
16937 -- return rc;
16938 --}
16939 --
16940 --int mdd_procfs_fini(struct mdd_device *mdd)
16941 --{
16942 -- if (mdd->mdd_proc_entry) {
16943 -- lprocfs_remove(&mdd->mdd_proc_entry);
16944 -- mdd->mdd_proc_entry = NULL;
16945 -- }
16946 -- RETURN(0);
16947 --}
16948 --
16949 --static int lprocfs_wr_atime_diff(struct file *file, const char *buffer,
16950 -- unsigned long count, void *data)
16951 --{
16952 -- struct mdd_device *mdd = data;
16953 -- char kernbuf[20], *end;
16954 -- unsigned long diff = 0;
16955 -+ struct mdd_device *mdd = ((struct seq_file *)file->private_data)->private;
16956 -+ char kernbuf[20], *end;
16957 -+ unsigned long diff = 0;
16958 -
16959 - if (count > (sizeof(kernbuf) - 1))
16960 - return -EINVAL;
16961 -@@ -116,37 +73,34 @@ static int lprocfs_wr_atime_diff(struct file *file, const char *buffer,
16962 - return count;
16963 - }
16964 -
16965 --static int lprocfs_rd_atime_diff(char *page, char **start, off_t off,
16966 -- int count, int *eof, void *data)
16967 -+static int mdd_atime_diff_seq_show(struct seq_file *m, void *data)
16968 - {
16969 -- struct mdd_device *mdd = data;
16970 -+ struct mdd_device *mdd = m->private;
16971 -
16972 -- *eof = 1;
16973 -- return snprintf(page, count, "%lu\n", mdd->mdd_atime_diff);
16974 -+ return seq_printf(m, "%lu\n", mdd->mdd_atime_diff);
16975 - }
16976 --
16977 -+LPROC_SEQ_FOPS(mdd_atime_diff);
16978 -
16979 - /**** changelogs ****/
16980 --static int lprocfs_rd_changelog_mask(char *page, char **start, off_t off,
16981 -- int count, int *eof, void *data)
16982 -+static int mdd_changelog_mask_seq_show(struct seq_file *m, void *data)
16983 - {
16984 -- struct mdd_device *mdd = data;
16985 -- int i = 0, rc = 0;
16986 --
16987 -- *eof = 1;
16988 -- while (i < CL_LAST) {
16989 -- if (mdd->mdd_cl.mc_mask & (1 << i))
16990 -- rc += snprintf(page + rc, count - rc, "%s ",
16991 -- changelog_type2str(i));
16992 -- i++;
16993 -- }
16994 -- return rc;
16995 -+ struct mdd_device *mdd = m->private;
16996 -+ int i = 0;
16997 -+
16998 -+ while (i < CL_LAST) {
16999 -+ if (mdd->mdd_cl.mc_mask & (1 << i))
17000 -+ seq_printf(m, "%s ", changelog_type2str(i));
17001 -+ i++;
17002 -+ }
17003 -+ seq_printf(m, "\n");
17004 -+ return 0;
17005 - }
17006 -
17007 --static int lprocfs_wr_changelog_mask(struct file *file, const char *buffer,
17008 -- unsigned long count, void *data)
17009 -+static ssize_t
17010 -+mdd_changelog_mask_seq_write(struct file *file, const char *buffer,
17011 -+ size_t count, loff_t *off)
17012 - {
17013 -- struct mdd_device *mdd = data;
17014 -+ struct mdd_device *mdd = ((struct seq_file *)file->private_data)->private;
17015 - char *kernbuf;
17016 - int rc;
17017 - ENTRY;
17018 -@@ -168,45 +122,32 @@ out:
17019 - OBD_FREE(kernbuf, PAGE_CACHE_SIZE);
17020 - return rc;
17021 - }
17022 --
17023 --struct cucb_data {
17024 -- char *page;
17025 -- int count;
17026 -- int idx;
17027 --};
17028 -+LPROC_SEQ_FOPS(mdd_changelog_mask);
17029 -
17030 - static int lprocfs_changelog_users_cb(const struct lu_env *env,
17031 - struct llog_handle *llh,
17032 - struct llog_rec_hdr *hdr, void *data)
17033 - {
17034 -- struct llog_changelog_user_rec *rec;
17035 -- struct cucb_data *cucb = (struct cucb_data *)data;
17036 --
17037 -- LASSERT(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN);
17038 -+ struct llog_changelog_user_rec *rec;
17039 -+ struct seq_file *m = data;
17040 -
17041 -- rec = (struct llog_changelog_user_rec *)hdr;
17042 -+ LASSERT(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN);
17043 -
17044 -- cucb->idx += snprintf(cucb->page + cucb->idx, cucb->count - cucb->idx,
17045 -- CHANGELOG_USER_PREFIX"%-3d "LPU64"\n",
17046 -- rec->cur_id, rec->cur_endrec);
17047 -- if (cucb->idx >= cucb->count)
17048 -- return -ENOSPC;
17049 -+ rec = (struct llog_changelog_user_rec *)hdr;
17050 -
17051 -- return 0;
17052 -+ seq_printf(m, CHANGELOG_USER_PREFIX"%-3d "LPU64"\n",
17053 -+ rec->cur_id, rec->cur_endrec);
17054 -+ return 0;
17055 - }
17056 -
17057 --static int lprocfs_rd_changelog_users(char *page, char **start, off_t off,
17058 -- int count, int *eof, void *data)
17059 -+static int mdd_changelog_users_seq_show(struct seq_file *m, void *data)
17060 - {
17061 - struct lu_env env;
17062 -- struct mdd_device *mdd = data;
17063 -+ struct mdd_device *mdd = m->private;
17064 - struct llog_ctxt *ctxt;
17065 -- struct cucb_data cucb;
17066 - __u64 cur;
17067 - int rc;
17068 -
17069 -- *eof = 1;
17070 --
17071 - ctxt = llog_get_context(mdd2obd_dev(mdd),
17072 - LLOG_CHANGELOG_USER_ORIG_CTXT);
17073 - if (ctxt == NULL)
17074 -@@ -223,37 +164,31 @@ static int lprocfs_rd_changelog_users(char *page, char **start, off_t off,
17075 - cur = mdd->mdd_cl.mc_index;
17076 - spin_unlock(&mdd->mdd_cl.mc_lock);
17077 -
17078 -- cucb.count = count;
17079 -- cucb.page = page;
17080 -- cucb.idx = 0;
17081 --
17082 -- cucb.idx += snprintf(cucb.page + cucb.idx, cucb.count - cucb.idx,
17083 -- "current index: "LPU64"\n", cur);
17084 --
17085 -- cucb.idx += snprintf(cucb.page + cucb.idx, cucb.count - cucb.idx,
17086 -- "%-5s %s\n", "ID", "index");
17087 -+ seq_printf(m, "current index: "LPU64"\n", cur);
17088 -+ seq_printf(m, "%-5s %s\n", "ID", "index");
17089 -
17090 - llog_cat_process(&env, ctxt->loc_handle, lprocfs_changelog_users_cb,
17091 -- &cucb, 0, 0);
17092 -+ &m, 0, 0);
17093 -
17094 - lu_env_fini(&env);
17095 - llog_ctxt_put(ctxt);
17096 -- return cucb.idx;
17097 -+ return 0;
17098 - }
17099 -+LPROC_SEQ_FOPS_RO(mdd_changelog_users);
17100 -
17101 --static int lprocfs_rd_sync_perm(char *page, char **start, off_t off,
17102 -- int count, int *eof, void *data)
17103 -+static int mdd_sync_perm_seq_show(struct seq_file *m, void *data)
17104 - {
17105 -- struct mdd_device *mdd = data;
17106 -+ struct mdd_device *mdd = m->private;
17107 -
17108 -- LASSERT(mdd != NULL);
17109 -- return snprintf(page, count, "%d\n", mdd->mdd_sync_permission);
17110 -+ LASSERT(mdd != NULL);
17111 -+ return seq_printf(m, "%d\n", mdd->mdd_sync_permission);
17112 - }
17113 -
17114 --static int lprocfs_wr_sync_perm(struct file *file, const char *buffer,
17115 -- unsigned long count, void *data)
17116 -+static ssize_t
17117 -+mdd_sync_perm_seq_write(struct file *file, const char *buffer,
17118 -+ size_t count, loff_t *off)
17119 - {
17120 -- struct mdd_device *mdd = data;
17121 -+ struct mdd_device *mdd = ((struct seq_file *)file->private_data)->private;
17122 - int val, rc;
17123 -
17124 - LASSERT(mdd != NULL);
17125 -@@ -264,24 +199,21 @@ static int lprocfs_wr_sync_perm(struct file *file, const char *buffer,
17126 - mdd->mdd_sync_permission = !!val;
17127 - return count;
17128 - }
17129 -+LPROC_SEQ_FOPS(mdd_sync_perm);
17130 -
17131 --static int lprocfs_rd_lfsck_speed_limit(char *page, char **start, off_t off,
17132 -- int count, int *eof, void *data)
17133 -+static int mdd_lfsck_speed_limit_seq_show(struct seq_file *m, void *data)
17134 - {
17135 -- struct mdd_device *mdd = data;
17136 -- int rc;
17137 -+ struct mdd_device *mdd = m->private;
17138 -
17139 - LASSERT(mdd != NULL);
17140 -- *eof = 1;
17141 --
17142 -- rc = lfsck_get_speed(mdd->mdd_bottom, page, count);
17143 -- return rc != 0 ? rc : count;
17144 -+ return lfsck_get_speed(m, mdd->mdd_bottom);
17145 - }
17146 -
17147 --static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer,
17148 -- unsigned long count, void *data)
17149 -+static ssize_t
17150 -+mdd_lfsck_speed_limit_seq_write(struct file *file, const char *buffer,
17151 -+ size_t count, loff_t *off)
17152 - {
17153 -- struct mdd_device *mdd = data;
17154 -+ struct mdd_device *mdd = ((struct seq_file *)file->private_data)->private;
17155 - __u32 val;
17156 - int rc;
17157 -
17158 -@@ -293,40 +225,67 @@ static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer,
17159 - rc = lfsck_set_speed(mdd->mdd_bottom, val);
17160 - return rc != 0 ? rc : count;
17161 - }
17162 -+LPROC_SEQ_FOPS(mdd_lfsck_speed_limit);
17163 -
17164 --static int lprocfs_rd_lfsck_namespace(char *page, char **start, off_t off,
17165 -- int count, int *eof, void *data)
17166 -+static int mdd_lfsck_namespace_seq_show(struct seq_file *m, void *data)
17167 - {
17168 -- struct mdd_device *mdd = data;
17169 -- int rc;
17170 -+ struct mdd_device *mdd = m->private;
17171 -
17172 - LASSERT(mdd != NULL);
17173 -- *eof = 1;
17174 --
17175 -- rc = lfsck_dump(mdd->mdd_bottom, page, count, LT_NAMESPACE);
17176 -- return rc;
17177 -+ return lfsck_dump(m, mdd->mdd_bottom, LT_NAMESPACE);
17178 - }
17179 --
17180 --static struct lprocfs_vars lprocfs_mdd_obd_vars[] = {
17181 -- { "atime_diff", lprocfs_rd_atime_diff, lprocfs_wr_atime_diff, 0 },
17182 -- { "changelog_mask", lprocfs_rd_changelog_mask,
17183 -- lprocfs_wr_changelog_mask, 0 },
17184 -- { "changelog_users", lprocfs_rd_changelog_users, 0, 0},
17185 -- { "sync_permission", lprocfs_rd_sync_perm, lprocfs_wr_sync_perm, 0 },
17186 -- { "lfsck_speed_limit", lprocfs_rd_lfsck_speed_limit,
17187 -- lprocfs_wr_lfsck_speed_limit, 0 },
17188 -- { "lfsck_namespace", lprocfs_rd_lfsck_namespace, 0, 0 },
17189 -+LPROC_SEQ_FOPS_RO(mdd_lfsck_namespace);
17190 -+
17191 -+static struct lprocfs_seq_vars lprocfs_mdd_obd_vars[] = {
17192 -+ { "atime_diff", &mdd_atime_diff_fops },
17193 -+ { "changelog_mask", &mdd_changelog_mask_fops },
17194 -+ { "changelog_users", &mdd_changelog_users_fops },
17195 -+ { "sync_permission", &mdd_sync_perm_fops },
17196 -+ { "lfsck_speed_limit", &mdd_lfsck_speed_limit_fops },
17197 -+ { "lfsck_namespace", &mdd_lfsck_namespace_fops },
17198 - { 0 }
17199 - };
17200 -
17201 --static struct lprocfs_vars lprocfs_mdd_module_vars[] = {
17202 -- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
17203 -- { 0 }
17204 --};
17205 --
17206 --void lprocfs_mdd_init_vars(struct lprocfs_static_vars *lvars)
17207 -+int mdd_procfs_init(struct mdd_device *mdd, const char *name)
17208 - {
17209 -- lvars->module_vars = lprocfs_mdd_module_vars;
17210 -- lvars->obd_vars = lprocfs_mdd_obd_vars;
17211 -+ struct obd_device *obd = class_name2obd(name);
17212 -+ struct obd_type *type;
17213 -+ int rc;
17214 -+ ENTRY;
17215 -+
17216 -+ /* at the moment there is no linkage between lu_type
17217 -+ * and obd_type, so we lookup obd_type this way */
17218 -+ type = class_search_type(LUSTRE_MDD_NAME);
17219 -+
17220 -+ LASSERT(name != NULL);
17221 -+ LASSERT(type != NULL);
17222 -+ LASSERT(obd != NULL);
17223 -+
17224 -+ /* Find the type procroot and add the proc entry for this device */
17225 -+ obd->obd_vars = lprocfs_mdd_obd_vars;
17226 -+ mdd->mdd_proc_entry = lprocfs_seq_register(name, type->typ_procroot,
17227 -+ obd->obd_vars, mdd);
17228 -+ if (IS_ERR(mdd->mdd_proc_entry)) {
17229 -+ rc = PTR_ERR(mdd->mdd_proc_entry);
17230 -+ CERROR("Error %d setting up lprocfs for %s\n",
17231 -+ rc, name);
17232 -+ mdd->mdd_proc_entry = NULL;
17233 -+ GOTO(out, rc);
17234 -+ }
17235 -+ rc = 0;
17236 -+
17237 -+ EXIT;
17238 -+out:
17239 -+ if (rc)
17240 -+ mdd_procfs_fini(mdd);
17241 -+ return rc;
17242 - }
17243 -
17244 -+int mdd_procfs_fini(struct mdd_device *mdd)
17245 -+{
17246 -+ if (mdd->mdd_proc_entry) {
17247 -+ lprocfs_remove(&mdd->mdd_proc_entry);
17248 -+ mdd->mdd_proc_entry = NULL;
17249 -+ }
17250 -+ RETURN(0);
17251 -+}
17252 ---
17253 -1.8.5.1
17254 -
17255
17256 diff --git a/sys-cluster/lustre/lustre-9999.ebuild b/sys-cluster/lustre/lustre-9999.ebuild
17257 index a7fbbed..959fb1f 100644
17258 --- a/sys-cluster/lustre/lustre-9999.ebuild
17259 +++ b/sys-cluster/lustre/lustre-9999.ebuild
17260 @@ -34,23 +34,18 @@ DEPEND="${RDEPEND}
17261
17262 PATCHES=(
17263 "${FILESDIR}/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch"
17264 - "${FILESDIR}/0002-LU-3373-ldiskfs-ldiskfs-patches-for-3.11.1-fc19.patch"
17265 - "${FILESDIR}/0003-LU-3974-llite-dentry-d_compare-changes-in-3.11.patch"
17266 - "${FILESDIR}/0004-LU-3974-llite-use-new-struct-dir_context.patch"
17267 - "${FILESDIR}/0005-LU-3974-llite-invalidatepage-api-changed.patch"
17268 - "${FILESDIR}/0006-LU-3319-procfs-move-llite-proc-handling-over-to-seq_.patch"
17269 - "${FILESDIR}/0007-LU-3319-procfs-move-lmv-proc-handling-over-to-seq_fi.patch"
17270 - "${FILESDIR}/0008-LU-3319-procfs-move-ldlm-proc-handling-over-to-seq_f.patch"
17271 - "${FILESDIR}/0009-LU-3319-procfs-move-ost-proc-handling-over-to-seq_fi.patch"
17272 - "${FILESDIR}/0010-LU-3319-procfs-update-shared-server-side-core-proc-h.patch"
17273 - "${FILESDIR}/0011-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch"
17274 - "${FILESDIR}/0012-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch"
17275 - "${FILESDIR}/0013-LU-3319-procfs-move-ofd-proc-handling-to-seq_files.patch"
17276 - "${FILESDIR}/0014-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch"
17277 - "${FILESDIR}/0015-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch"
17278 - "${FILESDIR}/0016-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch"
17279 - "${FILESDIR}/0017-LU-3319-procfs-move-mdd-proc-handling-to-seq_files.patch"
17280 - "${FILESDIR}/0018-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch"
17281 + "${FILESDIR}/0002-LU-3319-lprocfs-client-side-cleanups.patch"
17282 + "${FILESDIR}/0003-LU-3319-procfs-fix-symlink-handling.patch"
17283 + "${FILESDIR}/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch"
17284 + "${FILESDIR}/0005-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch"
17285 + "${FILESDIR}/0006-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch"
17286 + "${FILESDIR}/0007-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch"
17287 + "${FILESDIR}/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch"
17288 + "${FILESDIR}/0009-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch"
17289 + "${FILESDIR}/0010-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch"
17290 + "${FILESDIR}/0011-LU-3373-osd-ldiskfs-readdir-replace-by-iterate.patch"
17291 + "${FILESDIR}/0012-LU-3974-llite-use-new-struct-dir_context.patch"
17292 + "${FILESDIR}/0013-LU-3974-llite-invalidatepage-api-changed.patch"
17293 )
17294
17295 pkg_setup() {