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/lustre_fsfilt.h>
26 #include <linux/lprocfs_status.h>
28 int rd_uuid(char* page, char **start, off_t off, int count, int *eof,
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, int count, int *eof,
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_kbtotal(char* page, char **start, off_t off, int count, int *eof,
56 struct obd_device* temp = (struct obd_device*)data;
57 struct mds_obd *mds = &temp->u.mds;
58 struct statfs mystats;
63 rc = vfs_statfs(mds->mds_sb, &mystats);
65 CERROR("mds: statfs failed: rc %d\n", rc);
69 blk_size = mystats.f_bsize;
71 result = mystats.f_blocks;
72 while(blk_size >>= 1){
75 len += snprintf(page, count, LPU64"\n", result);
80 int rd_kbfree(char* page, char **start, off_t off, int count, int *eof,
83 struct obd_device* temp = (struct obd_device*)data;
84 struct mds_obd *mds = &temp->u.mds;
85 struct statfs mystats;
91 rc = vfs_statfs(mds->mds_sb, &mystats);
93 CERROR("mds: statfs failed: rc %d\n", rc);
96 blk_size = mystats.f_bsize;
98 result = mystats.f_blocks;
99 while(blk_size >>= 1){
102 len += snprintf(page, count, LPU64"\n", result);
107 int rd_fstype(char *page, char **start, off_t off, int count, int *eof,
110 struct obd_device *obd = (struct obd_device *)data;
112 return snprintf(page, count, "%s\n", obd->obd_fsops->fs_type);
115 int rd_filestotal(char* page, char **start, off_t off, int count, int *eof,
118 struct obd_device* temp = (struct obd_device*)data;
119 struct mds_obd *mds = &temp->u.mds;
120 struct statfs mystats;
123 rc = vfs_statfs(mds->mds_sb, &mystats);
125 CERROR("mds: statfs failed: rc %d\n", rc);
129 len += snprintf(page, count, LPU64"\n", (__u64)(mystats.f_files));
135 int rd_filesfree(char* page, char **start, off_t off, int count, int *eof,
138 struct obd_device* temp = (struct obd_device*)data;
139 struct mds_obd *mds = &temp->u.mds;
140 struct statfs mystats;
143 rc = vfs_statfs(mds->mds_sb, &mystats);
145 CERROR("mds: statfs failed: rc %d\n", rc);
149 len += snprintf(page, count, LPU64"\n", (__u64)(mystats.f_ffree));
153 int rd_filegroups(char* page, char **start, off_t off, int count, int *eof,
158 struct lprocfs_vars status_var_nm_1[]={
159 {"status/uuid", rd_uuid, 0, 0},
160 {"status/blocksize",rd_blksize, 0, 0},
161 {"status/kbytestotal",rd_kbtotal, 0, 0},
162 {"status/kbytesfree", rd_kbfree, 0, 0},
163 {"status/fstype", rd_fstype, 0, 0},
164 {"status/filestotal", rd_filestotal, 0, 0},
165 {"status/filesfree", rd_filesfree, 0, 0},
166 {"status/filegroups", rd_filegroups, 0, 0},
169 int rd_numrefs(char* page, char **start, off_t off, int count, int *eof,
172 struct obd_type* class = (struct obd_type*)data;
174 len += snprintf(page, count, "%d\n", class->typ_refcnt);
178 struct lprocfs_vars status_class_var[]={
179 {"status/num_refs", rd_numrefs, 0, 0},