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.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2015, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 #define DEBUG_SUBSYSTEM S_CLASS
38 #include <linux/vfs.h>
39 #include "../include/obd_class.h"
40 #include "../include/lprocfs_status.h"
41 #include "mdc_internal.h"
43 static ssize_t
max_rpcs_in_flight_show(struct kobject
*kobj
,
44 struct attribute
*attr
,
48 struct obd_device
*dev
= container_of(kobj
, struct obd_device
,
50 struct client_obd
*cli
= &dev
->u
.cli
;
52 client_obd_list_lock(&cli
->cl_loi_list_lock
);
53 len
= sprintf(buf
, "%u\n", cli
->cl_max_rpcs_in_flight
);
54 client_obd_list_unlock(&cli
->cl_loi_list_lock
);
59 static ssize_t
max_rpcs_in_flight_store(struct kobject
*kobj
,
60 struct attribute
*attr
,
64 struct obd_device
*dev
= container_of(kobj
, struct obd_device
,
66 struct client_obd
*cli
= &dev
->u
.cli
;
70 rc
= kstrtoul(buffer
, 10, &val
);
74 if (val
< 1 || val
> MDC_MAX_RIF_MAX
)
77 client_obd_list_lock(&cli
->cl_loi_list_lock
);
78 cli
->cl_max_rpcs_in_flight
= val
;
79 client_obd_list_unlock(&cli
->cl_loi_list_lock
);
83 LUSTRE_RW_ATTR(max_rpcs_in_flight
);
85 LPROC_SEQ_FOPS_WR_ONLY(mdc
, ping
);
87 LPROC_SEQ_FOPS_RO_TYPE(mdc
, connect_flags
);
88 LPROC_SEQ_FOPS_RO_TYPE(mdc
, server_uuid
);
89 LPROC_SEQ_FOPS_RO_TYPE(mdc
, conn_uuid
);
90 LPROC_SEQ_FOPS_RO_TYPE(mdc
, timeouts
);
91 LPROC_SEQ_FOPS_RO_TYPE(mdc
, state
);
94 * Note: below sysfs entry is provided, but not currently in use, instead
95 * sbi->sb_md_brw_size is used, the per obd variable should be used
96 * when DNE is enabled, and dir pages are managed in MDC layer.
97 * Don't forget to enable sysfs store function then.
99 static ssize_t
max_pages_per_rpc_show(struct kobject
*kobj
,
100 struct attribute
*attr
,
103 struct obd_device
*dev
= container_of(kobj
, struct obd_device
,
105 struct client_obd
*cli
= &dev
->u
.cli
;
107 return sprintf(buf
, "%d\n", cli
->cl_max_pages_per_rpc
);
109 LUSTRE_RO_ATTR(max_pages_per_rpc
);
111 LPROC_SEQ_FOPS_RW_TYPE(mdc
, import
);
112 LPROC_SEQ_FOPS_RW_TYPE(mdc
, pinger_recov
);
114 static struct lprocfs_vars lprocfs_mdc_obd_vars
[] = {
115 { "ping", &mdc_ping_fops
, NULL
, 0222 },
116 { "connect_flags", &mdc_connect_flags_fops
, NULL
, 0 },
117 /*{ "filegroups", lprocfs_rd_filegroups, NULL, 0 },*/
118 { "mds_server_uuid", &mdc_server_uuid_fops
, NULL
, 0 },
119 { "mds_conn_uuid", &mdc_conn_uuid_fops
, NULL
, 0 },
120 { "timeouts", &mdc_timeouts_fops
, NULL
, 0 },
121 { "import", &mdc_import_fops
, NULL
, 0 },
122 { "state", &mdc_state_fops
, NULL
, 0 },
123 { "pinger_recov", &mdc_pinger_recov_fops
, NULL
, 0 },
127 static struct attribute
*mdc_attrs
[] = {
128 &lustre_attr_max_rpcs_in_flight
.attr
,
129 &lustre_attr_max_pages_per_rpc
.attr
,
133 static struct attribute_group mdc_attr_group
= {
137 void lprocfs_mdc_init_vars(struct lprocfs_static_vars
*lvars
)
139 lvars
->sysfs_vars
= &mdc_attr_group
;
140 lvars
->obd_vars
= lprocfs_mdc_obd_vars
;