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_CLASS
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)
31 struct obd_device* temp=(struct obd_device*)data;
33 len+=snprintf(page, count, "%s\n", temp->obd_uuid);
36 int rd_blksize(char* page, char **start, off_t off,
37 int count, int *eof, void *data)
39 struct obd_device* temp=(struct obd_device*)data;
40 struct mds_obd *mds=&temp->u.mds;
41 struct statfs mystats;
44 rc = vfs_statfs(mds->mds_sb, &mystats);
46 CERROR("mds: statfs failed: rc %d\n", rc);
49 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_bsize));
53 int rd_blktotal(char* page, char **start, off_t off,
54 int count, int *eof, void *data)
56 struct obd_device* temp=(struct obd_device*)data;
57 struct mds_obd *mds=&temp->u.mds;
58 struct statfs mystats;
61 rc = vfs_statfs(mds->mds_sb, &mystats);
63 CERROR("mds: statfs failed: rc %d\n", rc);
66 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_blocks));
71 int rd_blkfree(char* page, char **start, off_t off,
72 int count, int *eof, void *data)
74 struct obd_device* temp=(struct obd_device*)data;
75 struct mds_obd *mds=&temp->u.mds;
76 struct statfs mystats;
79 rc = vfs_statfs(mds->mds_sb, &mystats);
81 CERROR("mds: statfs failed: rc %d\n", rc);
84 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_bfree));
89 int rd_kbfree(char* page, char **start, off_t off,
90 int count, int *eof, void *data)
92 struct obd_device* temp=(struct obd_device*)data;
93 struct mds_obd *mds=&temp->u.mds;
94 struct statfs mystats;
95 int rc, blk_size, len=0;
97 rc = vfs_statfs(mds->mds_sb, &mystats);
99 CERROR("mds: statfs failed: rc %d\n", rc);
102 blk_size=mystats.f_bsize;
103 len+=snprintf(page, count, LPU64"\n",
104 (__u64)((mystats.f_bfree)/(blk_size*1024)));
109 int rd_fstype(char* page, char **start, off_t off,
110 int count, int *eof, void *data)
112 struct obd_device* temp=(struct obd_device*)data;
113 struct mds_obd *mds=&temp->u.mds;
115 len+=snprintf(page, count, "%s\n", mds->mds_fstype);
120 int rd_ffiles(char* page, char **start, off_t off,
121 int count, int *eof, void *data)
123 struct obd_device* temp=(struct obd_device*)data;
124 struct mds_obd *mds=&temp->u.mds;
125 struct statfs mystats;
128 rc = vfs_statfs(mds->mds_sb, &mystats);
130 CERROR("mds: statfs failed: rc %d\n", rc);
134 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_files));
140 int rd_inodesfree(char* page, char **start, off_t off,
141 int count, int *eof, void *data)
143 struct obd_device* temp=(struct obd_device*)data;
144 struct mds_obd *mds=&temp->u.mds;
145 struct statfs mystats;
148 rc = vfs_statfs(mds->mds_sb, &mystats);
150 CERROR("mds: statfs failed: rc %d\n", rc);
154 len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_ffree));
158 int rd_filesets(char* page, char **start, off_t off,
159 int count, int *eof, void *data)
163 struct lprocfs_vars status_var_nm_1[]={
164 {"status/uuid", rd_uuid, 0},
165 {"status/f_blocksize",rd_blksize, 0},
166 {"status/f_blockstotal",rd_blktotal, 0},
167 {"status/f_blocksfree",rd_blkfree, 0},
168 {"status/f_kbytesfree", rd_kbfree, 0},
169 {"status/f_fstype", rd_fstype, 0},
170 {"status/f_files", rd_ffiles, 0},
171 {"status/f_inodesfree", rd_inodesfree, 0},
172 {"status/f_filesets", rd_filesets, 0},
175 int rd_numdevices(char* page, char **start, off_t off,
176 int count, int *eof, void *data)
178 struct obd_type* class=(struct obd_type*)data;
180 len+=snprintf(page, count, "%d\n", class->typ_refcnt);
184 struct lprocfs_vars status_class_var[]={
185 {"status/num_devices", rd_numdevices, 0},