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) 2002, 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/
30 * Lustre is a trademark of Sun Microsystems, Inc.
32 #define DEBUG_SUBSYSTEM S_CLASS
34 #include <linux/vfs.h>
35 #include "../include/obd_class.h"
36 #include "../include/lprocfs_status.h"
37 #include "mdc_internal.h"
39 static ssize_t max_rpcs_in_flight_show(struct kobject *kobj,
40 struct attribute *attr,
44 struct obd_device *dev = container_of(kobj, struct obd_device,
48 max = obd_get_max_rpcs_in_flight(&dev->u.cli);
49 len = sprintf(buf, "%u\n", max);
54 static ssize_t max_rpcs_in_flight_store(struct kobject *kobj,
55 struct attribute *attr,
59 struct obd_device *dev = container_of(kobj, struct obd_device,
64 rc = kstrtoul(buffer, 10, &val);
68 rc = obd_set_max_rpcs_in_flight(&dev->u.cli, val);
74 LUSTRE_RW_ATTR(max_rpcs_in_flight);
76 LPROC_SEQ_FOPS_WR_ONLY(mdc, ping);
78 LPROC_SEQ_FOPS_RO_TYPE(mdc, connect_flags);
79 LPROC_SEQ_FOPS_RO_TYPE(mdc, server_uuid);
80 LPROC_SEQ_FOPS_RO_TYPE(mdc, conn_uuid);
81 LPROC_SEQ_FOPS_RO_TYPE(mdc, timeouts);
82 LPROC_SEQ_FOPS_RO_TYPE(mdc, state);
85 * Note: below sysfs entry is provided, but not currently in use, instead
86 * sbi->sb_md_brw_size is used, the per obd variable should be used
87 * when DNE is enabled, and dir pages are managed in MDC layer.
88 * Don't forget to enable sysfs store function then.
90 static ssize_t max_pages_per_rpc_show(struct kobject *kobj,
91 struct attribute *attr,
94 struct obd_device *dev = container_of(kobj, struct obd_device,
96 struct client_obd *cli = &dev->u.cli;
98 return sprintf(buf, "%d\n", cli->cl_max_pages_per_rpc);
100 LUSTRE_RO_ATTR(max_pages_per_rpc);
102 LPROC_SEQ_FOPS_RW_TYPE(mdc, import);
103 LPROC_SEQ_FOPS_RW_TYPE(mdc, pinger_recov);
105 static struct lprocfs_vars lprocfs_mdc_obd_vars[] = {
106 { "ping", &mdc_ping_fops, NULL, 0222 },
107 { "connect_flags", &mdc_connect_flags_fops, NULL, 0 },
108 /*{ "filegroups", lprocfs_rd_filegroups, NULL, 0 },*/
109 { "mds_server_uuid", &mdc_server_uuid_fops, NULL, 0 },
110 { "mds_conn_uuid", &mdc_conn_uuid_fops, NULL, 0 },
111 { "timeouts", &mdc_timeouts_fops, NULL, 0 },
112 { "import", &mdc_import_fops, NULL, 0 },
113 { "state", &mdc_state_fops, NULL, 0 },
114 { "pinger_recov", &mdc_pinger_recov_fops, NULL, 0 },
118 static struct attribute *mdc_attrs[] = {
119 &lustre_attr_max_rpcs_in_flight.attr,
120 &lustre_attr_max_pages_per_rpc.attr,
124 static struct attribute_group mdc_attr_group = {
128 void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars)
130 lvars->sysfs_vars = &mdc_attr_group;
131 lvars->obd_vars = lprocfs_mdc_obd_vars;