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 * Common STATUS namespace
31 int rd_uuid(char* page, char **start, off_t off, int count, int *eof,
35 struct obd_device* dev = (struct obd_device*)data;
36 len += snprintf(page, count, "%s\n", dev->obd_uuid);
41 int rd_stripesize(char* page, char **start, off_t off, int count, int *eof,
44 struct obd_device* dev = (struct obd_device*)data;
46 struct lov_obd* lov = &dev->u.lov;
47 len += snprintf(page, count, LPU64"\n",
48 (__u64)(lov->desc.ld_default_stripe_size));
53 int rd_stripeoffset(char* page, char **start, off_t off, int count, int *eof,
56 struct obd_device* dev = (struct obd_device*)data;
58 struct lov_obd* lov = &dev->u.lov;
59 len += snprintf(page, count, LPU64"\n",
60 lov->desc.ld_default_stripe_offset);
65 int rd_stripetype(char* page, char **start, off_t off, int count, int *eof,
68 struct obd_device* dev = (struct obd_device*)data;
70 struct lov_obd* lov = &dev->u.lov;
71 len += snprintf(page, count, LPU64"\n",
72 (__u64)(lov->desc.ld_pattern));
76 int rd_stripecount(char* page, char **start, off_t off, int count, int *eof,
79 struct obd_device* dev = (struct obd_device*)data;
81 struct lov_obd* lov = &dev->u.lov;
82 len += snprintf(page, count, LPU64"\n",
83 (__u64)(lov->desc.ld_default_stripe_count));
87 int rd_numobd(char* page, char **start, off_t off, int count, int *eof,
90 struct obd_device* dev = (struct obd_device*)data;
92 struct lov_obd* lov=&dev->u.lov;
93 len += snprintf(page, count, LPU64"\n",
94 (__u64)(lov->desc.ld_tgt_count));
99 int rd_activeobd(char* page, char **start, off_t off, int count, int *eof,
102 struct obd_device* dev = (struct obd_device*)data;
104 struct lov_obd* lov = &dev->u.lov;
105 len += snprintf(page, count, LPU64"\n",
106 (__u64)(lov->desc.ld_active_tgt_count));
111 int rd_blksize(char* page, char **start, off_t off, int count, int *eof,
118 int rd_kbtotal(char* page, char **start, off_t off, int count, int *eof,
125 int rd_kbfree(char* page, char **start, off_t off, int count, int *eof,
131 int rd_filestotal(char* page, char **start, off_t off, int count, int *eof,
137 int rd_filesfree(char* page, char **start, off_t off, int count, int *eof,
143 int rd_filegroups(char* page, char **start, off_t off, int count, int *eof,
149 int rd_target(char* page, char **start, off_t off, int count, int *eof,
152 struct obd_device* dev = (struct obd_device*)data;
154 struct lov_obd* lov = &dev->u.lov;
155 struct lov_tgt_desc* tgts = lov->tgts;
156 while(i < lov->desc.ld_tgt_count){
157 len += snprintf(&page[len], count, "%d: %s\n", i, tgts->uuid);
164 int rd_mdc(char* page, char **start, off_t off, int count, int *eof, void *data)
166 struct obd_device* dev = (struct obd_device*)data;
168 struct lov_obd* lov = &dev->u.lov;
169 len += snprintf(page, count, "%s\n", lov->mdcobd->obd_uuid);
173 struct lprocfs_vars status_var_nm_1[] = {
174 {"status/uuid", rd_uuid, 0, 0},
175 {"status/stripesize",rd_stripesize, 0, 0},
176 {"status/stripeoffset",rd_stripeoffset, 0, 0},
177 {"status/stripecount",rd_stripecount, 0, 0},
178 {"status/stripetype", rd_stripetype, 0, 0},
179 {"status/numobd",rd_numobd, 0, 0},
180 {"status/activeobd", rd_activeobd, 0, 0},
181 {"status/filestotal", rd_filestotal, 0, 0},
182 {"status/filesfree", rd_filesfree, 0, 0},
183 {"status/filegroups", rd_filegroups, 0, 0},
184 {"status/blocksize", rd_blksize, 0, 0},
185 {"status/kbytestotal", rd_kbtotal, 0, 0},
186 {"status/kbytesfree", rd_kbfree, 0, 0},
187 {"status/target_obd", rd_target, 0, 0},
188 {"status/target_mdc", rd_mdc, 0, 0},
192 int rd_numrefs(char* page, char **start, off_t off, int count, int *eof,
195 struct obd_type* class = (struct obd_type*)data;
197 len += snprintf(page, count, "%d\n", class->typ_refcnt);
201 struct lprocfs_vars status_class_var[]={
202 {"status/num_refs", rd_numrefs, 0, 0},