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>
27 int rd_uuid(char* page, char **start, off_t off, int count, int *eof,
30 struct obd_device* temp = (struct obd_device*)data;
32 len += snprintf(page, count, "%s\n", temp->obd_uuid);
35 int rd_blksize(char* page, char **start, off_t off, int count, int *eof,
38 struct obd_device* temp = (struct obd_device*)data;
39 struct mds_obd *mds = &temp->u.mds;
40 struct statfs mystats;
43 rc = vfs_statfs(mds->mds_sb, &mystats);
45 CERROR("mds: statfs failed: rc %d\n", rc);
48 len += snprintf(page, count, LPU64"\n", (__u64)(mystats.f_bsize));
52 int rd_kbtotal(char* page, char **start, off_t off, int count, int *eof,
55 struct obd_device* temp = (struct obd_device*)data;
56 struct mds_obd *mds = &temp->u.mds;
57 struct statfs mystats;
62 rc = vfs_statfs(mds->mds_sb, &mystats);
64 CERROR("mds: statfs failed: rc %d\n", rc);
68 blk_size = mystats.f_bsize;
70 result = mystats.f_blocks;
71 while(blk_size >>= 1){
74 len += snprintf(page, count, LPU64"\n", result);
79 int rd_kbfree(char* page, char **start, off_t off, int count, int *eof,
82 struct obd_device* temp = (struct obd_device*)data;
83 struct mds_obd *mds = &temp->u.mds;
84 struct statfs mystats;
90 rc = vfs_statfs(mds->mds_sb, &mystats);
92 CERROR("mds: statfs failed: rc %d\n", rc);
95 blk_size = mystats.f_bsize;
97 result = mystats.f_blocks;
98 while(blk_size >>= 1){
101 len += snprintf(page, count, LPU64"\n", result);
106 int rd_fstype(char* page, char **start, off_t off, int count, int *eof,
109 struct obd_device* temp = (struct obd_device*)data;
110 struct mds_obd *mds = &temp->u.mds;
112 len += snprintf(page, count, "%s\n", mds->mds_fstype);
117 int rd_filestotal(char* page, char **start, off_t off, int count, int *eof,
120 struct obd_device* temp = (struct obd_device*)data;
121 struct mds_obd *mds = &temp->u.mds;
122 struct statfs mystats;
125 rc = vfs_statfs(mds->mds_sb, &mystats);
127 CERROR("mds: statfs failed: rc %d\n", rc);
131 len += snprintf(page, count, LPU64"\n", (__u64)(mystats.f_files));
137 int rd_filesfree(char* page, char **start, off_t off, int count, int *eof,
140 struct obd_device* temp = (struct obd_device*)data;
141 struct mds_obd *mds = &temp->u.mds;
142 struct statfs mystats;
145 rc = vfs_statfs(mds->mds_sb, &mystats);
147 CERROR("mds: statfs failed: rc %d\n", rc);
151 len += snprintf(page, count, LPU64"\n", (__u64)(mystats.f_ffree));
155 int rd_filegroups(char* page, char **start, off_t off, int count, int *eof,
160 struct lprocfs_vars status_var_nm_1[]={
161 {"status/uuid", rd_uuid, 0, 0},
162 {"status/blocksize",rd_blksize, 0, 0},
163 {"status/kbytestotal",rd_kbtotal, 0, 0},
164 {"status/kbytesfree", rd_kbfree, 0, 0},
165 {"status/fstype", rd_fstype, 0, 0},
166 {"status/filestotal", rd_filestotal, 0, 0},
167 {"status/filesfree", rd_filesfree, 0, 0},
168 {"status/filegroups", rd_filegroups, 0, 0},
171 int rd_numrefs(char* page, char **start, off_t off, int count, int *eof,
174 struct obd_type* class = (struct obd_type*)data;
176 len += snprintf(page, count, "%d\n", class->typ_refcnt);
180 struct lprocfs_vars status_class_var[]={
181 {"status/num_refs", rd_numrefs, 0, 0},