Whamcloud - gitweb
LU-5162 mdc: Add exception entry check for radix_tree
[fs/lustre-release.git] / lustre / ofd / lproc_ofd.c
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  *
30  * Copyright (c) 2012, 2013, Intel Corporation.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lustre/ofd/lproc_ofd.c
37  */
38
39 #define DEBUG_SUBSYSTEM S_CLASS
40
41 #include <obd.h>
42 #include <lprocfs_status.h>
43 #include <linux/seq_file.h>
44 #include <lustre_lfsck.h>
45
46 #include "ofd_internal.h"
47
48 #ifdef LPROCFS
49
50 static int ofd_seqs_seq_show(struct seq_file *m, void *data)
51 {
52         struct obd_device *obd = m->private;
53         struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
54
55         return seq_printf(m, "%u\n", ofd->ofd_seq_count);
56 }
57 LPROC_SEQ_FOPS_RO(ofd_seqs);
58
59 static int ofd_tot_dirty_seq_show(struct seq_file *m, void *data)
60 {
61         struct obd_device *obd = m->private;
62         struct ofd_device *ofd;
63
64         LASSERT(obd != NULL);
65         ofd = ofd_dev(obd->obd_lu_dev);
66         return seq_printf(m, LPU64"\n", ofd->ofd_tot_dirty);
67 }
68 LPROC_SEQ_FOPS_RO(ofd_tot_dirty);
69
70 static int ofd_tot_granted_seq_show(struct seq_file *m, void *data)
71 {
72         struct obd_device *obd = m->private;
73         struct ofd_device *ofd;
74
75         LASSERT(obd != NULL);
76         ofd = ofd_dev(obd->obd_lu_dev);
77         return seq_printf(m, LPU64"\n", ofd->ofd_tot_granted);
78 }
79 LPROC_SEQ_FOPS_RO(ofd_tot_granted);
80
81 static int ofd_tot_pending_seq_show(struct seq_file *m, void *data)
82 {
83         struct obd_device *obd = m->private;
84         struct ofd_device *ofd;
85
86         LASSERT(obd != NULL);
87         ofd = ofd_dev(obd->obd_lu_dev);
88         return seq_printf(m, LPU64"\n", ofd->ofd_tot_pending);
89 }
90 LPROC_SEQ_FOPS_RO(ofd_tot_pending);
91
92 static int ofd_grant_precreate_seq_show(struct seq_file *m, void *data)
93 {
94         struct obd_device *obd = m->private;
95
96         LASSERT(obd != NULL);
97         return seq_printf(m, "%ld\n",
98                           obd->obd_self_export->exp_filter_data.fed_grant);
99 }
100 LPROC_SEQ_FOPS_RO(ofd_grant_precreate);
101
102 static int ofd_grant_ratio_seq_show(struct seq_file *m, void *data)
103 {
104         struct obd_device *obd = m->private;
105         struct ofd_device *ofd;
106
107         LASSERT(obd != NULL);
108         ofd = ofd_dev(obd->obd_lu_dev);
109         return seq_printf(m, "%d%%\n",
110                           (int) ofd_grant_reserved(ofd, 100));
111 }
112
113 static ssize_t
114 ofd_grant_ratio_seq_write(struct file *file, const char __user *buffer,
115                           size_t count, loff_t *off)
116 {
117         struct seq_file         *m = file->private_data;
118         struct obd_device       *obd = m->private;
119         struct ofd_device       *ofd = ofd_dev(obd->obd_lu_dev);
120         int                      val;
121         int                      rc;
122
123         rc = lprocfs_write_helper(buffer, count, &val);
124         if (rc)
125                 return rc;
126
127         if (val > 100 || val < 0)
128                 return -EINVAL;
129
130         if (val == 0)
131                 CWARN("%s: disabling grant error margin\n", obd->obd_name);
132         if (val > 50)
133                 CWARN("%s: setting grant error margin >50%%, be warned that "
134                       "a huge part of the free space is now reserved for "
135                       "grants\n", obd->obd_name);
136
137         spin_lock(&ofd->ofd_grant_lock);
138         ofd->ofd_grant_ratio = ofd_grant_ratio_conv(val);
139         spin_unlock(&ofd->ofd_grant_lock);
140         return count;
141 }
142 LPROC_SEQ_FOPS(ofd_grant_ratio);
143
144 static int ofd_precreate_batch_seq_show(struct seq_file *m, void *data)
145 {
146         struct obd_device *obd = m->private;
147         struct ofd_device *ofd;
148
149         LASSERT(obd != NULL);
150         ofd = ofd_dev(obd->obd_lu_dev);
151         return seq_printf(m, "%d\n", ofd->ofd_precreate_batch);
152 }
153
154 static ssize_t
155 ofd_precreate_batch_seq_write(struct file *file, const char __user *buffer,
156                               size_t count, loff_t *off)
157 {
158         struct seq_file   *m = file->private_data;
159         struct obd_device *obd = m->private;
160         struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
161         int val;
162         int rc;
163
164         rc = lprocfs_write_helper(buffer, count, &val);
165         if (rc)
166                 return rc;
167
168         if (val < 1)
169                 return -EINVAL;
170
171         spin_lock(&ofd->ofd_batch_lock);
172         ofd->ofd_precreate_batch = val;
173         spin_unlock(&ofd->ofd_batch_lock);
174         return count;
175 }
176 LPROC_SEQ_FOPS(ofd_precreate_batch);
177
178 static int ofd_last_id_seq_show(struct seq_file *m, void *data)
179 {
180         struct obd_device       *obd = m->private;
181         struct ofd_device       *ofd;
182         struct ofd_seq          *oseq = NULL;
183         int                     retval = 0, rc;
184
185         if (obd == NULL)
186                 return 0;
187
188         ofd = ofd_dev(obd->obd_lu_dev);
189
190         read_lock(&ofd->ofd_seq_list_lock);
191         cfs_list_for_each_entry(oseq, &ofd->ofd_seq_list, os_list) {
192                 __u64 seq;
193
194                 seq = ostid_seq(&oseq->os_oi) == 0 ?
195                       fid_idif_seq(ostid_id(&oseq->os_oi),
196                                    ofd->ofd_lut.lut_lsd.lsd_osd_index) :
197                       ostid_seq(&oseq->os_oi);
198                 rc = seq_printf(m, DOSTID"\n", seq, ostid_id(&oseq->os_oi));
199                 if (rc < 0) {
200                         retval = rc;
201                         break;
202                 }
203                 retval += rc;
204         }
205         read_unlock(&ofd->ofd_seq_list_lock);
206         return retval;
207 }
208 LPROC_SEQ_FOPS_RO(ofd_last_id);
209
210 static int ofd_fmd_max_num_seq_show(struct seq_file *m, void *data)
211 {
212         struct obd_device *obd = m->private;
213         struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
214
215         return seq_printf(m, "%u\n", ofd->ofd_fmd_max_num);
216 }
217
218 static ssize_t
219 ofd_fmd_max_num_seq_write(struct file *file, const char __user *buffer,
220                           size_t count, loff_t *off)
221 {
222         struct seq_file         *m = file->private_data;
223         struct obd_device       *obd = m->private;
224         struct ofd_device       *ofd = ofd_dev(obd->obd_lu_dev);
225         int                      val;
226         int                      rc;
227
228         rc = lprocfs_write_helper(buffer, count, &val);
229         if (rc)
230                 return rc;
231
232         if (val > 65536 || val < 1)
233                 return -EINVAL;
234
235         ofd->ofd_fmd_max_num = val;
236         return count;
237 }
238 LPROC_SEQ_FOPS(ofd_fmd_max_num);
239
240 static int ofd_fmd_max_age_seq_show(struct seq_file *m, void *data)
241 {
242         struct obd_device *obd = m->private;
243         struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
244
245         return seq_printf(m, "%ld\n", ofd->ofd_fmd_max_age / HZ);
246 }
247
248 static ssize_t
249 ofd_fmd_max_age_seq_write(struct file *file, const char __user *buffer,
250                           size_t count, loff_t *off)
251 {
252         struct seq_file         *m = file->private_data;
253         struct obd_device       *obd = m->private;
254         struct ofd_device       *ofd = ofd_dev(obd->obd_lu_dev);
255         int                      val;
256         int                      rc;
257
258         rc = lprocfs_write_helper(buffer, count, &val);
259         if (rc)
260                 return rc;
261
262         if (val > 65536 || val < 1)
263                 return -EINVAL;
264
265         ofd->ofd_fmd_max_age = val * HZ;
266         return count;
267 }
268 LPROC_SEQ_FOPS(ofd_fmd_max_age);
269
270 static int ofd_capa_seq_show(struct seq_file *m, void *data)
271 {
272         struct obd_device       *obd = m->private;
273
274         return seq_printf(m, "capability on: %s\n",
275                           obd->u.filter.fo_fl_oss_capa ? "oss" : "");
276 }
277
278 static ssize_t
279 ofd_capa_seq_write(struct file *file, const char *__user buffer, size_t count,
280                    loff_t *off)
281 {
282         struct seq_file         *m = file->private_data;
283         struct obd_device       *obd = m->private;
284         int                      val, rc;
285
286         rc = lprocfs_write_helper(buffer, count, &val);
287         if (rc)
288                 return rc;
289
290         if (val & ~0x1) {
291                 CERROR("invalid capability mode, only 0/1 are accepted.\n"
292                        " 1: enable oss fid capability\n"
293                        " 0: disable oss fid capability\n");
294                 return -EINVAL;
295         }
296
297         obd->u.filter.fo_fl_oss_capa = val;
298         LCONSOLE_INFO("OSS %s %s fid capability.\n", obd->obd_name,
299                       val ? "enabled" : "disabled");
300         return count;
301 }
302 LPROC_SEQ_FOPS(ofd_capa);
303
304 static int ofd_capa_count_seq_show(struct seq_file *m, void *data)
305 {
306         return seq_printf(m, "%d %d\n", capa_count[CAPA_SITE_CLIENT],
307                           capa_count[CAPA_SITE_SERVER]);
308 }
309 LPROC_SEQ_FOPS_RO(ofd_capa_count);
310
311 static int ofd_degraded_seq_show(struct seq_file *m, void *data)
312 {
313         struct obd_device *obd = m->private;
314         struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
315
316         return seq_printf(m, "%u\n", ofd->ofd_raid_degraded);
317 }
318
319 static ssize_t
320 ofd_degraded_seq_write(struct file *file, const char __user *buffer,
321                        size_t count, loff_t *off)
322 {
323         struct seq_file         *m = file->private_data;
324         struct obd_device       *obd = m->private;
325         struct ofd_device       *ofd = ofd_dev(obd->obd_lu_dev);
326         int                      val, rc;
327
328         rc = lprocfs_write_helper(buffer, count, &val);
329         if (rc)
330                 return rc;
331
332         spin_lock(&ofd->ofd_flags_lock);
333         ofd->ofd_raid_degraded = !!val;
334         spin_unlock(&ofd->ofd_flags_lock);
335         return count;
336 }
337 LPROC_SEQ_FOPS(ofd_degraded);
338
339 static int ofd_fstype_seq_show(struct seq_file *m, void *data)
340 {
341         struct obd_device *obd = m->private;
342         struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
343         struct lu_device  *d;
344
345         LASSERT(ofd->ofd_osd);
346         d = &ofd->ofd_osd->dd_lu_dev;
347         LASSERT(d->ld_type);
348         return seq_printf(m, "%s\n", d->ld_type->ldt_name);
349 }
350 LPROC_SEQ_FOPS_RO(ofd_fstype);
351
352 static int ofd_syncjournal_seq_show(struct seq_file *m, void *data)
353 {
354         struct obd_device       *obd = m->private;
355         struct ofd_device       *ofd = ofd_dev(obd->obd_lu_dev);
356
357         return seq_printf(m, "%u\n", ofd->ofd_syncjournal);
358 }
359
360 static ssize_t
361 ofd_syncjournal_seq_write(struct file *file, const char __user *buffer,
362                           size_t count, loff_t *off)
363 {
364         struct seq_file         *m = file->private_data;
365         struct obd_device       *obd = m->private;
366         struct ofd_device       *ofd = ofd_dev(obd->obd_lu_dev);
367         int                      val;
368         int                      rc;
369
370         rc = lprocfs_write_helper(buffer, count, &val);
371         if (rc)
372                 return rc;
373
374         if (val < 0)
375                 return -EINVAL;
376
377         spin_lock(&ofd->ofd_flags_lock);
378         ofd->ofd_syncjournal = !!val;
379         ofd_slc_set(ofd);
380         spin_unlock(&ofd->ofd_flags_lock);
381
382         return count;
383 }
384 LPROC_SEQ_FOPS(ofd_syncjournal);
385
386 /* This must be longer than the longest string below */
387 #define SYNC_STATES_MAXLEN 16
388 static char *sync_on_cancel_states[] = {"never",
389                                         "blocking",
390                                         "always" };
391
392 static int ofd_sync_lock_cancel_seq_show(struct seq_file *m, void *data)
393 {
394         struct obd_device       *obd = m->private;
395         struct lu_target        *tgt = obd->u.obt.obt_lut;
396
397         return seq_printf(m, "%s\n",
398                           sync_on_cancel_states[tgt->lut_sync_lock_cancel]);
399 }
400
401 static ssize_t
402 ofd_sync_lock_cancel_seq_write(struct file *file, const char __user *buffer,
403                                size_t count, loff_t *off)
404 {
405         struct seq_file         *m = file->private_data;
406         struct obd_device       *obd = m->private;
407         struct lu_target        *tgt = obd->u.obt.obt_lut;
408         char                     kernbuf[SYNC_STATES_MAXLEN];
409         int                      val = -1;
410         int                      i;
411
412         if (count == 0 || count >= sizeof(kernbuf))
413                 return -EINVAL;
414
415         if (copy_from_user(kernbuf, buffer, count))
416                 return -EFAULT;
417         kernbuf[count] = 0;
418
419         if (kernbuf[count - 1] == '\n')
420                 kernbuf[count - 1] = 0;
421
422         for (i = 0 ; i < NUM_SYNC_ON_CANCEL_STATES; i++) {
423                 if (strcmp(kernbuf, sync_on_cancel_states[i]) == 0) {
424                         val = i;
425                         break;
426                 }
427         }
428
429         /* Legacy numeric codes */
430         if (val == -1) {
431                 int rc;
432
433                 /* Safe to use userspace buffer as lprocfs_write_helper will
434                  * use copy from user for parsing */
435                 rc = lprocfs_write_helper(buffer, count, &val);
436                 if (rc)
437                         return rc;
438         }
439
440         if (val < 0 || val > 2)
441                 return -EINVAL;
442
443         spin_lock(&tgt->lut_flags_lock);
444         tgt->lut_sync_lock_cancel = val;
445         spin_unlock(&tgt->lut_flags_lock);
446         return count;
447 }
448 LPROC_SEQ_FOPS(ofd_sync_lock_cancel);
449
450 static int ofd_grant_compat_disable_seq_show(struct seq_file *m, void *data)
451 {
452         struct obd_device *obd = m->private;
453         struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
454
455         return seq_printf(m, "%u\n", ofd->ofd_grant_compat_disable);
456 }
457
458 static ssize_t
459 ofd_grant_compat_disable_seq_write(struct file *file,
460                                    const char __user *buffer,
461                                    size_t count, loff_t *off)
462 {
463         struct seq_file         *m = file->private_data;
464         struct obd_device       *obd = m->private;
465         struct ofd_device       *ofd = ofd_dev(obd->obd_lu_dev);
466         int                      val;
467         int                      rc;
468
469         rc = lprocfs_write_helper(buffer, count, &val);
470         if (rc)
471                 return rc;
472
473         if (val < 0)
474                 return -EINVAL;
475
476         spin_lock(&ofd->ofd_flags_lock);
477         ofd->ofd_grant_compat_disable = !!val;
478         spin_unlock(&ofd->ofd_flags_lock);
479
480         return count;
481 }
482 LPROC_SEQ_FOPS(ofd_grant_compat_disable);
483
484 static int ofd_soft_sync_limit_seq_show(struct seq_file *m, void *data)
485 {
486         struct obd_device       *obd = m->private;
487         struct ofd_device       *ofd = ofd_dev(obd->obd_lu_dev);
488
489         return lprocfs_uint_seq_show(m, &ofd->ofd_soft_sync_limit);
490 }
491
492 static ssize_t
493 ofd_soft_sync_limit_seq_write(struct file *file, const char __user *buffer,
494                               size_t count, loff_t *off)
495 {
496         struct seq_file   *m = file->private_data;
497         struct obd_device *obd = m->private;
498         struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
499
500         return lprocfs_uint_seq_write(file, buffer, count,
501                                       (loff_t *) &ofd->ofd_soft_sync_limit);
502 }
503 LPROC_SEQ_FOPS(ofd_soft_sync_limit);
504
505 static int ofd_lfsck_speed_limit_seq_show(struct seq_file *m, void *data)
506 {
507         struct obd_device       *obd = m->private;
508         struct ofd_device       *ofd = ofd_dev(obd->obd_lu_dev);
509
510         return lfsck_get_speed(m, ofd->ofd_osd);
511 }
512
513 static ssize_t
514 ofd_lfsck_speed_limit_seq_write(struct file *file, const char __user *buffer,
515                                 size_t count, loff_t *off)
516 {
517         struct seq_file         *m = file->private_data;
518         struct obd_device       *obd = m->private;
519         struct ofd_device       *ofd = ofd_dev(obd->obd_lu_dev);
520         __u32                    val;
521         int                      rc;
522
523         rc = lprocfs_write_helper(buffer, count, &val);
524         if (rc != 0)
525                 return rc;
526
527         rc = lfsck_set_speed(ofd->ofd_osd, val);
528
529         return rc != 0 ? rc : count;
530 }
531 LPROC_SEQ_FOPS(ofd_lfsck_speed_limit);
532
533 static int ofd_lfsck_layout_seq_show(struct seq_file *m, void *data)
534 {
535         struct obd_device *obd = m->private;
536         struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
537
538         return lfsck_dump(m, ofd->ofd_osd, LT_LAYOUT);
539 }
540 LPROC_SEQ_FOPS_RO(ofd_lfsck_layout);
541
542 static int ofd_lfsck_verify_pfid_seq_show(struct seq_file *m, void *data)
543 {
544         struct obd_device *obd = m->private;
545         struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
546
547         return seq_printf(m,
548                           "switch: %s\ndetected: "LPU64"\nrepaired: "LPU64"\n",
549                           ofd->ofd_lfsck_verify_pfid ? "on" : "off",
550                           ofd->ofd_inconsistency_self_detected,
551                           ofd->ofd_inconsistency_self_repaired);
552 }
553
554 static ssize_t
555 ofd_lfsck_verify_pfid_seq_write(struct file *file, const char __user *buffer,
556                                 size_t count, loff_t *off)
557 {
558         struct seq_file         *m = file->private_data;
559         struct obd_device       *obd = m->private;
560         struct ofd_device       *ofd = ofd_dev(obd->obd_lu_dev);
561         __u32                    val;
562         int                      rc;
563
564         rc = lprocfs_write_helper(buffer, count, &val);
565         if (rc != 0)
566                 return rc;
567
568         ofd->ofd_lfsck_verify_pfid = !!val;
569
570         return count;
571 }
572 LPROC_SEQ_FOPS(ofd_lfsck_verify_pfid);
573
574 LPROC_SEQ_FOPS_RO_TYPE(ofd, uuid);
575 LPROC_SEQ_FOPS_RO_TYPE(ofd, blksize);
576 LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytestotal);
577 LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytesfree);
578 LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytesavail);
579 LPROC_SEQ_FOPS_RO_TYPE(ofd, filestotal);
580 LPROC_SEQ_FOPS_RO_TYPE(ofd, filesfree);
581
582 LPROC_SEQ_FOPS_RO_TYPE(ofd, recovery_status);
583 LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_soft);
584 LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_hard);
585 LPROC_SEQ_FOPS_WO_TYPE(ofd, evict_client);
586 LPROC_SEQ_FOPS_RO_TYPE(ofd, num_exports);
587 LPROC_SEQ_FOPS_RO_TYPE(ofd, target_instance);
588 LPROC_SEQ_FOPS_RW_TYPE(ofd, ir_factor);
589 LPROC_SEQ_FOPS_RW_TYPE(ofd, job_interval);
590
591 struct lprocfs_seq_vars lprocfs_ofd_obd_vars[] = {
592         { .name =       "uuid",
593           .fops =       &ofd_uuid_fops                  },
594         { .name =       "blocksize",
595           .fops =       &ofd_blksize_fops               },
596         { .name =       "kbytestotal",
597           .fops =       &ofd_kbytestotal_fops           },
598         { .name =       "kbytesfree",
599           .fops =       &ofd_kbytesfree_fops            },
600         { .name =       "kbytesavail",
601           .fops =       &ofd_kbytesavail_fops           },
602         { .name =       "filestotal",
603           .fops =       &ofd_filestotal_fops            },
604         { .name =       "filesfree",
605           .fops =       &ofd_filesfree_fops             },
606         { .name =       "seqs_allocated",
607           .fops =       &ofd_seqs_fops                  },
608         { .name =       "fstype",
609           .fops =       &ofd_fstype_fops                },
610         { .name =       "last_id",
611           .fops =       &ofd_last_id_fops               },
612         { .name =       "tot_dirty",
613           .fops =       &ofd_tot_dirty_fops             },
614         { .name =       "tot_pending",
615           .fops =       &ofd_tot_pending_fops           },
616         { .name =       "tot_granted",
617           .fops =       &ofd_tot_granted_fops           },
618         { .name =       "grant_precreate",
619           .fops =       &ofd_grant_precreate_fops       },
620         { .name =       "grant_ratio",
621           .fops =       &ofd_grant_ratio_fops           },
622         { .name =       "precreate_batch",
623           .fops =       &ofd_precreate_batch_fops       },
624         { .name =       "recovery_status",
625           .fops =       &ofd_recovery_status_fops       },
626         { .name =       "recovery_time_soft",
627           .fops =       &ofd_recovery_time_soft_fops    },
628         { .name =       "recovery_time_hard",
629           .fops =       &ofd_recovery_time_hard_fops    },
630         { .name =       "evict_client",
631           .fops =       &ofd_evict_client_fops          },
632         { .name =       "num_exports",
633           .fops =       &ofd_num_exports_fops           },
634         { .name =       "degraded",
635           .fops =       &ofd_degraded_fops              },
636         { .name =       "sync_journal",
637           .fops =       &ofd_syncjournal_fops           },
638         { .name =       "sync_on_lock_cancel",
639           .fops =       &ofd_sync_lock_cancel_fops      },
640         { .name =       "instance",
641           .fops =       &ofd_target_instance_fops       },
642         { .name =       "ir_factor",
643           .fops =       &ofd_ir_factor_fops             },
644         { .name =       "grant_compat_disable",
645           .fops =       &ofd_grant_compat_disable_fops  },
646         { .name =       "client_cache_count",
647           .fops =       &ofd_fmd_max_num_fops           },
648         { .name =       "client_cache_seconds",
649           .fops =       &ofd_fmd_max_age_fops           },
650         { .name =       "capa",
651           .fops =       &ofd_capa_fops                  },
652         { .name =       "capa_count",
653           .fops =       &ofd_capa_count_fops            },
654         { .name =       "job_cleanup_interval",
655           .fops =       &ofd_job_interval_fops          },
656         { .name =       "soft_sync_limit",
657           .fops =       &ofd_soft_sync_limit_fops       },
658         { .name =       "lfsck_speed_limit",
659           .fops =       &ofd_lfsck_speed_limit_fops     },
660         { .name =       "lfsck_layout",
661           .fops =       &ofd_lfsck_layout_fops          },
662         { .name =       "lfsck_verify_pfid",
663           .fops =       &ofd_lfsck_verify_pfid_fops     },
664         { 0 }
665 };
666
667 void ofd_stats_counter_init(struct lprocfs_stats *stats)
668 {
669         LASSERT(stats && stats->ls_num >= LPROC_OFD_STATS_LAST);
670
671         lprocfs_counter_init(stats, LPROC_OFD_STATS_READ,
672                              LPROCFS_CNTR_AVGMINMAX, "read_bytes", "bytes");
673         lprocfs_counter_init(stats, LPROC_OFD_STATS_WRITE,
674                              LPROCFS_CNTR_AVGMINMAX, "write_bytes", "bytes");
675         lprocfs_counter_init(stats, LPROC_OFD_STATS_GETATTR,
676                              0, "getattr", "reqs");
677         lprocfs_counter_init(stats, LPROC_OFD_STATS_SETATTR,
678                              0, "setattr", "reqs");
679         lprocfs_counter_init(stats, LPROC_OFD_STATS_PUNCH,
680                              0, "punch", "reqs");
681         lprocfs_counter_init(stats, LPROC_OFD_STATS_SYNC,
682                              0, "sync", "reqs");
683         lprocfs_counter_init(stats, LPROC_OFD_STATS_DESTROY,
684                              0, "destroy", "reqs");
685         lprocfs_counter_init(stats, LPROC_OFD_STATS_CREATE,
686                              0, "create", "reqs");
687         lprocfs_counter_init(stats, LPROC_OFD_STATS_STATFS,
688                              0, "statfs", "reqs");
689         lprocfs_counter_init(stats, LPROC_OFD_STATS_GET_INFO,
690                              0, "get_info", "reqs");
691         lprocfs_counter_init(stats, LPROC_OFD_STATS_SET_INFO,
692                              0, "set_info", "reqs");
693         lprocfs_counter_init(stats, LPROC_OFD_STATS_QUOTACTL,
694                              0, "quotactl", "reqs");
695 }
696
697 #endif /* LPROCFS */