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, 2012, 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/version.h>
39 #include <linux/vfs.h>
40 #include <obd_class.h>
41 #include <lprocfs_status.h>
45 static int mdc_rd_max_rpcs_in_flight(char *page, char **start, off_t off,
46 int count, int *eof, void *data)
48 struct obd_device *dev = data;
49 struct client_obd *cli = &dev->u.cli;
52 client_obd_list_lock(&cli->cl_loi_list_lock);
53 rc = snprintf(page, count, "%u\n", cli->cl_max_rpcs_in_flight);
54 client_obd_list_unlock(&cli->cl_loi_list_lock);
58 static int mdc_wr_max_rpcs_in_flight(struct file *file, const char *buffer,
59 unsigned long count, void *data)
61 struct obd_device *dev = data;
62 struct client_obd *cli = &dev->u.cli;
65 rc = lprocfs_write_helper(buffer, count, &val);
69 if (val < 1 || val > MDC_MAX_RIF_MAX)
72 client_obd_list_lock(&cli->cl_loi_list_lock);
73 cli->cl_max_rpcs_in_flight = val;
74 client_obd_list_unlock(&cli->cl_loi_list_lock);
79 static struct lprocfs_vars lprocfs_mdc_obd_vars[] = {
80 { "uuid", lprocfs_rd_uuid, 0, 0 },
81 { "ping", 0, lprocfs_wr_ping, 0, 0, 0222 },
82 { "connect_flags", lprocfs_rd_connect_flags, 0, 0 },
83 { "blocksize", lprocfs_rd_blksize, 0, 0 },
84 { "kbytestotal", lprocfs_rd_kbytestotal, 0, 0 },
85 { "kbytesfree", lprocfs_rd_kbytesfree, 0, 0 },
86 { "kbytesavail", lprocfs_rd_kbytesavail, 0, 0 },
87 { "filestotal", lprocfs_rd_filestotal, 0, 0 },
88 { "filesfree", lprocfs_rd_filesfree, 0, 0 },
89 /*{ "filegroups", lprocfs_rd_filegroups, 0, 0 },*/
90 { "mds_server_uuid", lprocfs_rd_server_uuid, 0, 0 },
91 { "mds_conn_uuid", lprocfs_rd_conn_uuid, 0, 0 },
93 * FIXME: below proc entry is provided, but not in used, instead
94 * sbi->sb_md_brw_size is used, the per obd variable should be used
95 * when CMD is enabled, and dir pages are managed in MDC layer.
96 * Remember to enable proc write function.
98 { "max_pages_per_rpc", lprocfs_obd_rd_max_pages_per_rpc,
99 /* lprocfs_obd_wr_max_pages_per_rpc */0, 0 },
100 { "max_rpcs_in_flight", mdc_rd_max_rpcs_in_flight,
101 mdc_wr_max_rpcs_in_flight, 0 },
102 { "timeouts", lprocfs_rd_timeouts, 0, 0 },
103 { "import", lprocfs_rd_import, lprocfs_wr_import, 0 },
104 { "state", lprocfs_rd_state, 0, 0 },
105 { "pinger_recov", lprocfs_rd_pinger_recov,
106 lprocfs_wr_pinger_recov, 0, 0 },
110 static struct lprocfs_vars lprocfs_mdc_module_vars[] = {
111 { "num_refs", lprocfs_rd_numrefs, 0, 0 },
115 void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars)
117 lvars->module_vars = lprocfs_mdc_module_vars;
118 lvars->obd_vars = lprocfs_mdc_obd_vars;