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, 2017, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
31 #define DEBUG_SUBSYSTEM S_CLASS
33 #include <linux/version.h>
34 #include <linux/vfs.h>
35 #include <obd_class.h>
36 #include <lprocfs_status.h>
37 #include "mgc_internal.h"
41 LDEBUGFS_SEQ_FOPS_RO_TYPE(mgc, connect_flags);
43 LDEBUGFS_SEQ_FOPS_RO_TYPE(mgc, server_uuid);
45 LDEBUGFS_SEQ_FOPS_RO_TYPE(mgc, import);
47 LDEBUGFS_SEQ_FOPS_RO_TYPE(mgc, state);
49 static int mgc_ir_state_seq_show(struct seq_file *m, void *v)
51 return lprocfs_mgc_rd_ir_state(m, m->private);
54 LDEBUGFS_SEQ_FOPS_RO(mgc_ir_state);
56 struct ldebugfs_vars ldebugfs_mgc_obd_vars[] = {
57 { .name = "connect_flags",
58 .fops = &mgc_connect_flags_fops },
59 { .name = "mgs_server_uuid",
60 .fops = &mgc_server_uuid_fops },
62 .fops = &mgc_import_fops },
64 .fops = &mgc_state_fops },
66 .fops = &mgc_ir_state_fops },
69 #endif /* CONFIG_PROC_FS */
71 LUSTRE_ATTR(mgs_conn_uuid, 0444, conn_uuid_show, NULL);
72 LUSTRE_RO_ATTR(conn_uuid);
76 ssize_t dynamic_nids_show(struct kobject *kobj, struct attribute *attr,
79 struct obd_device *obd = container_of(kobj, struct obd_device,
84 count = snprintf(buf, PAGE_SIZE, "%u\n", obd->obd_dynamic_nids);
89 ssize_t dynamic_nids_store(struct kobject *kobj, struct attribute *attr,
90 const char *buffer, size_t count)
92 struct obd_device *obd = container_of(kobj, struct obd_device,
98 rc = kstrtobool(buffer, &val);
102 spin_lock(&obd->obd_dev_lock);
103 obd->obd_dynamic_nids = val;
104 spin_unlock(&obd->obd_dev_lock);
109 LUSTRE_RW_ATTR(dynamic_nids);
111 static struct attribute *mgc_attrs[] = {
112 &lustre_attr_mgs_conn_uuid.attr,
113 &lustre_attr_conn_uuid.attr,
114 &lustre_attr_ping.attr,
115 &lustre_attr_dynamic_nids.attr,
119 int mgc_tunables_init(struct obd_device *obd)
123 obd->obd_ktype.default_attrs = mgc_attrs;
124 obd->obd_debugfs_vars = ldebugfs_mgc_obd_vars;
125 rc = lprocfs_obd_setup(obd, true);
129 return sptlrpc_lprocfs_cliobd_attach(obd);