1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2002 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #define DEBUG_SUBSYSTEM S_OST
24 #include <linux/lustre_lite.h>
25 #include <linux/lprocfs_status.h>
28 int rd_uuid(char* page, char **start, off_t off,
29 int count, int *eof, void *data)
32 struct obd_device* temp=(struct obd_device*)data;
34 len+=snprintf(page, count, "%s\n", temp->obd_uuid);
39 int rd_blksize(char* page, char **start, off_t off,
40 int count, int *eof, void *data)
43 struct obd_device* temp=(struct obd_device*)data;
44 struct ost_obd *ost=&temp->u.ost;
45 struct lustre_handle *conn=&ost->ost_conn;
46 struct obd_statfs mystats;
49 obd_statfs(conn, &mystats);
50 len+=snprintf(page, count, "%d\n", mystats.os_bsize);
54 int rd_kbtotal(char* page, char **start, off_t off,
55 int count, int *eof, void *data)
57 struct obd_device* temp=(struct obd_device*)data;
58 struct ost_obd *ost=&temp->u.ost;
59 struct lustre_handle *conn=&ost->ost_conn;
60 struct obd_statfs mystats;
66 obd_statfs(conn, &mystats);
68 blk_size=mystats.os_bsize;
71 result=mystats.os_blocks;
77 len+=snprintf(page, count, LPU64"\n", result);
84 int rd_kbfree(char* page, char **start, off_t off,
85 int count, int *eof, void *data)
88 struct obd_device* temp=(struct obd_device*)data;
89 struct ost_obd *ost=&temp->u.ost;
90 struct lustre_handle *conn=&ost->ost_conn;
91 struct obd_statfs mystats;
96 obd_statfs(conn, &mystats);
98 blk_size=mystats.os_bsize;
101 result=mystats.os_bfree;
107 len+=snprintf(page, count, LPU64"\n", result);
112 int rd_files(char* page, char **start, off_t off,
113 int count, int *eof, void *data)
116 struct obd_device* temp=(struct obd_device*)data;
117 struct ost_obd *ost=&temp->u.ost;
118 struct lustre_handle *conn=&ost->ost_conn;
119 struct obd_statfs mystats;
122 obd_statfs(conn, &mystats);
124 len+=snprintf(page, count, LPU64"\n",mystats.os_files);
129 int rd_filesfree(char* page, char **start, off_t off,
130 int count, int *eof, void *data)
133 struct obd_device* temp=(struct obd_device*)data;
134 struct ost_obd *ost=&temp->u.ost;
135 struct lustre_handle *conn=&ost->ost_conn;
136 struct obd_statfs mystats;
139 obd_statfs(conn, &mystats);
140 len+=snprintf(page, count, LPU64"\n", mystats.os_ffree);
145 int rd_objgroups(char* page, char **start, off_t off,
146 int count, int *eof, void *data)
151 lprocfs_vars_t status_var_nm_1[]={
152 {"status/uuid", rd_uuid, 0},
153 {"status/blocksize",rd_blksize, 0},
154 {"status/kbytesfree", rd_kbfree, 0},
155 {"status/kbytestotal", rd_kbtotal, 0},
156 {"status/files", rd_files, 0},
157 {"status/filesfree", rd_filesfree, 0},
158 {"status/objectgroups", rd_objgroups, 0},
162 int rd_numdevices(char* page, char **start, off_t off,
163 int count, int *eof, void *data)
165 struct obd_type* class=(struct obd_type*)data;
167 len+=snprintf(page, count, "%d\n", class->typ_refcnt);
171 lprocfs_vars_t status_class_var[]={
172 {"status/num_devices", rd_numdevices, 0},