4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2011, 2015, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
31 * lustre/osd/osd_lproc.c
33 * Author: Mikhail Pershin <tappro@sun.com>
36 #define DEBUG_SUBSYSTEM S_OSD
38 #include <lprocfs_status.h>
40 #include "osd_internal.h"
44 void osd_brw_stats_update(struct osd_device *osd, struct osd_iobuf *iobuf)
46 struct brw_stats *s = &osd->od_brw_stats;
47 sector_t *last_block = NULL;
48 struct page **pages = iobuf->dr_pages;
49 struct page *last_page = NULL;
50 unsigned long discont_pages = 0;
51 unsigned long discont_blocks = 0;
52 sector_t *blocks = iobuf->dr_blocks;
53 int i, nr_pages = iobuf->dr_npages;
55 int rw = iobuf->dr_rw;
57 if (unlikely(nr_pages == 0))
60 blocks_per_page = PAGE_SIZE >> osd_sb(osd)->s_blocksize_bits;
62 lprocfs_oh_tally_log2(&s->hist[BRW_R_PAGES+rw], nr_pages);
64 while (nr_pages-- > 0) {
65 if (last_page && (*pages)->index != (last_page->index + 1))
69 for (i = 0; i < blocks_per_page; i++) {
70 if (last_block && *blocks != (*last_block + 1))
72 last_block = blocks++;
76 lprocfs_oh_tally(&s->hist[BRW_R_DISCONT_PAGES+rw], discont_pages);
77 lprocfs_oh_tally(&s->hist[BRW_R_DISCONT_BLOCKS+rw], discont_blocks);
80 static void display_brw_stats(struct seq_file *seq, char *name, char *units,
81 struct obd_histogram *read, struct obd_histogram *write, int scale)
83 unsigned long read_tot, write_tot, r, w, read_cum = 0, write_cum = 0;
86 seq_printf(seq, "\n%26s read | write\n", " ");
87 seq_printf(seq, "%-22s %-5s %% cum %% | %-11s %% cum %%\n",
90 read_tot = lprocfs_oh_sum(read);
91 write_tot = lprocfs_oh_sum(write);
92 for (i = 0; i < OBD_HIST_MAX; i++) {
93 r = read->oh_buckets[i];
94 w = write->oh_buckets[i];
97 if (read_cum == 0 && write_cum == 0)
101 seq_printf(seq, "%u", i);
103 seq_printf(seq, "%u", scale << i);
105 seq_printf(seq, "%uK", scale << (i-10));
107 seq_printf(seq, "%uM", scale << (i-20));
109 seq_printf(seq, ":\t\t%10lu %3u %3u | %4lu %3u %3u\n",
110 r, pct(r, read_tot), pct(read_cum, read_tot),
111 w, pct(w, write_tot), pct(write_cum, write_tot));
113 if (read_cum == read_tot && write_cum == write_tot)
118 static void brw_stats_show(struct seq_file *seq, struct brw_stats *brw_stats)
120 struct timespec64 now;
122 /* this sampling races with updates */
123 ktime_get_real_ts64(&now);
125 seq_printf(seq, "snapshot_time: %lld.%09ld (secs.nsecs)\n",
126 (s64)now.tv_sec, now.tv_nsec);
128 display_brw_stats(seq, "pages per bulk r/w", "rpcs",
129 &brw_stats->hist[BRW_R_PAGES],
130 &brw_stats->hist[BRW_W_PAGES], 1);
132 display_brw_stats(seq, "discontiguous pages", "rpcs",
133 &brw_stats->hist[BRW_R_DISCONT_PAGES],
134 &brw_stats->hist[BRW_W_DISCONT_PAGES], 0);
136 display_brw_stats(seq, "discontiguous blocks", "rpcs",
137 &brw_stats->hist[BRW_R_DISCONT_BLOCKS],
138 &brw_stats->hist[BRW_W_DISCONT_BLOCKS], 0);
140 display_brw_stats(seq, "disk fragmented I/Os", "ios",
141 &brw_stats->hist[BRW_R_DIO_FRAGS],
142 &brw_stats->hist[BRW_W_DIO_FRAGS], 0);
144 display_brw_stats(seq, "disk I/Os in flight", "ios",
145 &brw_stats->hist[BRW_R_RPC_HIST],
146 &brw_stats->hist[BRW_W_RPC_HIST], 0);
148 display_brw_stats(seq, "I/O time (1/1000s)", "ios",
149 &brw_stats->hist[BRW_R_IO_TIME],
150 &brw_stats->hist[BRW_W_IO_TIME], 1);
152 display_brw_stats(seq, "disk I/O size", "ios",
153 &brw_stats->hist[BRW_R_DISK_IOSIZE],
154 &brw_stats->hist[BRW_W_DISK_IOSIZE], 1);
157 static int osd_brw_stats_seq_show(struct seq_file *seq, void *v)
159 struct osd_device *osd = seq->private;
161 brw_stats_show(seq, &osd->od_brw_stats);
166 static ssize_t osd_brw_stats_seq_write(struct file *file,
167 const char __user *buf,
168 size_t len, loff_t *off)
170 struct seq_file *seq = file->private_data;
171 struct osd_device *osd = seq->private;
174 for (i = 0; i < BRW_LAST; i++)
175 lprocfs_oh_clear(&osd->od_brw_stats.hist[i]);
180 LPROC_SEQ_FOPS(osd_brw_stats);
182 static int osd_stats_init(struct osd_device *osd)
187 for (i = 0; i < BRW_LAST; i++)
188 spin_lock_init(&osd->od_brw_stats.hist[i].oh_lock);
190 osd->od_stats = lprocfs_alloc_stats(LPROC_OSD_LAST, 0);
191 if (osd->od_stats != NULL) {
192 result = lprocfs_register_stats(osd->od_proc_entry, "stats",
197 lprocfs_counter_init(osd->od_stats, LPROC_OSD_GET_PAGE,
198 LPROCFS_CNTR_AVGMINMAX|LPROCFS_CNTR_STDDEV,
200 lprocfs_counter_init(osd->od_stats, LPROC_OSD_NO_PAGE,
201 LPROCFS_CNTR_AVGMINMAX,
202 "get_page_failures", "num");
203 lprocfs_counter_init(osd->od_stats, LPROC_OSD_CACHE_ACCESS,
204 LPROCFS_CNTR_AVGMINMAX,
205 "cache_access", "pages");
206 lprocfs_counter_init(osd->od_stats, LPROC_OSD_CACHE_HIT,
207 LPROCFS_CNTR_AVGMINMAX,
208 "cache_hit", "pages");
209 lprocfs_counter_init(osd->od_stats, LPROC_OSD_CACHE_MISS,
210 LPROCFS_CNTR_AVGMINMAX,
211 "cache_miss", "pages");
212 #if OSD_THANDLE_STATS
213 lprocfs_counter_init(osd->od_stats, LPROC_OSD_THANDLE_STARTING,
214 LPROCFS_CNTR_AVGMINMAX,
215 "thandle starting", "usec");
216 lprocfs_counter_init(osd->od_stats, LPROC_OSD_THANDLE_OPEN,
217 LPROCFS_CNTR_AVGMINMAX,
218 "thandle open", "usec");
219 lprocfs_counter_init(osd->od_stats, LPROC_OSD_THANDLE_CLOSING,
220 LPROCFS_CNTR_AVGMINMAX,
221 "thandle closing", "usec");
223 result = lprocfs_seq_create(osd->od_proc_entry, "brw_stats",
224 0644, &osd_brw_stats_fops, osd);
232 static ssize_t fstype_show(struct kobject *kobj, struct attribute *attr,
235 return sprintf(buf, "ldiskfs\n");
237 LUSTRE_RO_ATTR(fstype);
239 static ssize_t mntdev_show(struct kobject *kobj, struct attribute *attr,
242 struct dt_device *dt = container_of(kobj, struct dt_device,
244 struct osd_device *osd = osd_dt_dev(dt);
247 if (unlikely(!osd->od_mnt))
250 return sprintf(buf, "%s\n", osd->od_mntdev);
252 LUSTRE_RO_ATTR(mntdev);
254 static ssize_t read_cache_enable_show(struct kobject *kobj,
255 struct attribute *attr,
258 struct dt_device *dt = container_of(kobj, struct dt_device,
260 struct osd_device *osd = osd_dt_dev(dt);
263 if (unlikely(!osd->od_mnt))
266 return sprintf(buf, "%u\n", osd->od_read_cache);
269 static ssize_t read_cache_enable_store(struct kobject *kobj,
270 struct attribute *attr,
271 const char *buffer, size_t count)
273 struct dt_device *dt = container_of(kobj, struct dt_device,
275 struct osd_device *osd = osd_dt_dev(dt);
280 if (unlikely(!osd->od_mnt))
283 rc = kstrtobool(buffer, &val);
287 osd->od_read_cache = !!val;
290 LUSTRE_RW_ATTR(read_cache_enable);
292 static ssize_t writethrough_cache_enable_show(struct kobject *kobj,
293 struct attribute *attr,
296 struct dt_device *dt = container_of(kobj, struct dt_device,
298 struct osd_device *osd = osd_dt_dev(dt);
301 if (unlikely(!osd->od_mnt))
304 return sprintf(buf, "%u\n", osd->od_writethrough_cache);
307 static ssize_t writethrough_cache_enable_store(struct kobject *kobj,
308 struct attribute *attr,
312 struct dt_device *dt = container_of(kobj, struct dt_device,
314 struct osd_device *osd = osd_dt_dev(dt);
319 if (unlikely(!osd->od_mnt))
322 rc = kstrtobool(buffer, &val);
326 osd->od_writethrough_cache = !!val;
329 LUSTRE_RW_ATTR(writethrough_cache_enable);
331 static ssize_t fallocate_zero_blocks_show(struct kobject *kobj,
332 struct attribute *attr,
335 struct dt_device *dt = container_of(kobj, struct dt_device,
337 struct osd_device *osd = osd_dt_dev(dt);
340 if (unlikely(!osd->od_mnt))
343 return scnprintf(buf, PAGE_SIZE, "%d\n", osd->od_fallocate_zero_blocks);
347 * Set how fallocate() interacts with the backing filesystem:
348 * -1: fallocate is disabled and returns -EOPNOTSUPP
349 * 0: fallocate allocates unwritten extents (like ext4)
350 * 1: fallocate zeroes allocated extents on disk
352 static ssize_t fallocate_zero_blocks_store(struct kobject *kobj,
353 struct attribute *attr,
354 const char *buffer, size_t count)
356 struct dt_device *dt = container_of(kobj, struct dt_device,
358 struct osd_device *osd = osd_dt_dev(dt);
363 if (unlikely(!osd->od_mnt))
366 rc = kstrtol(buffer, 0, &val);
370 if (val < -1 || val > 1)
373 osd->od_fallocate_zero_blocks = val;
376 LUSTRE_RW_ATTR(fallocate_zero_blocks);
378 ssize_t force_sync_store(struct kobject *kobj, struct attribute *attr,
379 const char *buffer, size_t count)
381 struct dt_device *dt = container_of(kobj, struct dt_device,
383 struct osd_device *osd = osd_dt_dev(dt);
388 if (unlikely(!osd->od_mnt))
391 rc = lu_env_init(&env, LCT_LOCAL);
395 rc = dt_sync(&env, dt);
398 return rc == 0 ? count : rc;
400 LUSTRE_WO_ATTR(force_sync);
402 static ssize_t nonrotational_show(struct kobject *kobj, struct attribute *attr,
405 struct dt_device *dt = container_of(kobj, struct dt_device,
407 struct osd_device *osd = osd_dt_dev(dt);
410 if (unlikely(!osd->od_mnt))
413 return sprintf(buf, "%u\n", osd->od_nonrotational);
416 static ssize_t nonrotational_store(struct kobject *kobj,
417 struct attribute *attr, const char *buffer,
420 struct dt_device *dt = container_of(kobj, struct dt_device,
422 struct osd_device *osd = osd_dt_dev(dt);
427 if (unlikely(!osd->od_mnt))
430 rc = kstrtobool(buffer, &val);
434 osd->od_nonrotational = val;
437 LUSTRE_RW_ATTR(nonrotational);
439 static ssize_t pdo_show(struct kobject *kobj, struct attribute *attr,
442 return sprintf(buf, "%s\n", ldiskfs_pdo ? "ON" : "OFF");
445 static ssize_t pdo_store(struct kobject *kobj, struct attribute *attr,
446 const char *buffer, size_t count)
451 rc = kstrtobool(buffer, &pdo);
461 static ssize_t auto_scrub_show(struct kobject *kobj, struct attribute *attr,
464 struct dt_device *dt = container_of(kobj, struct dt_device,
466 struct osd_device *dev = osd_dt_dev(dt);
469 if (unlikely(!dev->od_mnt))
472 return sprintf(buf, "%lld\n", dev->od_auto_scrub_interval);
475 static ssize_t auto_scrub_store(struct kobject *kobj, struct attribute *attr,
476 const char *buffer, size_t count)
478 struct dt_device *dt = container_of(kobj, struct dt_device,
480 struct osd_device *dev = osd_dt_dev(dt);
485 if (unlikely(!dev->od_mnt))
488 rc = kstrtoll(buffer, 0, &val);
492 dev->od_auto_scrub_interval = val;
495 LUSTRE_RW_ATTR(auto_scrub);
497 static ssize_t full_scrub_ratio_show(struct kobject *kobj,
498 struct attribute *attr,
501 struct dt_device *dt = container_of(kobj, struct dt_device,
503 struct osd_device *dev = osd_dt_dev(dt);
506 if (unlikely(!dev->od_mnt))
509 return sprintf(buf, "%llu\n", dev->od_full_scrub_ratio);
512 static ssize_t full_scrub_ratio_store(struct kobject *kobj,
513 struct attribute *attr,
514 const char *buffer, size_t count)
516 struct dt_device *dt = container_of(kobj, struct dt_device,
518 struct osd_device *dev = osd_dt_dev(dt);
523 if (unlikely(!dev->od_mnt))
526 rc = kstrtoll(buffer, 0, &val);
533 dev->od_full_scrub_ratio = val;
536 LUSTRE_RW_ATTR(full_scrub_ratio);
538 static ssize_t full_scrub_threshold_rate_show(struct kobject *kobj,
539 struct attribute *attr,
542 struct dt_device *dt = container_of(kobj, struct dt_device,
544 struct osd_device *dev = osd_dt_dev(dt);
547 if (unlikely(!dev->od_mnt))
550 return sprintf(buf, "%llu (bad OI mappings/minute)\n",
551 dev->od_full_scrub_threshold_rate);
554 static ssize_t full_scrub_threshold_rate_store(struct kobject *kobj,
555 struct attribute *attr,
556 const char *buffer, size_t count)
558 struct dt_device *dt = container_of(kobj, struct dt_device,
560 struct osd_device *dev = osd_dt_dev(dt);
565 if (unlikely(!dev->od_mnt))
568 rc = kstrtoull(buffer, 0, &val);
572 dev->od_full_scrub_threshold_rate = val;
575 LUSTRE_RW_ATTR(full_scrub_threshold_rate);
577 static ssize_t extent_bytes_allocation_show(struct kobject *kobj,
578 struct attribute *attr, char *buf)
580 struct dt_device *dt = container_of(kobj, struct dt_device,
582 struct osd_device *dev = osd_dt_dev(dt);
584 unsigned int min = (unsigned int)(~0), cur;
586 for_each_online_cpu(i) {
587 cur = *per_cpu_ptr(dev->od_extent_bytes_percpu, i);
591 return snprintf(buf, PAGE_SIZE, "%u\n", min);
593 LUSTRE_RO_ATTR(extent_bytes_allocation);
595 static int ldiskfs_osd_oi_scrub_seq_show(struct seq_file *m, void *data)
597 struct osd_device *dev = osd_dt_dev((struct dt_device *)m->private);
599 LASSERT(dev != NULL);
600 if (unlikely(dev->od_mnt == NULL))
603 osd_scrub_dump(m, dev);
607 LDEBUGFS_SEQ_FOPS_RO(ldiskfs_osd_oi_scrub);
609 static int ldiskfs_osd_readcache_seq_show(struct seq_file *m, void *data)
611 struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
613 LASSERT(osd != NULL);
614 if (unlikely(osd->od_mnt == NULL))
617 seq_printf(m, "%llu\n", osd->od_readcache_max_filesize);
622 ldiskfs_osd_readcache_seq_write(struct file *file, const char __user *buffer,
623 size_t count, loff_t *off)
625 struct seq_file *m = file->private_data;
626 struct dt_device *dt = m->private;
627 struct osd_device *osd = osd_dt_dev(dt);
628 char kernbuf[22] = "";
632 LASSERT(osd != NULL);
633 if (unlikely(osd->od_mnt == NULL))
636 if (count >= sizeof(kernbuf))
639 if (copy_from_user(kernbuf, buffer, count))
643 rc = sysfs_memparse(kernbuf, count, &val, "B");
647 osd->od_readcache_max_filesize = val > OSD_MAX_CACHE_SIZE ?
648 OSD_MAX_CACHE_SIZE : val;
652 LDEBUGFS_SEQ_FOPS(ldiskfs_osd_readcache);
654 static int ldiskfs_osd_readcache_max_io_seq_show(struct seq_file *m, void *data)
656 struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
658 LASSERT(osd != NULL);
659 if (unlikely(osd->od_mnt == NULL))
662 seq_printf(m, "%lu\n", osd->od_readcache_max_iosize >> 20);
667 ldiskfs_osd_readcache_max_io_seq_write(struct file *file,
668 const char __user *buffer,
669 size_t count, loff_t *off)
671 struct seq_file *m = file->private_data;
672 struct dt_device *dt = m->private;
673 struct osd_device *osd = osd_dt_dev(dt);
674 char kernbuf[22] = "";
678 LASSERT(osd != NULL);
679 if (unlikely(osd->od_mnt == NULL))
682 if (count >= sizeof(kernbuf))
685 if (copy_from_user(kernbuf, buffer, count))
689 rc = sysfs_memparse(kernbuf, count, &val, "MiB");
693 if (val > PTLRPC_MAX_BRW_SIZE)
695 osd->od_readcache_max_iosize = val;
699 LDEBUGFS_SEQ_FOPS(ldiskfs_osd_readcache_max_io);
701 static int ldiskfs_osd_writethrough_max_io_seq_show(struct seq_file *m,
704 struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
706 LASSERT(osd != NULL);
707 if (unlikely(osd->od_mnt == NULL))
710 seq_printf(m, "%lu\n", osd->od_writethrough_max_iosize >> 20);
715 ldiskfs_osd_writethrough_max_io_seq_write(struct file *file,
716 const char __user *buffer,
717 size_t count, loff_t *off)
719 struct seq_file *m = file->private_data;
720 struct dt_device *dt = m->private;
721 struct osd_device *osd = osd_dt_dev(dt);
722 char kernbuf[22] = "";
726 LASSERT(osd != NULL);
727 if (unlikely(osd->od_mnt == NULL))
730 if (count >= sizeof(kernbuf))
733 if (copy_from_user(kernbuf, buffer, count))
737 rc = sysfs_memparse(kernbuf, count, &val, "MiB");
741 if (val > PTLRPC_MAX_BRW_SIZE)
743 osd->od_writethrough_max_iosize = val;
747 LDEBUGFS_SEQ_FOPS(ldiskfs_osd_writethrough_max_io);
749 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 52, 0)
750 static ssize_t index_in_idif_show(struct kobject *kobj, struct attribute *attr,
753 struct dt_device *dt = container_of(kobj, struct dt_device,
755 struct osd_device *dev = osd_dt_dev(dt);
758 if (unlikely(!dev->od_mnt))
761 return sprintf(buf, "%d\n", (int)(dev->od_index_in_idif));
764 static ssize_t index_in_idif_store(struct kobject *kobj,
765 struct attribute *attr,
766 const char *buffer, size_t count)
768 struct dt_device *dt = container_of(kobj, struct dt_device,
770 struct osd_device *dev = osd_dt_dev(dt);
771 struct lu_target *tgt;
777 if (unlikely(!dev->od_mnt))
780 rc = kstrtobool(buffer, &val);
784 if (dev->od_index_in_idif) {
788 LCONSOLE_WARN("%s: OST-index in IDIF has been enabled, "
789 "it cannot be reverted back.\n", osd_name(dev));
796 rc = lu_env_init(&env, LCT_DT_THREAD);
800 tgt = dev->od_dt_dev.dd_lu_dev.ld_site->ls_tgt;
801 tgt->lut_lsd.lsd_feature_rocompat |= OBD_ROCOMPAT_IDX_IN_IDIF;
802 rc = tgt_server_data_update(&env, tgt, 1);
807 LCONSOLE_INFO("%s: enable OST-index in IDIF successfully, "
808 "it cannot be reverted back.\n", osd_name(dev));
810 dev->od_index_in_idif = 1;
813 LUSTRE_RW_ATTR(index_in_idif);
815 int osd_register_proc_index_in_idif(struct osd_device *osd)
817 struct dt_device *dt = &osd->od_dt_dev;
819 return sysfs_create_file(&dt->dd_kobj, &lustre_attr_index_in_idif.attr);
823 static ssize_t index_backup_show(struct kobject *kobj, struct attribute *attr,
826 struct dt_device *dt = container_of(kobj, struct dt_device,
828 struct osd_device *dev = osd_dt_dev(dt);
831 if (unlikely(!dev->od_mnt))
834 return sprintf(buf, "%d\n", dev->od_index_backup_policy);
837 ssize_t index_backup_store(struct kobject *kobj, struct attribute *attr,
838 const char *buffer, size_t count)
840 struct dt_device *dt = container_of(kobj, struct dt_device,
842 struct osd_device *dev = osd_dt_dev(dt);
847 if (unlikely(!dev->od_mnt))
850 rc = kstrtoint(buffer, 0, &val);
854 dev->od_index_backup_policy = val;
857 LUSTRE_RW_ATTR(index_backup);
859 struct ldebugfs_vars ldebugfs_osd_obd_vars[] = {
860 { .name = "oi_scrub",
861 .fops = &ldiskfs_osd_oi_scrub_fops },
862 { .name = "readcache_max_filesize",
863 .fops = &ldiskfs_osd_readcache_fops },
864 { .name = "readcache_max_io_mb",
865 .fops = &ldiskfs_osd_readcache_max_io_fops },
866 { .name = "writethrough_max_io_mb",
867 .fops = &ldiskfs_osd_writethrough_max_io_fops },
871 static struct attribute *ldiskfs_attrs[] = {
872 &lustre_attr_read_cache_enable.attr,
873 &lustre_attr_writethrough_cache_enable.attr,
874 &lustre_attr_fstype.attr,
875 &lustre_attr_mntdev.attr,
876 &lustre_attr_fallocate_zero_blocks.attr,
877 &lustre_attr_force_sync.attr,
878 &lustre_attr_nonrotational.attr,
879 &lustre_attr_index_backup.attr,
880 &lustre_attr_auto_scrub.attr,
881 &lustre_attr_pdo.attr,
882 &lustre_attr_full_scrub_ratio.attr,
883 &lustre_attr_full_scrub_threshold_rate.attr,
884 &lustre_attr_extent_bytes_allocation.attr,
888 int osd_procfs_init(struct osd_device *osd, const char *name)
890 struct obd_type *type;
895 /* at the moment there is no linkage between lu_type
896 * and obd_type, so we lookup obd_type this way
898 type = class_search_type(LUSTRE_OSD_LDISKFS_NAME);
903 CDEBUG(D_CONFIG, "%s: register osd-ldiskfs tunable parameters\n", name);
905 /* put reference taken by class_search_type */
906 kobject_put(&type->typ_kobj);
908 osd->od_dt_dev.dd_ktype.default_attrs = ldiskfs_attrs;
909 rc = dt_tunables_init(&osd->od_dt_dev, type, name,
910 ldebugfs_osd_obd_vars);
912 CERROR("%s: cannot setup sysfs / debugfs entry: %d\n",
917 if (osd->od_proc_entry)
920 /* Find the type procroot and add the proc entry for this device */
921 osd->od_proc_entry = lprocfs_register(name, type->typ_procroot,
922 NULL, &osd->od_dt_dev);
923 if (IS_ERR(osd->od_proc_entry)) {
924 rc = PTR_ERR(osd->od_proc_entry);
925 CERROR("Error %d setting up lprocfs for %s\n",
927 osd->od_proc_entry = NULL;
931 rc = osd_stats_init(osd);
936 osd_procfs_fini(osd);
940 int osd_procfs_fini(struct osd_device *osd)
943 lprocfs_free_stats(&osd->od_stats);
945 if (osd->od_proc_entry)
946 lprocfs_remove(&osd->od_proc_entry);
948 return dt_tunables_fini(&osd->od_dt_dev);