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,
32 int count, int *eof, void *data)
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,
42 int count, int *eof, void *data)
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,
54 int count, int *eof, void *data)
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,
66 int count, int *eof, void *data)
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,
77 int count, int *eof, void *data)
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,
88 int count, int *eof, void *data)
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,
100 int count, int *eof, void *data)
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,
112 int count, int *eof, void *data)
118 int rd_blktotal(char* page, char **start, off_t off,
119 int count, int *eof, void *data)
124 int rd_blkfree(char* page, char **start, off_t off,
125 int count, int *eof, void *data)
130 int rd_kbfree(char* page, char **start, off_t off,
131 int count, int *eof, void *data)
136 int rd_numobjects(char* page, char **start, off_t off,
137 int count, int *eof, void *data)
142 int rd_objfree(char* page, char **start, off_t off,
143 int count, int *eof, void *data)
148 int rd_objgroups(char* page, char **start, off_t off,
149 int count, int *eof, void *data)
154 int rd_target(char* page, char **start, off_t off,
155 int count, int *eof, void *data)
157 struct obd_device* dev=(struct obd_device*)data;
159 struct lov_obd* lov=&dev->u.lov;
160 struct lov_tgt_desc* tgts=lov->tgts;
161 while(i<lov->desc.ld_tgt_count){
162 len+=snprintf(page, count, "%d: %s\n", i, tgts->uuid);
169 int rd_mdc(char* page, char **start, off_t off,
170 int count, int *eof, void *data)
172 struct obd_device* dev=(struct obd_device*)data;
174 struct lov_obd* lov=&dev->u.lov;
175 len+=snprintf(page, count, "%s\n", lov->mdcobd->obd_uuid);
179 struct lprocfs_vars status_var_nm_1[]={
180 {"status/uuid", rd_uuid, 0},
181 {"status/stripesize",rd_stripesize, 0},
182 {"status/stripeoffset",rd_stripeoffset, 0},
183 {"status/stripecount",rd_stripecount, 0},
184 {"status/stripetype", rd_stripetype, 0},
185 {"status/numobd",rd_numobd, 0},
186 {"status/activeobd", rd_activeobd, 0},
187 {"status/objects", rd_numobjects, 0},
188 {"status/objectsfree", rd_objfree, 0},
189 {"status/objectgroups", rd_objgroups, 0},
190 {"status/blocksize", rd_blksize, 0},
191 {"status/blockstotal", rd_blktotal, 0},
192 {"status/kbytesfree", rd_kbfree, 0},
193 {"status/blocksfree", rd_blkfree, 0},
194 {"status/target_obd", rd_target, 0},
195 {"status/target_mdc", rd_mdc, 0},
199 int rd_numdevices(char* page, char **start, off_t off,
200 int count, int *eof, void *data)
202 struct obd_type* class=(struct obd_type*)data;
204 len+=snprintf(page, count, "%d\n", class->typ_refcnt);
208 struct lprocfs_vars status_class_var[]={
209 {"status/num_devices", rd_numdevices, 0},