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;
32 return 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 return snprintf(page, count, LPU64"\n", (__u64)(mystats.f_bsize));
51 int rd_kbtotal(char *page, char **start, off_t off, int count, int *eof,
54 struct obd_device* temp = (struct obd_device*)data;
55 struct mds_obd *mds = &temp->u.mds;
56 struct statfs mystats;
61 rc = vfs_statfs(mds->mds_sb, &mystats);
63 CERROR("mds: statfs failed: rc %d\n", rc);
67 blk_size = mystats.f_bsize;
69 result = mystats.f_blocks;
73 return snprintf(page, count, LPU64"\n", result);
76 int rd_kbfree(char *page, char **start, off_t off, int count, int *eof,
79 struct obd_device* temp = (struct obd_device*)data;
80 struct mds_obd *mds = &temp->u.mds;
81 struct statfs mystats;
86 rc = vfs_statfs(mds->mds_sb, &mystats);
88 CERROR("mds: statfs failed: rc %d\n", rc);
91 blk_size = mystats.f_bsize;
93 result = mystats.f_blocks;
94 while (blk_size >>= 1)
97 return snprintf(page, count, LPU64"\n", result);
100 int rd_fstype(char *page, char **start, off_t off, int count, int *eof,
103 struct obd_device *obd = (struct obd_device *)data;
105 return snprintf(page, count, "%s\n", obd->obd_fsops->fs_type);
108 int rd_filestotal(char *page, char **start, off_t off, int count, int *eof,
111 struct obd_device* temp = (struct obd_device*)data;
112 struct mds_obd *mds = &temp->u.mds;
113 struct statfs mystats;
116 rc = vfs_statfs(mds->mds_sb, &mystats);
118 CERROR("mds: statfs failed: rc %d\n", rc);
121 return snprintf(page, count, LPU64"\n", (__u64)(mystats.f_files));
124 int rd_filesfree(char *page, char **start, off_t off, int count, int *eof,
127 struct obd_device* temp = (struct obd_device*)data;
128 struct mds_obd *mds = &temp->u.mds;
129 struct statfs mystats;
132 rc = vfs_statfs(mds->mds_sb, &mystats);
134 CERROR("mds: statfs failed: rc %d\n", rc);
138 len += snprintf(page, count, LPU64"\n", (__u64)(mystats.f_ffree));
142 int rd_filegroups(char *page, char **start, off_t off, int count, int *eof,
147 struct lprocfs_vars status_var_nm_1[]={
148 {"status/uuid", rd_uuid, 0, 0},
149 {"status/blocksize",rd_blksize, 0, 0},
150 {"status/kbytestotal",rd_kbtotal, 0, 0},
151 {"status/kbytesfree", rd_kbfree, 0, 0},
152 {"status/fstype", rd_fstype, 0, 0},
153 {"status/filestotal", rd_filestotal, 0, 0},
154 {"status/filesfree", rd_filesfree, 0, 0},
155 {"status/filegroups", rd_filegroups, 0, 0},
159 int rd_numrefs(char *page, char **start, off_t off, int count, int *eof,
162 struct obd_type *class = (struct obd_type*)data;
164 return snprintf(page, count, "%d\n", class->typ_refcnt);
167 struct lprocfs_vars status_class_var[]={
168 {"status/num_refs", rd_numrefs, 0, 0},