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) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2011, 2017, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
32 * lustre/mdt/mdt_lproc.c
34 * Author: Lai Siyao <lsy@clusterfs.com>
35 * Author: Fan Yong <fanyong@clusterfs.com>
38 #define DEBUG_SUBSYSTEM S_MDS
40 #include <linux/version.h>
41 #include <asm/statfs.h>
43 #include <linux/module.h>
44 #include <uapi/linux/lnet/nidstr.h>
45 /* LUSTRE_VERSION_CODE */
46 #include <uapi/linux/lustre/lustre_ver.h>
48 * struct OBD_{ALLOC,FREE}*()
51 #include <obd_support.h>
52 /* struct obd_export */
53 #include <lustre_export.h>
54 /* struct obd_device */
56 #include <obd_class.h>
57 #include <lustre_mds.h>
58 #include <lprocfs_status.h>
59 #include "mdt_internal.h"
62 * The rename stats output would be YAML formats, like
64 * - snapshot_time: 1234567890.123456
66 * 4kB: { samples: 1230, pct: 33, cum_pct: 45 }
67 * 8kB: { samples: 1242, pct: 33, cum_pct: 78 }
68 * 16kB: { samples: 132, pct: 3, cum_pct: 81 }
70 * 4kB: { samples: 123, pct: 33, cum_pct: 45 }
71 * 8kB: { samples: 124, pct: 33, cum_pct: 78 }
72 * 16kB: { samples: 12, pct: 3, cum_pct: 81 }
74 * 4kB: { samples: 123, pct: 33, cum_pct: 45 }
75 * 8kB: { samples: 124, pct: 33, cum_pct: 78 }
76 * 16kB: { samples: 12, pct: 3, cum_pct: 81 }
79 static void display_rename_stats(struct seq_file *seq, char *name,
80 struct obd_histogram *hist)
82 unsigned long tot, t, cum = 0;
85 tot = lprocfs_oh_sum(hist);
87 seq_printf(seq, "- %-15s\n", name);
88 /* dir size start from 4K, start i from 10(2^10) here */
89 for (i = 0; i < OBD_HIST_MAX; i++) {
90 t = hist->oh_buckets[i];
96 seq_printf(seq, "%6s%d%s", " ", 1<< i, "bytes:");
98 seq_printf(seq, "%6s%d%s", " ", 1<<(i-10), "KB:");
100 seq_printf(seq, "%6s%d%s", " ", 1<<(i-20), "MB:");
102 seq_printf(seq, " { sample: %3lu, pct: %3u, cum_pct: %3u }\n",
103 t, pct(t, tot), pct(cum, tot));
110 static void rename_stats_show(struct seq_file *seq,
111 struct rename_stats *rename_stats)
113 struct timespec64 now;
115 /* this sampling races with updates */
116 ktime_get_real_ts64(&now);
117 seq_printf(seq, "rename_stats:\n");
118 seq_printf(seq, "- %-15s %llu.%9lu\n", "snapshot_time:",
119 (s64)now.tv_sec, now.tv_nsec);
121 display_rename_stats(seq, "same_dir",
122 &rename_stats->hist[RENAME_SAMEDIR_SIZE]);
123 display_rename_stats(seq, "crossdir_src",
124 &rename_stats->hist[RENAME_CROSSDIR_SRC_SIZE]);
125 display_rename_stats(seq, "crossdir_tgt",
126 &rename_stats->hist[RENAME_CROSSDIR_TGT_SIZE]);
129 static int mdt_rename_stats_seq_show(struct seq_file *seq, void *v)
131 struct mdt_device *mdt = seq->private;
133 rename_stats_show(seq, &mdt->mdt_rename_stats);
139 mdt_rename_stats_seq_write(struct file *file, const char __user *buf,
140 size_t len, loff_t *off)
142 struct seq_file *seq = file->private_data;
143 struct mdt_device *mdt = seq->private;
146 for (i = 0; i < RENAME_LAST; i++)
147 lprocfs_oh_clear(&mdt->mdt_rename_stats.hist[i]);
151 LPROC_SEQ_FOPS(mdt_rename_stats);
153 static int lproc_mdt_attach_rename_seqstat(struct mdt_device *mdt)
157 for (i = 0; i < RENAME_LAST; i++)
158 spin_lock_init(&mdt->mdt_rename_stats.hist[i].oh_lock);
160 return lprocfs_obd_seq_create(mdt2obd_dev(mdt), "rename_stats", 0644,
161 &mdt_rename_stats_fops, mdt);
164 void mdt_rename_counter_tally(struct mdt_thread_info *info,
165 struct mdt_device *mdt,
166 struct ptlrpc_request *req,
167 struct mdt_object *src,
168 struct mdt_object *tgt, long count)
170 struct md_attr *ma = &info->mti_attr;
171 struct rename_stats *rstats = &mdt->mdt_rename_stats;
174 ma->ma_need = MA_INODE;
176 rc = mo_attr_get(info->mti_env, mdt_object_child(src), ma);
178 CERROR("%s: "DFID" attr_get, rc = %d\n",
179 mdt_obd_name(mdt), PFID(mdt_object_fid(src)), rc);
184 mdt_counter_incr(req, LPROC_MDT_SAMEDIR_RENAME, count);
185 lprocfs_oh_tally_log2(&rstats->hist[RENAME_SAMEDIR_SIZE],
186 (unsigned int)ma->ma_attr.la_size);
190 mdt_counter_incr(req, LPROC_MDT_CROSSDIR_RENAME, count);
191 lprocfs_oh_tally_log2(&rstats->hist[RENAME_CROSSDIR_SRC_SIZE],
192 (unsigned int)ma->ma_attr.la_size);
194 ma->ma_need = MA_INODE;
196 rc = mo_attr_get(info->mti_env, mdt_object_child(tgt), ma);
198 CERROR("%s: "DFID" attr_get, rc = %d\n",
199 mdt_obd_name(mdt), PFID(mdt_object_fid(tgt)), rc);
203 lprocfs_oh_tally_log2(&rstats->hist[RENAME_CROSSDIR_TGT_SIZE],
204 (unsigned int)ma->ma_attr.la_size);
207 static ssize_t identity_expire_show(struct kobject *kobj,
208 struct attribute *attr, char *buf)
210 struct obd_device *obd = container_of(kobj, struct obd_device,
212 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
214 return scnprintf(buf, PAGE_SIZE, "%lld\n",
215 mdt->mdt_identity_cache->uc_entry_expire);
218 static ssize_t identity_expire_store(struct kobject *kobj,
219 struct attribute *attr,
220 const char *buffer, size_t count)
222 struct obd_device *obd = container_of(kobj, struct obd_device,
224 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
228 rc = kstrtoll(buffer, 10, &val);
235 mdt->mdt_identity_cache->uc_entry_expire = val;
239 LUSTRE_RW_ATTR(identity_expire);
241 static ssize_t identity_acquire_expire_show(struct kobject *kobj,
242 struct attribute *attr, char *buf)
244 struct obd_device *obd = container_of(kobj, struct obd_device,
246 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
248 return scnprintf(buf, PAGE_SIZE, "%lld\n",
249 mdt->mdt_identity_cache->uc_acquire_expire);
252 static ssize_t identity_acquire_expire_store(struct kobject *kobj,
253 struct attribute *attr,
254 const char *buffer, size_t count)
256 struct obd_device *obd = container_of(kobj, struct obd_device,
258 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
262 rc = kstrtoll(buffer, 0, &val);
266 if (val < 0 || val > INT_MAX)
269 mdt->mdt_identity_cache->uc_acquire_expire = val;
273 LUSTRE_RW_ATTR(identity_acquire_expire);
275 static ssize_t identity_upcall_show(struct kobject *kobj,
276 struct attribute *attr, char *buf)
278 struct obd_device *obd = container_of(kobj, struct obd_device,
280 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
281 struct upcall_cache *hash = mdt->mdt_identity_cache;
284 down_read(&hash->uc_upcall_rwsem);
285 rc = scnprintf(buf, PAGE_SIZE, "%s\n", hash->uc_upcall);
286 up_read(&hash->uc_upcall_rwsem);
290 static ssize_t identity_upcall_store(struct kobject *kobj,
291 struct attribute *attr,
292 const char *buffer, size_t count)
294 struct obd_device *obd = container_of(kobj, struct obd_device,
296 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
297 struct upcall_cache *hash = mdt->mdt_identity_cache;
299 if (count >= UC_CACHE_UPCALL_MAXPATH) {
300 CERROR("%s: identity upcall too long\n", mdt_obd_name(mdt));
304 /* Remove any extraneous bits from the upcall (e.g. linefeeds) */
305 down_write(&hash->uc_upcall_rwsem);
306 sscanf(buffer, "%s", hash->uc_upcall);
307 up_write(&hash->uc_upcall_rwsem);
309 if (strcmp(hash->uc_name, mdt_obd_name(mdt)) != 0)
310 CWARN("%s: write to upcall name %s\n",
311 mdt_obd_name(mdt), hash->uc_upcall);
313 if (strcmp(hash->uc_upcall, "NONE") == 0 && mdt->mdt_opts.mo_acl)
314 CWARN("%s: disable \"identity_upcall\" with ACL enabled maybe "
315 "cause unexpected \"EACCESS\"\n", mdt_obd_name(mdt));
317 CDEBUG(D_CONFIG, "%s: identity upcall set to %s\n", mdt_obd_name(mdt),
321 LUSTRE_RW_ATTR(identity_upcall);
323 static ssize_t identity_flush_store(struct kobject *kobj,
324 struct attribute *attr,
325 const char *buffer, size_t count)
327 struct obd_device *obd = container_of(kobj, struct obd_device,
329 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
333 rc = kstrtoint(buffer, 0, &uid);
337 mdt_flush_identity(mdt->mdt_identity_cache, uid);
340 LUSTRE_WO_ATTR(identity_flush);
343 lprocfs_identity_info_seq_write(struct file *file, const char __user *buffer,
344 size_t count, void *data)
346 struct seq_file *m = file->private_data;
347 struct obd_device *obd = m->private;
348 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
349 struct identity_downcall_data *param;
350 int size = sizeof(*param), rc, checked = 0;
354 CERROR("%s: invalid data count = %lu, size = %d\n",
355 mdt_obd_name(mdt), (unsigned long) count, size);
359 OBD_ALLOC(param, size);
363 if (copy_from_user(param, buffer, size)) {
364 CERROR("%s: bad identity data\n", mdt_obd_name(mdt));
365 GOTO(out, rc = -EFAULT);
370 if (param->idd_magic != IDENTITY_DOWNCALL_MAGIC) {
371 CERROR("%s: MDS identity downcall bad params\n",
373 GOTO(out, rc = -EINVAL);
376 if (param->idd_nperms > N_PERMS_MAX) {
377 CERROR("%s: perm count %d more than maximum %d\n",
378 mdt_obd_name(mdt), param->idd_nperms,
380 GOTO(out, rc = -EINVAL);
383 if (param->idd_ngroups > NGROUPS_MAX) {
384 CERROR("%s: group count %d more than maximum %d\n",
385 mdt_obd_name(mdt), param->idd_ngroups,
387 GOTO(out, rc = -EINVAL);
390 if (param->idd_ngroups) {
391 rc = param->idd_ngroups; /* save idd_ngroups */
392 OBD_FREE(param, size);
393 size = offsetof(struct identity_downcall_data,
399 rc = upcall_cache_downcall(mdt->mdt_identity_cache, param->idd_err,
400 param->idd_uid, param);
404 OBD_FREE(param, size);
406 return rc ? rc : count;
408 LPROC_SEQ_FOPS_WR_ONLY(mdt, identity_info);
410 static int mdt_site_stats_seq_show(struct seq_file *m, void *data)
412 struct obd_device *obd = m->private;
413 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
415 return lu_site_stats_seq_print(mdt_lu_site(mdt), m);
417 LPROC_SEQ_FOPS_RO(mdt_site_stats);
419 #define BUFLEN (UUID_MAX + 4)
422 lprocfs_mds_evict_client_seq_write(struct file *file, const char __user *buf,
423 size_t count, loff_t *off)
425 struct seq_file *m = file->private_data;
426 struct obd_device *obd = m->private;
427 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
432 OBD_ALLOC(kbuf, BUFLEN);
437 * OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1
438 * bytes into kbuf, to ensure that the string is NUL-terminated.
439 * UUID_MAX should include a trailing NUL already.
441 if (copy_from_user(kbuf, buf, min_t(unsigned long, BUFLEN - 1, count)))
442 GOTO(out, rc = -EFAULT);
443 tmpbuf = skip_spaces(kbuf);
444 tmpbuf = strsep(&tmpbuf, " \t\n\f\v\r");
446 if (strncmp(tmpbuf, "nid:", 4) != 0) {
447 count = lprocfs_evict_client_seq_write(file, buf, count, off);
451 if (mdt->mdt_opts.mo_evict_tgt_nids) {
452 rc = obd_set_info_async(NULL, mdt->mdt_child_exp,
453 sizeof(KEY_EVICT_BY_NID),
455 strlen(tmpbuf + 4) + 1,
458 CERROR("Failed to evict nid %s from OSTs: rc %d\n",
462 /* See the comments in function lprocfs_wr_evict_client()
463 * in ptlrpc/lproc_ptlrpc.c for details. - jay */
464 class_incref(obd, __func__, current);
465 obd_export_evict_by_nid(obd, tmpbuf + 4);
466 class_decref(obd, __func__, current);
470 OBD_FREE(kbuf, BUFLEN);
471 return rc < 0 ? rc : count;
476 static ssize_t evict_tgt_nids_show(struct kobject *kobj,
477 struct attribute *attr, char *buf)
479 struct obd_device *obd = container_of(kobj, struct obd_device,
481 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
483 return scnprintf(buf, PAGE_SIZE, "%u\n",
484 mdt->mdt_opts.mo_evict_tgt_nids);
487 static ssize_t evict_tgt_nids_store(struct kobject *kobj,
488 struct attribute *attr, const char *buffer,
491 struct obd_device *obd = container_of(kobj, struct obd_device,
493 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
497 rc = kstrtobool(buffer, &val);
501 mdt->mdt_opts.mo_evict_tgt_nids = val;
504 LUSTRE_RW_ATTR(evict_tgt_nids);
506 static ssize_t commit_on_sharing_show(struct kobject *kobj,
507 struct attribute *attr, char *buf)
509 struct obd_device *obd = container_of(kobj, struct obd_device,
511 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
513 return scnprintf(buf, PAGE_SIZE, "%u\n", mdt_cos_is_enabled(mdt));
516 static ssize_t commit_on_sharing_store(struct kobject *kobj,
517 struct attribute *attr,
518 const char *buffer, size_t count)
520 struct obd_device *obd = container_of(kobj, struct obd_device,
522 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
526 rc = kstrtobool(buffer, &val);
530 mdt_enable_cos(mdt, val);
533 LUSTRE_RW_ATTR(commit_on_sharing);
535 static ssize_t local_recovery_show(struct kobject *kobj,
536 struct attribute *attr, char *buf)
538 struct obd_device *obd = container_of(kobj, struct obd_device,
541 return scnprintf(buf, PAGE_SIZE, "%u\n",
542 obd->u.obt.obt_lut->lut_local_recovery);
545 static ssize_t local_recovery_store(struct kobject *kobj,
546 struct attribute *attr,
547 const char *buffer, size_t count)
549 struct obd_device *obd = container_of(kobj, struct obd_device,
554 rc = kstrtobool(buffer, &val);
558 obd->u.obt.obt_lut->lut_local_recovery = !!val;
561 LUSTRE_RW_ATTR(local_recovery);
563 static int mdt_root_squash_seq_show(struct seq_file *m, void *data)
565 struct obd_device *obd = m->private;
566 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
567 struct root_squash_info *squash = &mdt->mdt_squash;
569 seq_printf(m, "%u:%u\n", squash->rsi_uid,
575 mdt_root_squash_seq_write(struct file *file, const char __user *buffer,
576 size_t count, loff_t *off)
578 struct seq_file *m = file->private_data;
579 struct obd_device *obd = m->private;
580 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
581 struct root_squash_info *squash = &mdt->mdt_squash;
583 return lprocfs_wr_root_squash(buffer, count, squash,
586 LPROC_SEQ_FOPS(mdt_root_squash);
588 static int mdt_nosquash_nids_seq_show(struct seq_file *m, void *data)
590 struct obd_device *obd = m->private;
591 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
592 struct root_squash_info *squash = &mdt->mdt_squash;
595 spin_lock(&squash->rsi_lock);
596 if (!list_empty(&squash->rsi_nosquash_nids)) {
597 len = cfs_print_nidlist(m->buf + m->count, m->size - m->count,
598 &squash->rsi_nosquash_nids);
602 seq_puts(m, "NONE\n");
603 spin_unlock(&squash->rsi_lock);
609 mdt_nosquash_nids_seq_write(struct file *file, const char __user *buffer,
610 size_t count, loff_t *off)
612 struct seq_file *m = file->private_data;
613 struct obd_device *obd = m->private;
614 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
615 struct root_squash_info *squash = &mdt->mdt_squash;
617 return lprocfs_wr_nosquash_nids(buffer, count, squash,
620 LPROC_SEQ_FOPS(mdt_nosquash_nids);
622 static ssize_t enable_remote_dir_show(struct kobject *kobj,
623 struct attribute *attr, char *buf)
625 struct obd_device *obd = container_of(kobj, struct obd_device,
627 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
629 return scnprintf(buf, PAGE_SIZE, "%u\n", mdt->mdt_enable_remote_dir);
632 static ssize_t enable_remote_dir_store(struct kobject *kobj,
633 struct attribute *attr,
634 const char *buffer, size_t count)
636 struct obd_device *obd = container_of(kobj, struct obd_device,
638 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
642 rc = kstrtobool(buffer, &val);
646 mdt->mdt_enable_remote_dir = val;
649 LUSTRE_RW_ATTR(enable_remote_dir);
651 static ssize_t enable_remote_dir_gid_show(struct kobject *kobj,
652 struct attribute *attr, char *buf)
654 struct obd_device *obd = container_of(kobj, struct obd_device,
656 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
658 return scnprintf(buf, PAGE_SIZE, "%d\n",
659 (int)mdt->mdt_enable_remote_dir_gid);
662 static ssize_t enable_remote_dir_gid_store(struct kobject *kobj,
663 struct attribute *attr,
664 const char *buffer, size_t count)
666 struct obd_device *obd = container_of(kobj, struct obd_device,
668 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
672 rc = kstrtoint(buffer, 0, &val);
676 mdt->mdt_enable_remote_dir_gid = val;
679 LUSTRE_RW_ATTR(enable_remote_dir_gid);
681 static ssize_t enable_chprojid_gid_show(struct kobject *kobj,
682 struct attribute *attr, char *buf)
684 struct obd_device *obd = container_of(kobj, struct obd_device,
686 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
688 return scnprintf(buf, PAGE_SIZE, "%d\n",
689 (int)mdt->mdt_enable_chprojid_gid);
692 static ssize_t enable_chprojid_gid_store(struct kobject *kobj,
693 struct attribute *attr,
694 const char *buffer, size_t count)
696 struct obd_device *obd = container_of(kobj, struct obd_device,
698 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
702 rc = kstrtoint(buffer, 0, &val);
706 mdt->mdt_enable_chprojid_gid = val;
709 LUSTRE_RW_ATTR(enable_chprojid_gid);
711 static ssize_t enable_striped_dir_show(struct kobject *kobj,
712 struct attribute *attr, char *buf)
714 struct obd_device *obd = container_of(kobj, struct obd_device,
716 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
718 return scnprintf(buf, PAGE_SIZE, "%u\n", mdt->mdt_enable_striped_dir);
721 static ssize_t enable_striped_dir_store(struct kobject *kobj,
722 struct attribute *attr,
723 const char *buffer, size_t count)
725 struct obd_device *obd = container_of(kobj, struct obd_device,
727 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
731 rc = kstrtobool(buffer, &val);
735 mdt->mdt_enable_striped_dir = val;
738 LUSTRE_RW_ATTR(enable_striped_dir);
740 static ssize_t enable_dir_migration_show(struct kobject *kobj,
741 struct attribute *attr, char *buf)
743 struct obd_device *obd = container_of(kobj, struct obd_device,
745 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
747 return scnprintf(buf, PAGE_SIZE, "%u\n", mdt->mdt_enable_dir_migration);
750 static ssize_t enable_dir_migration_store(struct kobject *kobj,
751 struct attribute *attr,
752 const char *buffer, size_t count)
754 struct obd_device *obd = container_of(kobj, struct obd_device,
756 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
760 rc = kstrtobool(buffer, &val);
764 mdt->mdt_enable_dir_migration = val;
767 LUSTRE_RW_ATTR(enable_dir_migration);
769 static ssize_t enable_dir_restripe_show(struct kobject *kobj,
770 struct attribute *attr, char *buf)
772 struct obd_device *obd = container_of(kobj, struct obd_device,
774 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
776 return scnprintf(buf, PAGE_SIZE, "%u\n", mdt->mdt_enable_dir_restripe);
779 static ssize_t enable_dir_restripe_store(struct kobject *kobj,
780 struct attribute *attr,
781 const char *buffer, size_t count)
783 struct obd_device *obd = container_of(kobj, struct obd_device,
785 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
789 rc = kstrtobool(buffer, &val);
793 mdt->mdt_enable_dir_restripe = val;
796 LUSTRE_RW_ATTR(enable_dir_restripe);
798 static ssize_t enable_dir_auto_split_show(struct kobject *kobj,
799 struct attribute *attr, char *buf)
801 struct obd_device *obd = container_of(kobj, struct obd_device,
803 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
805 return scnprintf(buf, PAGE_SIZE, "%u\n",
806 mdt->mdt_enable_dir_auto_split);
809 static ssize_t enable_dir_auto_split_store(struct kobject *kobj,
810 struct attribute *attr,
811 const char *buffer, size_t count)
813 struct obd_device *obd = container_of(kobj, struct obd_device,
815 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
819 rc = kstrtobool(buffer, &val);
823 mdt->mdt_enable_dir_auto_split = val;
826 LUSTRE_RW_ATTR(enable_dir_auto_split);
829 * Show MDT async commit count.
832 * @data unused for single entry
834 * Return: 0 on success
835 * negative value on error
837 static ssize_t async_commit_count_show(struct kobject *kobj,
838 struct attribute *attr, char *buf)
840 struct obd_device *obd = container_of(kobj, struct obd_device,
842 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
844 return scnprintf(buf, PAGE_SIZE, "%d\n",
845 atomic_read(&mdt->mdt_async_commit_count));
848 static ssize_t async_commit_count_store(struct kobject *kobj,
849 struct attribute *attr,
850 const char *buffer, size_t count)
852 struct obd_device *obd = container_of(kobj, struct obd_device,
854 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
858 rc = kstrtoint(buffer, 10, &val);
862 atomic_set(&mdt->mdt_async_commit_count, val);
866 LUSTRE_RW_ATTR(async_commit_count);
869 * Show MDT sync count.
871 * \param[in] m seq_file handle
872 * \param[in] data unused for single entry
874 * \retval 0 on success
875 * \retval negative value on error
877 static ssize_t sync_count_show(struct kobject *kobj, struct attribute *attr,
880 struct obd_device *obd = container_of(kobj, struct obd_device,
882 struct lu_target *tgt = obd->u.obt.obt_lut;
884 return scnprintf(buf, PAGE_SIZE, "%d\n",
885 atomic_read(&tgt->lut_sync_count));
888 static ssize_t sync_count_store(struct kobject *kobj, struct attribute *attr,
889 const char *buffer, size_t count)
891 struct obd_device *obd = container_of(kobj, struct obd_device,
893 struct lu_target *tgt = obd->u.obt.obt_lut;
897 rc = kstrtoint(buffer, 0, &val);
901 atomic_set(&tgt->lut_sync_count, val);
905 LUSTRE_RW_ATTR(sync_count);
907 static const char *dom_open_lock_modes[NUM_DOM_LOCK_ON_OPEN_MODES] = {
908 [NO_DOM_LOCK_ON_OPEN] = "never",
909 [TRYLOCK_DOM_ON_OPEN] = "trylock",
910 [ALWAYS_DOM_LOCK_ON_OPEN] = "always",
913 /* This must be longer than the longest string above */
914 #define DOM_LOCK_MODES_MAXLEN 16
917 * Show MDT policy for data prefetch on open for DoM files..
919 * \param[in] m seq_file handle
920 * \param[in] data unused
922 * \retval 0 on success
923 * \retval negative value on error
925 static ssize_t dom_lock_show(struct kobject *kobj, struct attribute *attr,
928 struct obd_device *obd = container_of(kobj, struct obd_device,
930 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
932 return scnprintf(buf, PAGE_SIZE, "%s\n",
933 dom_open_lock_modes[mdt->mdt_opts.mo_dom_lock]);
937 * Change MDT policy for data prefetch on open for DoM files.
939 * This variable defines how DOM lock is taken at open enqueue.
940 * There are three possible modes:
941 * 1) never - never take DoM lock on open. DoM lock will be taken as separate
942 * IO lock with own enqueue.
943 * 2) trylock - DoM lock will be taken only if non-blocked.
944 * 3) always - DoM lock will be taken always even if it is blocking lock.
946 * If dom_read_open is enabled too then DoM lock is taken in PR mode and
947 * is paired with LAYOUT lock when possible.
949 * \param[in] file proc file
950 * \param[in] buffer string which represents policy
951 * \param[in] count \a buffer length
952 * \param[in] off unused for single entry
954 * \retval \a count on success
955 * \retval negative number on error
957 static ssize_t dom_lock_store(struct kobject *kobj, struct attribute *attr,
958 const char *buffer, size_t count)
960 struct obd_device *obd = container_of(kobj, struct obd_device,
962 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
966 if (count == 0 || count >= DOM_LOCK_MODES_MAXLEN)
969 for (i = 0 ; i < NUM_DOM_LOCK_ON_OPEN_MODES; i++) {
970 /* buffer might have '\n' but using strlen() avoids it */
971 if (strncmp(buffer, dom_open_lock_modes[i],
972 strlen(dom_open_lock_modes[i])) == 0) {
978 /* Legacy numeric codes */
980 rc = kstrtoint(buffer, 0, &val);
985 if (val == ALWAYS_DOM_LOCK_ON_OPEN)
986 val = TRYLOCK_DOM_ON_OPEN;
988 if (val < 0 || val >= NUM_DOM_LOCK_ON_OPEN_MODES)
991 mdt->mdt_opts.mo_dom_lock = val;
994 LUSTRE_RW_ATTR(dom_lock);
997 * Show MDT policy for data prefetch on open for DoM files..
999 * \param[in] m seq_file handle
1000 * \param[in] data unused
1002 * \retval 0 on success
1003 * \retval negative value on error
1005 static ssize_t dom_read_open_show(struct kobject *kobj,
1006 struct attribute *attr, char *buf)
1008 struct obd_device *obd = container_of(kobj, struct obd_device,
1010 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1012 return scnprintf(buf, PAGE_SIZE, "%u\n",
1013 !!mdt->mdt_opts.mo_dom_read_open);
1017 * Modify MDT policy for data prefetch on open for DoM files.
1019 * If enabled then Data-on-MDT file data may be read during open and
1020 * returned back in reply. It works only with mo_dom_lock enabled.
1022 * \param[in] file proc file
1023 * \param[in] buffer string which represents policy
1024 * \param[in] count \a buffer length
1025 * \param[in] off unused for single entry
1027 * \retval \a count on success
1028 * \retval negative number on error
1030 static ssize_t dom_read_open_store(struct kobject *kobj,
1031 struct attribute *attr, const char *buffer,
1034 struct obd_device *obd = container_of(kobj, struct obd_device,
1036 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1040 rc = kstrtobool(buffer, &val);
1044 mdt->mdt_opts.mo_dom_read_open = !!val;
1047 LUSTRE_RW_ATTR(dom_read_open);
1049 static ssize_t migrate_hsm_allowed_show(struct kobject *kobj,
1050 struct attribute *attr, char *buf)
1052 struct obd_device *obd = container_of(kobj, struct obd_device,
1054 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1056 return scnprintf(buf, PAGE_SIZE, "%u\n",
1057 mdt->mdt_opts.mo_migrate_hsm_allowed);
1060 static ssize_t migrate_hsm_allowed_store(struct kobject *kobj,
1061 struct attribute *attr,
1062 const char *buffer, size_t count)
1064 struct obd_device *obd = container_of(kobj, struct obd_device,
1066 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1070 rc = kstrtobool(buffer, &val);
1074 mdt->mdt_opts.mo_migrate_hsm_allowed = val;
1077 LUSTRE_RW_ATTR(migrate_hsm_allowed);
1079 static ssize_t readonly_show(struct kobject *kobj, struct attribute *attr,
1082 struct obd_device *obd = container_of(kobj, struct obd_device,
1084 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1086 return scnprintf(buf, PAGE_SIZE, "%u\n", mdt->mdt_readonly);
1089 static ssize_t readonly_store(struct kobject *kobj, struct attribute *attr,
1090 const char *buffer, size_t count)
1092 struct obd_device *obd = container_of(kobj, struct obd_device,
1094 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1098 rc = kstrtobool(buffer, &val);
1102 mdt->mdt_readonly = val;
1105 LUSTRE_RW_ATTR(readonly);
1107 static ssize_t enable_remote_rename_show(struct kobject *kobj,
1108 struct attribute *attr,
1111 struct obd_device *obd = container_of(kobj, struct obd_device,
1113 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1115 return scnprintf(buf, PAGE_SIZE, "%u\n",
1116 mdt->mdt_enable_remote_rename);
1119 static ssize_t enable_remote_rename_store(struct kobject *kobj,
1120 struct attribute *attr,
1121 const char *buffer, size_t count)
1123 struct obd_device *obd = container_of(kobj, struct obd_device,
1125 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1129 rc = kstrtobool(buffer, &val);
1133 mdt->mdt_enable_remote_rename = val;
1136 LUSTRE_RW_ATTR(enable_remote_rename);
1138 static ssize_t dir_split_count_show(struct kobject *kobj,
1139 struct attribute *attr,
1142 struct obd_device *obd = container_of(kobj, struct obd_device,
1144 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1146 return scnprintf(buf, PAGE_SIZE, "%llu\n",
1147 mdt->mdt_restriper.mdr_dir_split_count);
1150 static ssize_t dir_split_count_store(struct kobject *kobj,
1151 struct attribute *attr,
1152 const char *buffer, size_t count)
1154 struct obd_device *obd = container_of(kobj, struct obd_device,
1156 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1160 rc = sysfs_memparse(buffer, count, &val, "B");
1167 mdt->mdt_restriper.mdr_dir_split_count = val;
1171 LUSTRE_RW_ATTR(dir_split_count);
1173 static ssize_t dir_split_delta_show(struct kobject *kobj,
1174 struct attribute *attr,
1177 struct obd_device *obd = container_of(kobj, struct obd_device,
1179 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1181 return scnprintf(buf, PAGE_SIZE, "%u\n",
1182 mdt->mdt_restriper.mdr_dir_split_delta);
1185 static ssize_t dir_split_delta_store(struct kobject *kobj,
1186 struct attribute *attr,
1187 const char *buffer, size_t count)
1189 struct obd_device *obd = container_of(kobj, struct obd_device,
1191 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1195 rc = kstrtouint(buffer, 0, &val);
1199 mdt->mdt_restriper.mdr_dir_split_delta = val;
1203 LUSTRE_RW_ATTR(dir_split_delta);
1205 static ssize_t dir_restripe_nsonly_show(struct kobject *kobj,
1206 struct attribute *attr, char *buf)
1208 struct obd_device *obd = container_of(kobj, struct obd_device,
1210 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1212 return scnprintf(buf, PAGE_SIZE, "%u\n", mdt->mdt_dir_restripe_nsonly);
1215 static ssize_t dir_restripe_nsonly_store(struct kobject *kobj,
1216 struct attribute *attr,
1217 const char *buffer, size_t count)
1219 struct obd_device *obd = container_of(kobj, struct obd_device,
1221 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1225 rc = kstrtobool(buffer, &val);
1229 mdt->mdt_dir_restripe_nsonly = val;
1232 LUSTRE_RW_ATTR(dir_restripe_nsonly);
1234 static ssize_t enable_remote_subdir_mount_show(struct kobject *kobj,
1235 struct attribute *attr,
1238 struct obd_device *obd = container_of(kobj, struct obd_device,
1240 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1242 return scnprintf(buf, PAGE_SIZE, "%u\n",
1243 mdt->mdt_enable_remote_subdir_mount);
1246 static ssize_t enable_remote_subdir_mount_store(struct kobject *kobj,
1247 struct attribute *attr,
1251 struct obd_device *obd = container_of(kobj, struct obd_device,
1253 struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
1257 rc = kstrtobool(buffer, &val);
1261 mdt->mdt_enable_remote_subdir_mount = val;
1264 LUSTRE_RW_ATTR(enable_remote_subdir_mount);
1267 * Show if the OFD enforces T10PI checksum.
1269 * \param[in] m seq_file handle
1270 * \param[in] data unused for single entry
1272 * \retval 0 on success
1273 * \retval negative value on error
1275 static ssize_t checksum_t10pi_enforce_show(struct kobject *kobj,
1276 struct attribute *attr,
1279 struct obd_device *obd = container_of(kobj, struct obd_device,
1281 struct lu_target *lut = obd->u.obt.obt_lut;
1283 return scnprintf(buf, PAGE_SIZE, "%u\n", lut->lut_cksum_t10pi_enforce);
1287 * Force specific T10PI checksum modes to be enabled
1289 * If T10PI *is* supported in hardware, allow only the supported T10PI type
1290 * to be used. If T10PI is *not* supported by the OSD, setting the enforce
1291 * parameter forces all T10PI types to be enabled (even if slower) for
1294 * The final determination of which algorithm to be used depends whether
1295 * the client supports T10PI or not, and is handled at client connect time.
1297 * \param[in] file proc file
1298 * \param[in] buffer string which represents mode
1299 * 1: set T10PI checksums enforced
1300 * 0: unset T10PI checksums enforced
1301 * \param[in] count \a buffer length
1302 * \param[in] off unused for single entry
1304 * \retval \a count on success
1305 * \retval negative number on error
1307 static ssize_t checksum_t10pi_enforce_store(struct kobject *kobj,
1308 struct attribute *attr,
1309 const char *buffer, size_t count)
1311 struct obd_device *obd = container_of(kobj, struct obd_device,
1313 struct lu_target *lut = obd->u.obt.obt_lut;
1317 rc = kstrtobool(buffer, &enforce);
1321 spin_lock(&lut->lut_flags_lock);
1322 lut->lut_cksum_t10pi_enforce = enforce;
1323 spin_unlock(&lut->lut_flags_lock);
1326 LUSTRE_RW_ATTR(checksum_t10pi_enforce);
1328 LPROC_SEQ_FOPS_RO_TYPE(mdt, hash);
1329 LPROC_SEQ_FOPS_WR_ONLY(mdt, mds_evict_client);
1330 LPROC_SEQ_FOPS_RW_TYPE(mdt, checksum_dump);
1331 LUSTRE_RW_ATTR(job_cleanup_interval);
1332 LPROC_SEQ_FOPS_RW_TYPE(mdt, nid_stats_clear);
1333 LUSTRE_RW_ATTR(hsm_control);
1335 LPROC_SEQ_FOPS_RO_TYPE(mdt, recovery_status);
1336 LUSTRE_RW_ATTR(recovery_time_hard);
1337 LUSTRE_RW_ATTR(recovery_time_soft);
1338 LUSTRE_RW_ATTR(ir_factor);
1340 LUSTRE_RO_ATTR(tot_dirty);
1341 LUSTRE_RO_ATTR(tot_granted);
1342 LUSTRE_RO_ATTR(tot_pending);
1343 LUSTRE_RW_ATTR(grant_compat_disable);
1344 LUSTRE_RO_ATTR(instance);
1346 LUSTRE_RO_ATTR(num_exports);
1348 static struct attribute *mdt_attrs[] = {
1349 &lustre_attr_tot_dirty.attr,
1350 &lustre_attr_tot_granted.attr,
1351 &lustre_attr_tot_pending.attr,
1352 &lustre_attr_grant_compat_disable.attr,
1353 &lustre_attr_instance.attr,
1354 &lustre_attr_recovery_time_hard.attr,
1355 &lustre_attr_recovery_time_soft.attr,
1356 &lustre_attr_ir_factor.attr,
1357 &lustre_attr_num_exports.attr,
1358 &lustre_attr_identity_expire.attr,
1359 &lustre_attr_identity_acquire_expire.attr,
1360 &lustre_attr_identity_upcall.attr,
1361 &lustre_attr_identity_flush.attr,
1362 &lustre_attr_evict_tgt_nids.attr,
1363 &lustre_attr_enable_remote_dir.attr,
1364 &lustre_attr_enable_remote_dir_gid.attr,
1365 &lustre_attr_enable_chprojid_gid.attr,
1366 &lustre_attr_enable_striped_dir.attr,
1367 &lustre_attr_enable_dir_migration.attr,
1368 &lustre_attr_enable_dir_restripe.attr,
1369 &lustre_attr_enable_dir_auto_split.attr,
1370 &lustre_attr_enable_remote_rename.attr,
1371 &lustre_attr_commit_on_sharing.attr,
1372 &lustre_attr_local_recovery.attr,
1373 &lustre_attr_async_commit_count.attr,
1374 &lustre_attr_sync_count.attr,
1375 &lustre_attr_dom_lock.attr,
1376 &lustre_attr_dom_read_open.attr,
1377 &lustre_attr_migrate_hsm_allowed.attr,
1378 &lustre_attr_hsm_control.attr,
1379 &lustre_attr_job_cleanup_interval.attr,
1380 &lustre_attr_readonly.attr,
1381 &lustre_attr_dir_split_count.attr,
1382 &lustre_attr_dir_split_delta.attr,
1383 &lustre_attr_dir_restripe_nsonly.attr,
1384 &lustre_attr_checksum_t10pi_enforce.attr,
1385 &lustre_attr_enable_remote_subdir_mount.attr,
1389 static struct lprocfs_vars lprocfs_mdt_obd_vars[] = {
1390 { .name = "recovery_status",
1391 .fops = &mdt_recovery_status_fops },
1392 { .name = "identity_info",
1393 .fops = &mdt_identity_info_fops },
1394 { .name = "site_stats",
1395 .fops = &mdt_site_stats_fops },
1396 { .name = "evict_client",
1397 .fops = &mdt_mds_evict_client_fops },
1398 { .name = "checksum_dump",
1399 .fops = &mdt_checksum_dump_fops },
1400 { .name = "hash_stats",
1401 .fops = &mdt_hash_fops },
1402 { .name = "root_squash",
1403 .fops = &mdt_root_squash_fops },
1404 { .name = "nosquash_nids",
1405 .fops = &mdt_nosquash_nids_fops },
1410 lprocfs_mdt_print_open_files(struct obd_export *exp, void *v)
1412 struct seq_file *seq = v;
1414 if (exp->exp_lock_hash != NULL) {
1415 struct mdt_export_data *med = &exp->exp_mdt_data;
1416 struct mdt_file_data *mfd;
1418 spin_lock(&med->med_open_lock);
1419 list_for_each_entry(mfd, &med->med_open_head, mfd_list) {
1420 seq_printf(seq, DFID"\n",
1421 PFID(mdt_object_fid(mfd->mfd_object)));
1423 spin_unlock(&med->med_open_lock);
1429 static int lprocfs_mdt_open_files_seq_show(struct seq_file *seq, void *v)
1431 struct nid_stat *stats = seq->private;
1433 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
1434 lprocfs_mdt_print_open_files, seq);
1437 int lprocfs_mdt_open_files_seq_open(struct inode *inode, struct file *file)
1439 struct seq_file *seq;
1442 rc = single_open(file, &lprocfs_mdt_open_files_seq_show, NULL);
1446 seq = file->private_data;
1447 seq->private = PDE_DATA(inode);
1452 void mdt_counter_incr(struct ptlrpc_request *req, int opcode, long amount)
1454 struct obd_export *exp = req->rq_export;
1456 if (exp->exp_obd && exp->exp_obd->obd_md_stats)
1457 lprocfs_counter_add(exp->exp_obd->obd_md_stats,
1458 opcode + LPROC_MD_LAST_OPC, amount);
1459 if (exp->exp_nid_stats && exp->exp_nid_stats->nid_stats != NULL)
1460 lprocfs_counter_add(exp->exp_nid_stats->nid_stats, opcode,
1462 if (exp->exp_obd && exp->exp_obd->u.obt.obt_jobstats.ojs_hash &&
1463 (exp_connect_flags(exp) & OBD_CONNECT_JOBSTATS))
1464 lprocfs_job_stats_log(exp->exp_obd,
1465 lustre_msg_get_jobid(req->rq_reqmsg),
1469 static const char * const mdt_stats[] = {
1470 [LPROC_MDT_OPEN] = "open",
1471 [LPROC_MDT_CLOSE] = "close",
1472 [LPROC_MDT_MKNOD] = "mknod",
1473 [LPROC_MDT_LINK] = "link",
1474 [LPROC_MDT_UNLINK] = "unlink",
1475 [LPROC_MDT_MKDIR] = "mkdir",
1476 [LPROC_MDT_RMDIR] = "rmdir",
1477 [LPROC_MDT_RENAME] = "rename",
1478 [LPROC_MDT_GETATTR] = "getattr",
1479 [LPROC_MDT_SETATTR] = "setattr",
1480 [LPROC_MDT_GETXATTR] = "getxattr",
1481 [LPROC_MDT_SETXATTR] = "setxattr",
1482 [LPROC_MDT_STATFS] = "statfs",
1483 [LPROC_MDT_SYNC] = "sync",
1484 [LPROC_MDT_SAMEDIR_RENAME] = "samedir_rename",
1485 [LPROC_MDT_CROSSDIR_RENAME] = "crossdir_rename",
1486 [LPROC_MDT_IO_READ] = "read_bytes",
1487 [LPROC_MDT_IO_WRITE] = "write_bytes",
1488 [LPROC_MDT_IO_PUNCH] = "punch",
1489 [LPROC_MDT_MIGRATE] = "migrate",
1492 void mdt_stats_counter_init(struct lprocfs_stats *stats, unsigned int offset)
1494 int array_size = ARRAY_SIZE(mdt_stats);
1495 int oidx; /* obd_md_stats index */
1496 int midx; /* mdt_stats index */
1498 LASSERT(stats && stats->ls_num >= offset + array_size);
1500 for (midx = 0; midx < array_size; midx++) {
1501 oidx = midx + offset;
1502 if (midx == LPROC_MDT_IO_READ || midx == LPROC_MDT_IO_WRITE)
1503 lprocfs_counter_init(stats, oidx,
1504 LPROCFS_TYPE_BYTES_FULL,
1505 mdt_stats[midx], "bytes");
1507 lprocfs_counter_init(stats, oidx,
1508 LPROCFS_TYPE_LATENCY,
1509 mdt_stats[midx], "usecs");
1513 int mdt_tunables_init(struct mdt_device *mdt, const char *name)
1515 struct obd_device *obd = mdt2obd_dev(mdt);
1519 LASSERT(name != NULL);
1521 obd->obd_ktype.default_attrs = mdt_attrs;
1522 obd->obd_vars = lprocfs_mdt_obd_vars;
1523 rc = lprocfs_obd_setup(obd, true);
1525 CERROR("%s: cannot create proc entries: rc = %d\n",
1526 mdt_obd_name(mdt), rc);
1530 rc = tgt_tunables_init(&mdt->mdt_lut);
1532 CERROR("%s: failed to init target tunables: rc = %d\n",
1533 mdt_obd_name(mdt), rc);
1537 rc = hsm_cdt_tunables_init(mdt);
1539 CERROR("%s: cannot create hsm proc entries: rc = %d\n",
1540 mdt_obd_name(mdt), rc);
1544 obd->obd_proc_exports_entry = proc_mkdir("exports",
1545 obd->obd_proc_entry);
1546 if (obd->obd_proc_exports_entry)
1547 lprocfs_add_simple(obd->obd_proc_exports_entry, "clear",
1548 obd, &mdt_nid_stats_clear_fops);
1550 rc = lprocfs_alloc_md_stats(obd, ARRAY_SIZE(mdt_stats));
1554 /* add additional MDT md_stats after the default ones */
1555 mdt_stats_counter_init(obd->obd_md_stats, LPROC_MD_LAST_OPC);
1556 rc = lprocfs_job_stats_init(obd, ARRAY_SIZE(mdt_stats),
1557 mdt_stats_counter_init);
1559 rc = lproc_mdt_attach_rename_seqstat(mdt);
1561 CERROR("%s: MDT can not create rename stats rc = %d\n",
1562 mdt_obd_name(mdt), rc);
1567 void mdt_tunables_fini(struct mdt_device *mdt)
1569 struct obd_device *obd = mdt2obd_dev(mdt);
1571 if (obd->obd_proc_exports_entry != NULL) {
1572 lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
1573 obd->obd_proc_exports_entry = NULL;
1576 lprocfs_free_per_client_stats(obd);
1577 /* hsm_cdt_tunables is disabled earlier than this to avoid
1578 * coordinator restart.
1580 hsm_cdt_tunables_fini(mdt);
1581 tgt_tunables_fini(&mdt->mdt_lut);
1582 lprocfs_obd_cleanup(obd);
1583 lprocfs_free_md_stats(obd);
1584 lprocfs_free_obd_stats(obd);
1585 lprocfs_job_stats_fini(obd);