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,
46 struct client_obd *cli = &dev->u.cli;
48 spin_lock(&cli->cl_loi_list_lock);
49 len = sprintf(buf, "%u\n", cli->cl_max_rpcs_in_flight);
50 spin_unlock(&cli->cl_loi_list_lock);
55 static ssize_t max_rpcs_in_flight_store(struct kobject *kobj,
56 struct attribute *attr,
60 struct obd_device *dev = container_of(kobj, struct obd_device,
62 struct client_obd *cli = &dev->u.cli;
66 rc = kstrtoul(buffer, 10, &val);
70 if (val < 1 || val > MDC_MAX_RIF_MAX)
73 spin_lock(&cli->cl_loi_list_lock);
74 cli->cl_max_rpcs_in_flight = val;
75 spin_unlock(&cli->cl_loi_list_lock);
79 LUSTRE_RW_ATTR(max_rpcs_in_flight);
81 LPROC_SEQ_FOPS_WR_ONLY(mdc, ping);
83 LPROC_SEQ_FOPS_RO_TYPE(mdc, connect_flags);
84 LPROC_SEQ_FOPS_RO_TYPE(mdc, server_uuid);
85 LPROC_SEQ_FOPS_RO_TYPE(mdc, conn_uuid);
86 LPROC_SEQ_FOPS_RO_TYPE(mdc, timeouts);
87 LPROC_SEQ_FOPS_RO_TYPE(mdc, state);
90 * Note: below sysfs entry is provided, but not currently in use, instead
91 * sbi->sb_md_brw_size is used, the per obd variable should be used
92 * when DNE is enabled, and dir pages are managed in MDC layer.
93 * Don't forget to enable sysfs store function then.
95 static ssize_t max_pages_per_rpc_show(struct kobject *kobj,
96 struct attribute *attr,
99 struct obd_device *dev = container_of(kobj, struct obd_device,
101 struct client_obd *cli = &dev->u.cli;
103 return sprintf(buf, "%d\n", cli->cl_max_pages_per_rpc);
105 LUSTRE_RO_ATTR(max_pages_per_rpc);
107 LPROC_SEQ_FOPS_RW_TYPE(mdc, import);
108 LPROC_SEQ_FOPS_RW_TYPE(mdc, pinger_recov);
110 static struct lprocfs_vars lprocfs_mdc_obd_vars[] = {
111 { "ping", &mdc_ping_fops, NULL, 0222 },
112 { "connect_flags", &mdc_connect_flags_fops, NULL, 0 },
113 /*{ "filegroups", lprocfs_rd_filegroups, NULL, 0 },*/
114 { "mds_server_uuid", &mdc_server_uuid_fops, NULL, 0 },
115 { "mds_conn_uuid", &mdc_conn_uuid_fops, NULL, 0 },
116 { "timeouts", &mdc_timeouts_fops, NULL, 0 },
117 { "import", &mdc_import_fops, NULL, 0 },
118 { "state", &mdc_state_fops, NULL, 0 },
119 { "pinger_recov", &mdc_pinger_recov_fops, NULL, 0 },
123 static struct attribute *mdc_attrs[] = {
124 &lustre_attr_max_rpcs_in_flight.attr,
125 &lustre_attr_max_pages_per_rpc.attr,
129 static struct attribute_group mdc_attr_group = {
133 void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars)
135 lvars->sysfs_vars = &mdc_attr_group;
136 lvars->obd_vars = lprocfs_mdc_obd_vars;