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,
34 struct obd_device* dev = (struct obd_device*)data;
35 return snprintf(page, count, "%s\n", dev->obd_uuid);
38 int rd_stripesize(char *page, char **start, off_t off, int count, int *eof,
41 struct obd_device *dev = (struct obd_device*)data;
42 struct lov_desc *desc = &dev->u.lov.desc;
44 return snprintf(page, count, LPU64"\n", desc->ld_default_stripe_size);
47 int rd_stripeoffset(char *page, char **start, off_t off, int count, int *eof,
50 struct obd_device* dev = (struct obd_device*)data;
51 struct lov_obd* lov = &dev->u.lov;
53 return snprintf(page, count, LPU64"\n",
54 lov->desc.ld_default_stripe_offset);
57 int rd_stripetype(char *page, char **start, off_t off, int count, int *eof,
60 struct obd_device* dev = (struct obd_device*)data;
61 struct lov_obd* lov = &dev->u.lov;
63 return snprintf(page, count, "%u\n", lov->desc.ld_pattern);
66 int rd_stripecount(char *page, char **start, off_t off, int count, int *eof,
69 struct obd_device* dev = (struct obd_device*)data;
70 struct lov_obd* lov = &dev->u.lov;
72 return snprintf(page, count, "%u\n", lov->desc.ld_default_stripe_count);
75 int rd_numobd(char *page, char **start, off_t off, int count, int *eof,
78 struct obd_device *dev = (struct obd_device*)data;
79 struct lov_obd *lov = &dev->u.lov;
81 return snprintf(page, count, "%u\n", lov->desc.ld_tgt_count);
85 int rd_activeobd(char *page, char **start, off_t off, int count, int *eof,
88 struct obd_device* dev = (struct obd_device*)data;
89 struct lov_obd* lov = &dev->u.lov;
91 return snprintf(page, count, "%u\n", lov->desc.ld_active_tgt_count);
94 int rd_blksize(char *page, char **start, off_t off, int count, int *eof,
101 int rd_kbtotal(char *page, char **start, off_t off, int count, int *eof,
108 int rd_kbfree(char *page, char **start, off_t off, int count, int *eof,
114 int rd_filestotal(char *page, char **start, off_t off, int count, int *eof,
120 int rd_filesfree(char* page, char **start, off_t off, int count, int *eof,
126 int rd_filegroups(char* page, char **start, off_t off, int count, int *eof,
132 int rd_target(char *page, char **start, off_t off, int count, int *eof,
135 struct obd_device* dev = (struct obd_device*)data;
137 struct lov_obd* lov = &dev->u.lov;
138 struct lov_tgt_desc* tgts = lov->tgts;
139 while (i < lov->desc.ld_tgt_count) {
140 len += snprintf(&page[len], count - len, "%d: %s %sACTIVE\n",
141 i, tgts->uuid, tgts->active ? "" : "IN");
149 int rd_mdc(char* page, char **start, off_t off, int count, int *eof, void *data)
151 struct obd_device* dev = (struct obd_device*)data;
153 struct lov_obd* lov = &dev->u.lov;
154 len += snprintf(page, count, "%s\n", lov->mdcobd->obd_uuid);
158 struct lprocfs_vars status_var_nm_1[] = {
159 {"status/uuid", rd_uuid, 0, 0},
160 {"status/stripesize",rd_stripesize, 0, 0},
161 {"status/stripeoffset",rd_stripeoffset, 0, 0},
162 {"status/stripecount",rd_stripecount, 0, 0},
163 {"status/stripetype", rd_stripetype, 0, 0},
164 {"status/numobd",rd_numobd, 0, 0},
165 {"status/activeobd", rd_activeobd, 0, 0},
166 {"status/filestotal", rd_filestotal, 0, 0},
167 {"status/filesfree", rd_filesfree, 0, 0},
168 {"status/filegroups", rd_filegroups, 0, 0},
169 {"status/blocksize", rd_blksize, 0, 0},
170 {"status/kbytestotal", rd_kbtotal, 0, 0},
171 {"status/kbytesfree", rd_kbfree, 0, 0},
172 {"status/target_obd", rd_target, 0, 0},
173 {"status/target_mdc", rd_mdc, 0, 0},
177 int rd_numrefs(char *page, char **start, off_t off, int count, int *eof,
180 struct obd_type* class = (struct obd_type*)data;
182 return snprintf(page, count, "%d\n", class->typ_refcnt);
185 struct lprocfs_vars status_class_var[]={
186 {"status/num_refs", rd_numrefs, 0, 0},