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 2008 Sun Microsystems, Inc. All rights reserved
24 * Use is subject to license terms.
26 * Copyright (c) 2012, 2017, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
31 #define DEBUG_SUBSYSTEM S_CLASS
33 #include <lprocfs_status.h>
34 #include <obd_class.h>
35 #include <linux/seq_file.h>
36 #include "lod_internal.h"
37 #include <uapi/linux/lustre/lustre_param.h>
40 * Notice, all the functions below (except for lod_procfs_init() and
41 * lod_procfs_fini()) are not supposed to be used directly. They are
42 * called by Linux kernel's procfs.
47 static ssize_t dom_stripesize_show(struct kobject *kobj,
48 struct attribute *attr,
51 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
52 struct lod_device *lod = dt2lod_dev(dt);
54 return scnprintf(buf, PAGE_SIZE, "%u\n",
55 lod->lod_dom_stripesize_max_kb << 10);
58 static inline int dom_stripesize_max_kb_update(struct lod_device *lod,
61 /* 1GB is the limit */
62 if (val > (1ULL << 20))
66 if (val < LOD_DOM_MIN_SIZE_KB) {
67 LCONSOLE_INFO("Increasing provided stripe size to a minimum value %u\n",
69 val = LOD_DOM_MIN_SIZE_KB;
70 } else if (val & (LOD_DOM_MIN_SIZE_KB - 1)) {
71 val &= ~(LOD_DOM_MIN_SIZE_KB - 1);
72 LCONSOLE_WARN("Changing provided stripe size to %llu (a multiple of minimum %u)\n",
73 val, LOD_DOM_MIN_SIZE_KB);
76 spin_lock(&lod->lod_lsfs_lock);
77 lod->lod_dom_stripesize_max_kb = val;
78 lod_dom_stripesize_recalc(lod);
79 spin_unlock(&lod->lod_lsfs_lock);
83 static ssize_t dom_stripesize_store(struct kobject *kobj,
84 struct attribute *attr,
85 const char *buffer, size_t count)
87 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
88 struct lod_device *lod = dt2lod_dev(dt);
92 rc = sysfs_memparse(buffer, count, &val, "B");
96 rc = dom_stripesize_max_kb_update(lod, val >> 10);
102 /* Old attribute name is still supported */
103 LUSTRE_RW_ATTR(dom_stripesize);
106 * Show DoM maximum allowed stripe size.
108 static ssize_t dom_stripesize_max_kb_show(struct kobject *kobj,
109 struct attribute *attr,
112 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
113 struct lod_device *lod = dt2lod_dev(dt);
115 return scnprintf(buf, PAGE_SIZE, "%u\n",
116 lod->lod_dom_stripesize_max_kb);
120 * Set DoM maximum allowed stripe size.
122 static ssize_t dom_stripesize_max_kb_store(struct kobject *kobj,
123 struct attribute *attr,
124 const char *buffer, size_t count)
126 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
127 struct lod_device *lod = dt2lod_dev(dt);
131 rc = sysfs_memparse(buffer, count, &val, "KiB");
135 rc = dom_stripesize_max_kb_update(lod, val >> 10);
140 LUSTRE_RW_ATTR(dom_stripesize_max_kb);
143 * Show DoM default stripe size.
145 static ssize_t dom_stripesize_cur_kb_show(struct kobject *kobj,
146 struct attribute *attr,
149 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
150 struct lod_device *lod = dt2lod_dev(dt);
152 return scnprintf(buf, PAGE_SIZE, "%u\n",
153 lod->lod_dom_stripesize_cur_kb);
156 LUSTRE_RO_ATTR(dom_stripesize_cur_kb);
159 * Show DoM threshold.
161 static ssize_t dom_threshold_free_mb_show(struct kobject *kobj,
162 struct attribute *attr, char *buf)
164 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
165 struct lod_device *lod = dt2lod_dev(dt);
167 return scnprintf(buf, PAGE_SIZE, "%llu\n",
168 lod->lod_dom_threshold_free_mb);
172 * Set DoM default stripe size.
174 static ssize_t dom_threshold_free_mb_store(struct kobject *kobj,
175 struct attribute *attr,
176 const char *buffer, size_t count)
178 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
179 struct lod_device *lod = dt2lod_dev(dt);
184 pct = strnchr(buffer, count, '%');
186 rc = string_to_size(&val, buffer, pct - buffer);
189 val = mult_frac(lod->lod_lsfs_total_mb,
190 min_t(unsigned int, val, 100), 100);
192 rc = sysfs_memparse(buffer, count, &val, "MiB");
198 spin_lock(&lod->lod_lsfs_lock);
199 lod->lod_dom_threshold_free_mb = val;
200 lod_dom_stripesize_recalc(lod);
201 spin_unlock(&lod->lod_lsfs_lock);
206 LUSTRE_RW_ATTR(dom_threshold_free_mb);
208 static ssize_t stripesize_show(struct kobject *kobj, struct attribute *attr,
211 struct dt_device *dt = container_of(kobj, struct dt_device,
213 struct lod_device *lod = dt2lod_dev(dt);
215 return scnprintf(buf, PAGE_SIZE, "%llu\n",
216 lod->lod_ost_descs.ltd_lov_desc.ld_default_stripe_size);
219 static ssize_t stripesize_store(struct kobject *kobj, struct attribute *attr,
220 const char *buffer, size_t count)
222 struct dt_device *dt = container_of(kobj, struct dt_device,
224 struct lod_device *lod = dt2lod_dev(dt);
228 rc = sysfs_memparse(buffer, count, &val, "B");
232 lod_fix_desc_stripe_size(&val);
233 lod->lod_ost_descs.ltd_lov_desc.ld_default_stripe_size = val;
238 LUSTRE_RW_ATTR(stripesize);
241 * Show default stripe offset.
243 static ssize_t stripeoffset_show(struct kobject *kobj, struct attribute *attr,
246 struct dt_device *dt = container_of(kobj, struct dt_device,
248 struct lod_device *lod = dt2lod_dev(dt);
250 return scnprintf(buf, PAGE_SIZE, "%lld\n",
251 lod->lod_ost_descs.ltd_lov_desc.ld_default_stripe_offset);
255 * Set default stripe offset.
257 * Usually contains -1 allowing Lustre to balance objects among OST
258 * otherwise may cause severe OST imbalance.
260 static ssize_t stripeoffset_store(struct kobject *kobj,
261 struct attribute *attr,
262 const char *buffer, size_t count)
264 struct dt_device *dt = container_of(kobj, struct dt_device,
266 struct lod_device *lod = dt2lod_dev(dt);
270 rc = kstrtol(buffer, 0, &val);
274 if (val < -1 || val > LOV_MAX_STRIPE_COUNT)
277 lod->lod_ost_descs.ltd_lov_desc.ld_default_stripe_offset = val;
282 LUSTRE_RW_ATTR(stripeoffset);
284 static ssize_t max_stripecount_show(struct kobject *kobj,
285 struct attribute *attr, char *buf)
287 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
288 struct lod_device *lod = dt2lod_dev(dt);
290 return scnprintf(buf, PAGE_SIZE, "%u\n", lod->lod_max_stripecount);
293 static ssize_t max_stripecount_store(struct kobject *kobj,
294 struct attribute *attr,
295 const char *buffer, size_t count)
297 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
298 struct lod_device *lod = dt2lod_dev(dt);
302 rc = kstrtol(buffer, 0, &val);
306 if (val < 0 || val > LOV_MAX_STRIPE_COUNT)
309 lod->lod_max_stripecount = val;
314 LUSTRE_RW_ATTR(max_stripecount);
316 static ssize_t max_mdt_stripecount_show(struct kobject *kobj,
317 struct attribute *attr, char *buf)
319 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
320 struct lod_device *lod = dt2lod_dev(dt);
322 return scnprintf(buf, PAGE_SIZE, "%u\n", lod->lod_max_mdt_stripecount);
325 static ssize_t max_mdt_stripecount_store(struct kobject *kobj,
326 struct attribute *attr,
327 const char *buffer, size_t count)
329 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
330 struct lod_device *lod = dt2lod_dev(dt);
334 rc = kstrtol(buffer, 0, &val);
338 if (val < 0 || val > LMV_MAX_STRIPE_COUNT) /* any limitation? */
341 lod->lod_max_mdt_stripecount = val;
346 LUSTRE_RW_ATTR(max_mdt_stripecount);
350 * Show default striping pattern (LOV_PATTERN_*).
352 static ssize_t __stripetype_show(struct kobject *kobj, struct attribute *attr,
353 char *buf, bool is_mdt)
355 struct dt_device *dt = container_of(kobj, struct dt_device,
357 struct lod_device *lod = dt2lod_dev(dt);
358 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
361 return scnprintf(buf, PAGE_SIZE, "%u\n", ltd->ltd_lov_desc.ld_pattern);
364 static ssize_t mdt_stripetype_show(struct kobject *kobj, struct attribute *attr,
367 return __stripetype_show(kobj, attr, buf, true);
370 static ssize_t stripetype_show(struct kobject *kobj, struct attribute *attr,
373 return __stripetype_show(kobj, attr, buf, false);
377 * Set default striping pattern (a number, not a human-readable string).
379 static ssize_t __stripetype_store(struct kobject *kobj, struct attribute *attr,
380 const char *buffer, size_t count, bool is_mdt)
382 struct dt_device *dt = container_of(kobj, struct dt_device,
384 struct lod_device *lod = dt2lod_dev(dt);
385 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
390 rc = kstrtouint(buffer, 0, &pattern);
395 lod_fix_lmv_desc_pattern(&pattern);
397 lod_fix_desc_pattern(&pattern);
399 ltd->ltd_lov_desc.ld_pattern = pattern;
404 static ssize_t mdt_stripetype_store(struct kobject *kobj,
405 struct attribute *attr, const char *buffer,
408 return __stripetype_store(kobj, attr, buffer, count, true);
411 static ssize_t stripetype_store(struct kobject *kobj,
412 struct attribute *attr, const char *buffer,
415 return __stripetype_store(kobj, attr, buffer, count, false);
418 LUSTRE_RW_ATTR(mdt_stripetype);
419 LUSTRE_RW_ATTR(stripetype);
422 * Show default number of stripes.
424 static ssize_t __stripecount_show(struct kobject *kobj, struct attribute *attr,
425 char *buf, bool is_mdt)
427 struct dt_device *dt = container_of(kobj, struct dt_device,
429 struct lod_device *lod = dt2lod_dev(dt);
430 struct lov_desc *desc = is_mdt ? &lod->lod_mdt_descs.ltd_lov_desc :
431 &lod->lod_ost_descs.ltd_lov_desc;
433 return scnprintf(buf, PAGE_SIZE, "%d\n",
434 (s16)(desc->ld_default_stripe_count + 1) - 1);
437 static ssize_t mdt_stripecount_show(struct kobject *kobj,
438 struct attribute *attr, char *buf)
440 return __stripecount_show(kobj, attr, buf, true);
443 static ssize_t stripecount_show(struct kobject *kobj, struct attribute *attr,
446 return __stripecount_show(kobj, attr, buf, false);
450 * Set default number of stripes.
452 static ssize_t __stripecount_store(struct kobject *kobj, struct attribute *attr,
453 const char *buffer, size_t count,
456 struct dt_device *dt = container_of(kobj, struct dt_device,
458 struct lod_device *lod = dt2lod_dev(dt);
459 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
464 rc = kstrtoint(buffer, 0, &stripe_count);
468 if (stripe_count < -1)
471 lod_fix_desc_stripe_count(&stripe_count);
472 ltd->ltd_lov_desc.ld_default_stripe_count = stripe_count;
477 static ssize_t mdt_stripecount_store(struct kobject *kobj,
478 struct attribute *attr,
479 const char *buffer, size_t count)
481 return __stripecount_store(kobj, attr, buffer, count, true);
484 static ssize_t stripecount_store(struct kobject *kobj,
485 struct attribute *attr,
486 const char *buffer, size_t count)
488 return __stripecount_store(kobj, attr, buffer, count, false);
491 LUSTRE_RW_ATTR(mdt_stripecount);
492 LUSTRE_RW_ATTR(stripecount);
495 * Show number of targets.
497 static ssize_t __numobd_show(struct kobject *kobj, struct attribute *attr,
498 char *buf, bool is_mdt)
500 struct dt_device *dt = container_of(kobj, struct dt_device,
502 struct lod_device *lod = dt2lod_dev(dt);
503 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
506 return scnprintf(buf, PAGE_SIZE, "%u\n",
507 ltd->ltd_lov_desc.ld_tgt_count);
510 static ssize_t mdt_numobd_show(struct kobject *kobj, struct attribute *attr,
513 return __numobd_show(kobj, attr, buf, true);
516 static ssize_t numobd_show(struct kobject *kobj, struct attribute *attr,
519 return __numobd_show(kobj, attr, buf, false);
522 LUSTRE_RO_ATTR(mdt_numobd);
523 LUSTRE_RO_ATTR(numobd);
526 * Show number of active targets.
528 static ssize_t __activeobd_show(struct kobject *kobj, struct attribute *attr,
529 char *buf, bool is_mdt)
531 struct dt_device *dt = container_of(kobj, struct dt_device,
533 struct lod_device *lod = dt2lod_dev(dt);
534 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
537 return scnprintf(buf, PAGE_SIZE, "%u\n",
538 ltd->ltd_lov_desc.ld_active_tgt_count);
541 static ssize_t mdt_activeobd_show(struct kobject *kobj, struct attribute *attr,
544 return __activeobd_show(kobj, attr, buf, true);
547 static ssize_t activeobd_show(struct kobject *kobj, struct attribute *attr,
550 return __activeobd_show(kobj, attr, buf, false);
553 LUSTRE_RO_ATTR(mdt_activeobd);
554 LUSTRE_RO_ATTR(activeobd);
557 * Show UUID of LOD device.
559 static ssize_t desc_uuid_show(struct kobject *kobj, struct attribute *attr,
562 struct dt_device *dt = container_of(kobj, struct dt_device,
564 struct lod_device *lod = dt2lod_dev(dt);
566 return scnprintf(buf, PAGE_SIZE, "%s\n",
567 lod->lod_ost_descs.ltd_lov_desc.ld_uuid.uuid);
569 LUSTRE_RO_ATTR(desc_uuid);
572 * Show QoS priority parameter.
574 * The printed value is a percentage value (0-100%) indicating the priority
575 * of free space compared to performance. 0% means select OSTs equally
576 * regardless of their free space, 100% means select OSTs only by their free
577 * space even if it results in very imbalanced load on the OSTs.
579 static ssize_t __qos_prio_free_show(struct kobject *kobj,
580 struct attribute *attr, char *buf,
583 struct dt_device *dt = container_of(kobj, struct dt_device,
585 struct lod_device *lod = dt2lod_dev(dt);
586 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
589 return scnprintf(buf, PAGE_SIZE, "%d%%\n",
590 (ltd->ltd_qos.lq_prio_free * 100 + 255) >> 8);
593 static ssize_t mdt_qos_prio_free_show(struct kobject *kobj,
594 struct attribute *attr, char *buf)
596 return __qos_prio_free_show(kobj, attr, buf, true);
599 static ssize_t qos_prio_free_show(struct kobject *kobj,
600 struct attribute *attr, char *buf)
602 return __qos_prio_free_show(kobj, attr, buf, false);
606 * Set QoS free space priority parameter.
608 * Set the relative priority of free OST space compared to OST load when OSTs
609 * are space imbalanced. See qos_priofree_show() for description of
610 * this parameter. See qos_threshold_rr_store() and lq_threshold_rr to
611 * determine what constitutes "space imbalanced" OSTs.
613 static ssize_t __qos_prio_free_store(struct kobject *kobj,
614 struct attribute *attr,
615 const char *buffer, size_t count,
618 struct dt_device *dt = container_of(kobj, struct dt_device,
620 struct lod_device *lod = dt2lod_dev(dt);
621 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
627 /* "100%\n\0" should be largest string */
628 if (count >= sizeof(buf))
631 strncpy(buf, buffer, sizeof(buf));
632 buf[sizeof(buf) - 1] = '\0';
633 tmp = strchr(buf, '%');
637 rc = kstrtouint(buf, 0, &val);
644 ltd->ltd_qos.lq_prio_free = (val << 8) / 100;
645 set_bit(LQ_DIRTY, <d->ltd_qos.lq_flags);
646 set_bit(LQ_RESET, <d->ltd_qos.lq_flags);
651 static ssize_t mdt_qos_prio_free_store(struct kobject *kobj,
652 struct attribute *attr,
653 const char *buffer, size_t count)
655 return __qos_prio_free_store(kobj, attr, buffer, count, true);
658 static ssize_t qos_prio_free_store(struct kobject *kobj, struct attribute *attr,
659 const char *buffer, size_t count)
661 return __qos_prio_free_store(kobj, attr, buffer, count, false);
664 LUSTRE_RW_ATTR(mdt_qos_prio_free);
665 LUSTRE_RW_ATTR(qos_prio_free);
668 * Show threshold for "same space on all OSTs" rule.
670 static ssize_t __qos_threshold_rr_show(struct kobject *kobj,
671 struct attribute *attr, char *buf,
674 struct dt_device *dt = container_of(kobj, struct dt_device,
676 struct lod_device *lod = dt2lod_dev(dt);
677 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
680 return scnprintf(buf, PAGE_SIZE, "%d%%\n",
681 (ltd->ltd_qos.lq_threshold_rr * 100 +
682 (QOS_THRESHOLD_MAX - 1)) / QOS_THRESHOLD_MAX);
685 static ssize_t mdt_qos_threshold_rr_show(struct kobject *kobj,
686 struct attribute *attr, char *buf)
688 return __qos_threshold_rr_show(kobj, attr, buf, true);
691 static ssize_t qos_threshold_rr_show(struct kobject *kobj,
692 struct attribute *attr, char *buf)
694 return __qos_threshold_rr_show(kobj, attr, buf, false);
698 * Set threshold for "same space on all OSTs" rule.
700 * This sets the maximum percentage difference of free space between the most
701 * full and most empty OST in the currently available OSTs. If this percentage
702 * is exceeded, use the QoS allocator to select OSTs based on their available
703 * space so that more full OSTs are chosen less often, otherwise use the
704 * round-robin allocator for efficiency and performance.
706 static ssize_t __qos_threshold_rr_store(struct kobject *kobj,
707 struct attribute *attr,
708 const char *buffer, size_t count,
711 struct dt_device *dt = container_of(kobj, struct dt_device,
713 struct lod_device *lod = dt2lod_dev(dt);
714 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
720 /* "100%\n\0" should be largest string */
721 if (count >= sizeof(buf))
724 strncpy(buf, buffer, sizeof(buf));
725 buf[sizeof(buf) - 1] = '\0';
726 tmp = strchr(buf, '%');
730 rc = kstrtouint(buf, 0, &val);
736 ltd->ltd_qos.lq_threshold_rr = (val * QOS_THRESHOLD_MAX) / 100;
737 set_bit(LQ_DIRTY, <d->ltd_qos.lq_flags);
742 static ssize_t mdt_qos_threshold_rr_store(struct kobject *kobj,
743 struct attribute *attr,
744 const char *buffer, size_t count)
746 return __qos_threshold_rr_store(kobj, attr, buffer, count, true);
749 static ssize_t qos_threshold_rr_store(struct kobject *kobj,
750 struct attribute *attr,
751 const char *buffer, size_t count)
753 return __qos_threshold_rr_store(kobj, attr, buffer, count, false);
756 LUSTRE_RW_ATTR(mdt_qos_threshold_rr);
757 LUSTRE_RW_ATTR(qos_threshold_rr);
760 * Show expiration period used to refresh cached statfs data, which
761 * is used to implement QoS/RR striping allocation algorithm.
763 static ssize_t __qos_maxage_show(struct kobject *kobj, struct attribute *attr,
764 char *buf, bool is_mdt)
766 struct dt_device *dt = container_of(kobj, struct dt_device,
768 struct lod_device *lod = dt2lod_dev(dt);
769 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
772 return scnprintf(buf, PAGE_SIZE, "%u\n",
773 ltd->ltd_lov_desc.ld_qos_maxage);
776 static ssize_t mdt_qos_maxage_show(struct kobject *kobj, struct attribute *attr,
779 return __qos_maxage_show(kobj, attr, buf, true);
782 static ssize_t qos_maxage_show(struct kobject *kobj, struct attribute *attr,
785 return __qos_maxage_show(kobj, attr, buf, true);
789 * Set expiration period used to refresh cached statfs data.
791 static ssize_t __qos_maxage_store(struct kobject *kobj, struct attribute *attr,
792 const char *buffer, size_t count, bool is_mdt)
794 struct dt_device *dt = container_of(kobj, struct dt_device,
796 struct lod_device *lod = dt2lod_dev(dt);
797 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
799 struct lustre_cfg_bufs bufs;
800 struct lu_device *next;
801 struct lustre_cfg *lcfg;
803 struct lu_tgt_desc *tgt;
807 rc = kstrtouint(buffer, 0, &val);
814 ltd->ltd_lov_desc.ld_qos_maxage = val;
817 * propogate the value down to OSPs
819 lustre_cfg_bufs_reset(&bufs, NULL);
820 snprintf(str, 32, "%smaxage=%u", PARAM_OSP, val);
821 lustre_cfg_bufs_set_string(&bufs, 1, str);
822 OBD_ALLOC(lcfg, lustre_cfg_len(bufs.lcfg_bufcount, bufs.lcfg_buflen));
825 lustre_cfg_init(lcfg, LCFG_PARAM, &bufs);
828 ltd_foreach_tgt(ltd, tgt) {
829 next = &tgt->ltd_tgt->dd_lu_dev;
830 rc = next->ld_ops->ldo_process_config(NULL, next, lcfg);
832 CERROR("can't set maxage on #%d: %d\n",
835 lod_putref(lod, ltd);
836 OBD_FREE(lcfg, lustre_cfg_len(lcfg->lcfg_bufcount, lcfg->lcfg_buflens));
841 static ssize_t mdt_qos_maxage_store(struct kobject *kobj,
842 struct attribute *attr,
843 const char *buffer, size_t count)
845 return __qos_maxage_store(kobj, attr, buffer, count, true);
848 static ssize_t qos_maxage_store(struct kobject *kobj, struct attribute *attr,
849 const char *buffer, size_t count)
851 return __qos_maxage_store(kobj, attr, buffer, count, false);
854 LUSTRE_RW_ATTR(mdt_qos_maxage);
855 LUSTRE_RW_ATTR(qos_maxage);
857 static void *lod_tgts_seq_start(struct seq_file *p, loff_t *pos, bool is_mdt)
859 struct obd_device *obd = p->private;
860 struct lod_device *lod = lu2lod_dev(obd->obd_lu_dev);
861 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
864 LASSERT(obd != NULL);
866 lod_getref(ltd); /* released in lod_tgts_seq_stop */
867 if (*pos >= ltd->ltd_tgts_size)
870 *pos = find_next_bit(ltd->ltd_tgt_bitmap,
871 ltd->ltd_tgts_size, *pos);
872 if (*pos < ltd->ltd_tgts_size)
873 return LTD_TGT(ltd, *pos);
878 static void *lod_mdts_seq_start(struct seq_file *p, loff_t *pos)
880 return lod_tgts_seq_start(p, pos, true);
883 static void *lod_osts_seq_start(struct seq_file *p, loff_t *pos)
885 return lod_tgts_seq_start(p, pos, false);
888 static void lod_tgts_seq_stop(struct seq_file *p, void *v, bool is_mdt)
890 struct obd_device *obd = p->private;
891 struct lod_device *lod = lu2lod_dev(obd->obd_lu_dev);
892 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
895 LASSERT(obd != NULL);
896 lod_putref(lod, ltd);
899 static void lod_mdts_seq_stop(struct seq_file *p, void *v)
901 lod_tgts_seq_stop(p, v, true);
904 static void lod_osts_seq_stop(struct seq_file *p, void *v)
906 lod_tgts_seq_stop(p, v, false);
909 static void *lod_tgts_seq_next(struct seq_file *p, void *v, loff_t *pos,
912 struct obd_device *obd = p->private;
913 struct lod_device *lod = lu2lod_dev(obd->obd_lu_dev);
914 struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
918 if (*pos > ltd->ltd_tgts_size - 1)
921 *pos = find_next_bit(ltd->ltd_tgt_bitmap,
922 ltd->ltd_tgts_size, *pos);
923 if (*pos < ltd->ltd_tgts_size)
924 return LTD_TGT(ltd, *pos);
929 static void *lod_mdts_seq_next(struct seq_file *p, void *v, loff_t *pos)
931 return lod_tgts_seq_next(p, v, pos, true);
934 static void *lod_osts_seq_next(struct seq_file *p, void *v, loff_t *pos)
936 return lod_tgts_seq_next(p, v, pos, false);
940 * Show active/inactive status for OST found by lod_osts_seq_next().
942 * \param[in] m seq file
943 * \param[in] v unused for single entry
945 * \retval 0 on success
946 * \retval negative error code if failed
948 static int lod_tgts_seq_show(struct seq_file *p, void *v)
950 struct obd_device *obd = p->private;
951 struct lu_tgt_desc *tgt = v;
952 struct dt_device *next;
955 LASSERT(obd->obd_lu_dev);
961 /* XXX: should be non-NULL env, but it's very expensive */
963 rc = dt_statfs(NULL, next, &tgt->ltd_statfs);
964 if (rc == -ENOTCONN) {
970 seq_printf(p, "%d: %s %sACTIVE\n", tgt->ltd_index,
971 obd_uuid2str(&tgt->ltd_uuid),
976 static const struct seq_operations lod_mdts_sops = {
977 .start = lod_mdts_seq_start,
978 .stop = lod_mdts_seq_stop,
979 .next = lod_mdts_seq_next,
980 .show = lod_tgts_seq_show,
983 static const struct seq_operations lod_osts_sops = {
984 .start = lod_osts_seq_start,
985 .stop = lod_osts_seq_stop,
986 .next = lod_osts_seq_next,
987 .show = lod_tgts_seq_show,
990 static int lod_mdts_seq_open(struct inode *inode, struct file *file)
992 struct seq_file *seq;
995 rc = seq_open(file, &lod_mdts_sops);
999 seq = file->private_data;
1000 seq->private = pde_data(inode);
1004 static int lod_osts_seq_open(struct inode *inode, struct file *file)
1006 struct seq_file *seq;
1009 rc = seq_open(file, &lod_osts_sops);
1013 seq = file->private_data;
1014 seq->private = pde_data(inode);
1019 * Show whether special failout mode for testing is enabled or not.
1021 static ssize_t lmv_failout_show(struct kobject *kobj, struct attribute *attr,
1024 struct dt_device *dt = container_of(kobj, struct dt_device,
1026 struct lod_device *lod = dt2lod_dev(dt);
1028 return scnprintf(buf, PAGE_SIZE, "%d\n", lod->lod_lmv_failout ? 1 : 0);
1032 * Enable/disable a special failout mode for testing.
1034 * This determines whether the LMV will try to continue processing a striped
1035 * directory even if it has a (partly) corrupted entry in the master directory,
1036 * or if it will abort upon finding a corrupted slave directory entry.
1038 static ssize_t lmv_failout_store(struct kobject *kobj, struct attribute *attr,
1039 const char *buffer, size_t count)
1041 struct dt_device *dt = container_of(kobj, struct dt_device,
1043 struct lod_device *lod = dt2lod_dev(dt);
1047 rc = kstrtobool(buffer, &val);
1051 lod->lod_lmv_failout = val;
1055 LUSTRE_RW_ATTR(lmv_failout);
1057 static ssize_t mdt_hash_show(struct kobject *kobj, struct attribute *attr,
1060 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
1061 struct lod_device *lod = dt2lod_dev(dt);
1063 return scnprintf(buf, PAGE_SIZE, "%s\n",
1064 mdt_hash_name[lod->lod_mdt_descs.ltd_lmv_desc.ld_pattern]);
1067 static ssize_t mdt_hash_store(struct kobject *kobj, struct attribute *attr,
1068 const char *buffer, size_t count)
1070 struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
1071 struct lod_device *lod = dt2lod_dev(dt);
1077 hash = kstrndup(buffer, count, GFP_KERNEL);
1081 if (kstrtoint(hash, 10, &i) == 0 && lmv_is_known_hash_type(i)) {
1082 lod->lod_mdt_descs.ltd_lmv_desc.ld_pattern = i;
1083 GOTO(out, rc = count);
1086 len = strcspn(hash, "\n ");
1088 for (i = LMV_HASH_TYPE_ALL_CHARS; i < ARRAY_SIZE(mdt_hash_name); i++) {
1089 if (strcmp(hash, mdt_hash_name[i]) == 0) {
1090 lod->lod_mdt_descs.ltd_lmv_desc.ld_pattern = i;
1091 GOTO(out, rc = count);
1099 LUSTRE_RW_ATTR(mdt_hash);
1101 static ssize_t dist_txn_check_space_show(struct kobject *kobj,
1102 struct attribute *attr,
1105 struct dt_device *dt = container_of(kobj, struct dt_device,
1107 struct lod_device *lod = dt2lod_dev(dt);
1109 return scnprintf(buf, PAGE_SIZE, "%d\n", lod->lod_dist_txn_check_space);
1112 static ssize_t dist_txn_check_space_store(struct kobject *kobj,
1113 struct attribute *attr,
1114 const char *buffer, size_t count)
1116 struct dt_device *dt = container_of(kobj, struct dt_device,
1118 struct lod_device *lod = dt2lod_dev(dt);
1122 rc = kstrtobool(buffer, &val);
1126 lod->lod_dist_txn_check_space = val;
1130 LUSTRE_RW_ATTR(dist_txn_check_space);
1132 static const struct proc_ops lod_proc_mdt_fops = {
1133 PROC_OWNER(THIS_MODULE)
1134 .proc_open = lod_mdts_seq_open,
1135 .proc_read = seq_read,
1136 .proc_lseek = seq_lseek,
1137 .proc_release = lprocfs_seq_release,
1140 static int lod_spill_threshold_pct_seq_show(struct seq_file *m, void *v)
1142 struct pool_desc *pool = m->private;
1144 LASSERT(pool != NULL);
1145 seq_printf(m, "%d\n", pool->pool_spill_threshold_pct);
1151 lod_spill_threshold_pct_seq_write(struct file *file, const char __user *buffer,
1152 size_t count, loff_t *off)
1154 struct seq_file *m = file->private_data;
1155 struct pool_desc *pool = m->private;
1159 LASSERT(pool != NULL);
1161 rc = kstrtoint_from_user(buffer, count, 0, &val);
1165 if (val > 100 || val < 0)
1168 pool->pool_spill_threshold_pct = val;
1169 pool->pool_spill_expire = 0;
1170 if (pool->pool_spill_threshold_pct == 0) {
1171 pool->pool_spill_is_active = false;
1172 pool->pool_spill_target[0] = '\0';
1177 LPROC_SEQ_FOPS(lod_spill_threshold_pct);
1179 static int lod_spill_target_seq_show(struct seq_file *m, void *v)
1181 struct pool_desc *pool = m->private;
1183 LASSERT(pool != NULL);
1184 seq_printf(m, "%s\n", pool->pool_spill_target);
1189 static DEFINE_MUTEX(lod_spill_loop_mutex);
1191 static int lod_spill_check_loop(struct lod_device *lod,
1193 const char *destarg)
1195 char dest[LOV_MAXPOOLNAME + 1];
1196 struct pool_desc *tgt;
1199 strncpy(dest, destarg, sizeof(dest));
1202 * pool1 -> pool2 -> pool3 ++> pool1
1203 * pool1 -> pool2 ++>pool3 -> pool1
1206 tgt = lod_pool_find(lod, dest);
1208 /* no more steps, we're fine */
1212 strncpy(dest, tgt->pool_spill_target, sizeof(dest));
1213 lod_pool_putref(tgt);
1215 if (strcmp(dest, pool) == 0) {
1224 lod_spill_target_seq_write(struct file *file, const char __user *buffer,
1225 size_t count, loff_t *off)
1227 struct seq_file *m = file->private_data;
1228 struct pool_desc *pool = m->private;
1229 struct lod_device *lod;
1230 char tgt_name[LOV_MAXPOOLNAME + 1];
1234 LASSERT(pool != NULL);
1235 lod = lu2lod_dev(pool->pool_lobd->obd_lu_dev);
1238 pool->pool_spill_target[0] = '\0';
1239 pool->pool_spill_is_active = false;
1243 if (count > sizeof(tgt_name) - 1)
1245 if (copy_from_user(tgt_name, buffer, count))
1247 tgt_name[count] = '\0';
1249 if (strcmp(pool->pool_name, tgt_name) == 0)
1251 if (!lod_pool_exists(lod, tgt_name)) {
1252 pool->pool_spill_target[0] = '\0';
1253 pool->pool_spill_expire = 0;
1257 /* serialize all checks to protect against racing settings */
1258 mutex_lock(&lod_spill_loop_mutex);
1260 rc = lod_spill_check_loop(lod, pool->pool_name, tgt_name);
1262 strncpy(pool->pool_spill_target, tgt_name,
1263 sizeof(pool->pool_spill_target));
1267 mutex_unlock(&lod_spill_loop_mutex);
1271 LPROC_SEQ_FOPS(lod_spill_target);
1273 static int lod_spill_is_active_seq_show(struct seq_file *m, void *v)
1275 struct pool_desc *pool = m->private;
1276 struct lod_device *lod;
1283 rc = lu_env_init(&env, LCT_LOCAL);
1287 lod = lu2lod_dev(pool->pool_lobd->obd_lu_dev);
1288 lod_spill_target_refresh(&env, lod, pool);
1291 seq_printf(m, "%d\n", pool->pool_spill_is_active ? 1 : 0);
1295 LPROC_SEQ_FOPS_RO(lod_spill_is_active);
1297 static int lod_spill_hit_seq_show(struct seq_file *m, void *v)
1299 struct pool_desc *pool = m->private;
1301 LASSERT(pool != NULL);
1302 seq_printf(m, "%d\n", atomic_read(&pool->pool_spill_hit));
1305 LPROC_SEQ_FOPS_RO(lod_spill_hit);
1307 static int lod_spill_status_seq_show(struct seq_file *m, void *v)
1309 struct pool_desc *pool = m->private;
1310 __u64 avail_bytes = 0, total_bytes = 0;
1311 struct lu_tgt_pool *osts;
1312 struct lod_device *lod;
1319 rc = lu_env_init(&env, LCT_LOCAL);
1323 lod = lu2lod_dev(pool->pool_lobd->obd_lu_dev);
1325 osts = &(pool->pool_obds);
1326 for (i = 0; i < osts->op_count; i++) {
1327 int idx = osts->op_array[i];
1328 struct lod_tgt_desc *tgt;
1329 struct obd_statfs *sfs;
1331 if (!test_bit(idx, lod->lod_ost_bitmap))
1333 tgt = OST_TGT(lod, idx);
1334 if (tgt->ltd_active == 0)
1336 sfs = &tgt->ltd_statfs;
1338 avail_bytes += sfs->os_bavail * sfs->os_bsize;
1339 total_bytes += sfs->os_blocks * sfs->os_bsize;
1340 seq_printf(m, "%d: %llu %llu\n", idx,
1341 avail_bytes >> 10, total_bytes >> 10);
1343 seq_printf(m, "total: %llu\navail: %llu\nusage: %llu\nusage%%: %llu\n"
1344 "active: %s\nthreshold: %dexpire: %d\n",
1345 total_bytes >> 10, avail_bytes >> 10,
1346 (total_bytes - avail_bytes) >> 10,
1347 (total_bytes * pool->pool_spill_threshold_pct / 100) >> 10,
1348 pool->pool_spill_is_active ? "on" : "off",
1349 pool->pool_spill_threshold_pct,
1350 (int)(pool->pool_spill_expire - ktime_get_seconds()));
1355 LPROC_SEQ_FOPS_RO(lod_spill_status);
1357 struct lprocfs_vars lprocfs_lod_spill_vars[] = {
1358 { .name = "spill_threshold_pct",
1359 .fops = &lod_spill_threshold_pct_fops },
1360 { .name = "spill_target",
1361 .fops = &lod_spill_target_fops },
1362 { .name = "spill_is_active",
1363 .fops = &lod_spill_is_active_fops },
1364 { .name = "spill_hit",
1365 .fops = &lod_spill_hit_fops },
1366 { .name = "spill_status",
1367 .fops = &lod_spill_status_fops },
1371 static struct proc_ops lod_proc_target_fops = {
1372 PROC_OWNER(THIS_MODULE)
1373 .proc_open = lod_osts_seq_open,
1374 .proc_read = seq_read,
1375 .proc_lseek = seq_lseek,
1376 .proc_release = lprocfs_seq_release,
1379 static struct attribute *lod_attrs[] = {
1380 &lustre_attr_dom_stripesize.attr,
1381 &lustre_attr_dom_stripesize_max_kb.attr,
1382 &lustre_attr_dom_stripesize_cur_kb.attr,
1383 &lustre_attr_dom_threshold_free_mb.attr,
1384 &lustre_attr_stripesize.attr,
1385 &lustre_attr_stripeoffset.attr,
1386 &lustre_attr_stripecount.attr,
1387 &lustre_attr_max_stripecount.attr,
1388 &lustre_attr_max_mdt_stripecount.attr,
1389 &lustre_attr_stripetype.attr,
1390 &lustre_attr_activeobd.attr,
1391 &lustre_attr_desc_uuid.attr,
1392 &lustre_attr_lmv_failout.attr,
1393 &lustre_attr_numobd.attr,
1394 &lustre_attr_qos_maxage.attr,
1395 &lustre_attr_qos_prio_free.attr,
1396 &lustre_attr_qos_threshold_rr.attr,
1397 &lustre_attr_mdt_stripecount.attr,
1398 &lustre_attr_mdt_stripetype.attr,
1399 &lustre_attr_mdt_activeobd.attr,
1400 &lustre_attr_mdt_numobd.attr,
1401 &lustre_attr_mdt_qos_maxage.attr,
1402 &lustre_attr_mdt_qos_prio_free.attr,
1403 &lustre_attr_mdt_qos_threshold_rr.attr,
1404 &lustre_attr_mdt_hash.attr,
1405 &lustre_attr_dist_txn_check_space.attr,
1409 KOBJ_ATTRIBUTE_GROUPS(lod); /* creates lod_groups from lod_attrs */
1411 int lod_tgt_weights_seq_show(struct seq_file *m, struct lod_device *lod,
1412 struct lu_tgt_pool *tgts, bool is_mdt)
1416 if (!tgts->op_count)
1419 down_read(&tgts->op_rw_sem);
1420 for (i = 0; i < tgts->op_count; i++) {
1421 u32 *op_array = tgts->op_array;
1422 struct lod_tgt_desc *tgt = is_mdt ? MDT_TGT(lod, op_array[i]) :
1423 OST_TGT(lod, op_array[i]);
1424 struct lu_svr_qos *svr = tgt->ltd_qos.ltq_svr;
1426 seq_printf(m, "- { %s: %d, tgt_weight: %llu, tgt_penalty: %llu, tgt_penalty_per_obj: %llu, tgt_avail: %llu, tgt_last_used: %llu, svr_nid: %s, svr_bavail: %llu, svr_iavail: %llu, svr_penalty: %llu, svr_penalty_per_obj: %llu, svr_last_used: %llu }\n",
1427 is_mdt ? "mdt_idx" : "ost_idx", tgt->ltd_index,
1428 tgt->ltd_qos.ltq_weight,
1429 tgt->ltd_qos.ltq_penalty,
1430 tgt->ltd_qos.ltq_penalty_per_obj,
1431 tgt->ltd_qos.ltq_avail, tgt->ltd_qos.ltq_used,
1432 svr->lsq_uuid.uuid, svr->lsq_bavail, svr->lsq_iavail,
1433 svr->lsq_penalty, svr->lsq_penalty_per_obj,
1436 up_read(&tgts->op_rw_sem);
1441 int lod_tgt_weights_seq_write(struct seq_file *m, const char __user *buf,
1442 size_t count, struct lod_device *lod,
1443 struct lu_tgt_pool *tgts, bool is_mdt)
1447 if (!tgts->op_count)
1450 down_read(&tgts->op_rw_sem);
1451 down_write(&lod->lod_ost_descs.ltd_qos.lq_rw_sem);
1452 for (i = 0; i < tgts->op_count; i++) {
1453 u32 *op_array = tgts->op_array;
1454 struct lod_tgt_desc *tgt = is_mdt ? MDT_TGT(lod, op_array[i]) :
1455 OST_TGT(lod, op_array[i]);
1457 tgt->ltd_qos.ltq_weight = 0;
1458 tgt->ltd_qos.ltq_penalty = 0;
1459 tgt->ltd_qos.ltq_svr->lsq_penalty = 0;
1461 set_bit(LQ_DIRTY, &lod->lod_ost_descs.ltd_qos.lq_flags);
1462 up_write(&lod->lod_ost_descs.ltd_qos.lq_rw_sem);
1463 up_read(&tgts->op_rw_sem);
1468 static int lod_mdt_weights_seq_show(struct seq_file *m, void *data)
1470 struct lod_device *lod = m->private;
1471 struct lu_tgt_pool *tgts = &lod->lod_mdt_descs.ltd_tgt_pool;
1473 return lod_tgt_weights_seq_show(m, lod, tgts, true);
1477 lod_mdt_weights_seq_write(struct file *file, const char __user *buf,
1478 size_t count, loff_t *off)
1481 struct seq_file *m = file->private_data;
1482 struct lod_device *lod = m->private;
1483 struct lu_tgt_pool *tgts = &lod->lod_mdt_descs.ltd_tgt_pool;
1485 return lod_tgt_weights_seq_write(m, buf, count, lod, tgts, true);
1487 LDEBUGFS_SEQ_FOPS(lod_mdt_weights);
1489 static int lod_ost_weights_seq_show(struct seq_file *m, void *data)
1491 struct lod_device *lod = m->private;
1492 struct lu_tgt_pool *tgts = &lod->lod_ost_descs.ltd_tgt_pool;
1494 return lod_tgt_weights_seq_show(m, lod, tgts, false);
1498 lod_ost_weights_seq_write(struct file *file, const char __user *buf,
1499 size_t count, loff_t *off)
1501 struct seq_file *m = file->private_data;
1502 struct lod_device *lod = m->private;
1503 struct lu_tgt_pool *tgts = &lod->lod_ost_descs.ltd_tgt_pool;
1505 return lod_tgt_weights_seq_write(m, buf, count, lod, tgts, false);
1507 LDEBUGFS_SEQ_FOPS(lod_ost_weights);
1509 static struct ldebugfs_vars ldebugfs_lod_vars[] = {
1510 { .name = "qos_mdt_weights",
1511 .fops = &lod_mdt_weights_fops,
1512 .proc_mode = 0444 },
1513 { .name = "qos_ost_weights",
1514 .fops = &lod_ost_weights_fops,
1515 .proc_mode = 0444 },
1520 * Initialize procfs entries for LOD.
1522 * \param[in] lod LOD device
1524 * \retval 0 on success
1525 * \retval negative error code if failed
1527 int lod_procfs_init(struct lod_device *lod)
1529 struct obd_device *obd = lod2obd(lod);
1530 struct obd_type *type;
1531 struct kobject *lov;
1534 lod->lod_dt_dev.dd_ktype.default_groups = KOBJ_ATTR_GROUPS(lod);
1535 rc = dt_tunables_init(&lod->lod_dt_dev, obd->obd_type, obd->obd_name,
1538 CERROR("%s: failed to setup DT tunables: %d\n",
1543 obd->obd_proc_entry = lprocfs_register(obd->obd_name,
1544 obd->obd_type->typ_procroot,
1546 if (IS_ERR(obd->obd_proc_entry)) {
1547 rc = PTR_ERR(obd->obd_proc_entry);
1548 CERROR("%s: error %d setting up lprocfs\n",
1553 rc = lprocfs_seq_create(obd->obd_proc_entry, "mdt_obd",
1554 0444, &lod_proc_mdt_fops, obd);
1556 CWARN("%s: Error adding the target_obd file %d\n",
1561 rc = lprocfs_seq_create(obd->obd_proc_entry, "target_obd",
1562 0444, &lod_proc_target_fops, obd);
1564 CWARN("%s: Error adding the target_obd file %d\n",
1569 lod->lod_pool_proc_entry = lprocfs_register("pools",
1570 obd->obd_proc_entry,
1572 if (IS_ERR(lod->lod_pool_proc_entry)) {
1573 rc = PTR_ERR(lod->lod_pool_proc_entry);
1574 lod->lod_pool_proc_entry = NULL;
1575 CWARN("%s: Failed to create pools proc file: %d\n",
1580 lod->lod_spill_proc_entry = lprocfs_register("pool",
1581 obd->obd_proc_entry,
1583 if (IS_ERR(lod->lod_spill_proc_entry)) {
1584 rc = PTR_ERR(lod->lod_spill_proc_entry);
1585 lod->lod_spill_proc_entry = NULL;
1586 CWARN("%s: Failed to create pool proc file: %d\n",
1591 lov = kset_find_obj(lustre_kset, "lov");
1593 CERROR("%s: lov subsystem not found\n", obd->obd_name);
1594 GOTO(out, rc = -ENODEV);
1597 rc = sysfs_create_link(lov, &lod->lod_dt_dev.dd_kobj,
1600 CERROR("%s: failed to create LOV sysfs symlink\n",
1604 obd->obd_debugfs_entry = debugfs_create_dir(obd->obd_name,
1605 obd->obd_type->typ_debugfs_entry);
1608 ldebugfs_add_vars(obd->obd_debugfs_entry, ldebugfs_lod_vars, lod);
1610 lod->lod_debugfs = ldebugfs_add_symlink(obd->obd_name, "lov",
1611 "../lod/%s", obd->obd_name);
1612 if (!lod->lod_debugfs)
1613 CERROR("%s: failed to create LOV debugfs symlink\n",
1616 lod->lod_pool_debugfs = debugfs_create_dir("pool",
1617 obd->obd_debugfs_entry);
1619 type = container_of(lov, struct obd_type, typ_kobj);
1620 if (!type->typ_procroot)
1623 /* for compatibility we link old procfs's LOV entries to lod ones */
1624 lod->lod_symlink = lprocfs_add_symlink(obd->obd_name,
1626 "../lod/%s", obd->obd_name);
1627 if (lod->lod_symlink == NULL)
1628 CERROR("cannot create LOV symlink for /proc/fs/lustre/lod/%s\n",
1633 dt_tunables_fini(&lod->lod_dt_dev);
1639 * Cleanup procfs entries registred for LOD.
1641 * \param[in] lod LOD device
1643 void lod_procfs_fini(struct lod_device *lod)
1645 struct obd_device *obd = lod2obd(lod);
1646 struct kobject *lov;
1648 if (lod->lod_symlink != NULL) {
1649 lprocfs_remove(&lod->lod_symlink);
1650 lod->lod_symlink = NULL;
1653 lov = kset_find_obj(lustre_kset, "lov");
1655 sysfs_remove_link(lov, obd->obd_name);
1659 debugfs_remove_recursive(lod->lod_pool_debugfs);
1660 debugfs_remove_recursive(lod->lod_debugfs);
1661 debugfs_remove_recursive(obd->obd_debugfs_entry);
1663 if (obd->obd_proc_entry) {
1664 lprocfs_remove(&obd->obd_proc_entry);
1665 obd->obd_proc_entry = NULL;
1668 dt_tunables_fini(&lod->lod_dt_dev);
1671 #endif /* CONFIG_PROC_FS */