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/lprocfs_status.h>
25 #include <linux/obd_class.h>
28 struct lprocfs_vars lprocfs_module_vars[] = { {0} };
29 struct lprocfs_vars lprocfs_obd_vars[] = { {0} };
32 DEFINE_LPROCFS_STATFS_FCT(rd_blksize, obd_self_statfs);
33 DEFINE_LPROCFS_STATFS_FCT(rd_kbytestotal, obd_self_statfs);
34 DEFINE_LPROCFS_STATFS_FCT(rd_kbytesfree, obd_self_statfs);
35 DEFINE_LPROCFS_STATFS_FCT(rd_filestotal, obd_self_statfs);
36 DEFINE_LPROCFS_STATFS_FCT(rd_filesfree, obd_self_statfs);
37 DEFINE_LPROCFS_STATFS_FCT(rd_filegroups, obd_self_statfs);
39 int rd_stripesize(char *page, char **start, off_t off, int count, int *eof,
42 struct obd_device *dev = (struct obd_device *)data;
43 struct lov_desc *desc = &dev->u.lov.desc;
46 return snprintf(page, count, LPU64"\n", desc->ld_default_stripe_size);
49 int rd_stripeoffset(char *page, char **start, off_t off, int count, int *eof,
52 struct obd_device *dev = (struct obd_device *)data;
53 struct lov_desc *desc = &dev->u.lov.desc;
56 return snprintf(page, count, LPU64"\n", desc->ld_default_stripe_offset);
59 int rd_stripetype(char *page, char **start, off_t off, int count, int *eof,
62 struct obd_device* dev = (struct obd_device*)data;
63 struct lov_desc *desc = &dev->u.lov.desc;
66 return snprintf(page, count, "%u\n", desc->ld_pattern);
69 int rd_stripecount(char *page, char **start, off_t off, int count, int *eof,
72 struct obd_device *dev = (struct obd_device *)data;
73 struct lov_desc *desc = &dev->u.lov.desc;
76 return snprintf(page, count, "%u\n", desc->ld_default_stripe_count);
79 int rd_numobd(char *page, char **start, off_t off, int count, int *eof,
82 struct obd_device *dev = (struct obd_device*)data;
83 struct lov_desc *desc = &dev->u.lov.desc;
86 return snprintf(page, count, "%u\n", desc->ld_tgt_count);
90 int rd_activeobd(char *page, char **start, off_t off, int count, int *eof,
93 struct obd_device* dev = (struct obd_device*)data;
94 struct lov_desc *desc = &dev->u.lov.desc;
97 return snprintf(page, count, "%u\n", desc->ld_active_tgt_count);
100 int rd_target(char *page, char **start, off_t off, int count, int *eof,
103 struct obd_device *dev = (struct obd_device*) data;
105 struct lov_obd *lov = &dev->u.lov;
106 struct lov_tgt_desc *tgts = lov->tgts;
108 for (i = 0; i < lov->desc.ld_tgt_count; i++, tgts++) {
110 cur = snprintf(&page[len], count, "%d: %s %sACTIVE\n",
111 i, tgts->uuid.uuid, tgts->active ? "" : "IN");
120 int rd_mdc(char *page, char **start, off_t off, int count, int *eof, void *data)
122 struct obd_device *dev = (struct obd_device*) data;
123 struct lov_obd *lov = &dev->u.lov;
126 return snprintf(page, count, "%s\n", lov->mdcobd->obd_uuid.uuid);
129 struct lprocfs_vars lprocfs_obd_vars[] = {
130 { "uuid", lprocfs_rd_uuid, 0, 0 },
131 { "stripesize", rd_stripesize, 0, 0 },
132 { "stripeoffset", rd_stripeoffset, 0, 0 },
133 { "stripecount", rd_stripecount, 0, 0 },
134 { "stripetype", rd_stripetype, 0, 0 },
135 { "numobd", rd_numobd, 0, 0 },
136 { "activeobd", rd_activeobd, 0, 0 },
137 { "filestotal", rd_filestotal, 0, 0 },
138 { "filesfree", rd_filesfree, 0, 0 },
139 { "filegroups", rd_filegroups, 0, 0 },
140 { "blocksize", rd_blksize, 0, 0 },
141 { "kbytestotal", rd_kbytestotal, 0, 0 },
142 { "kbytesfree", rd_kbytesfree, 0, 0 },
143 { "target_obd", rd_target, 0, 0 },
144 { "target_mdc", rd_mdc, 0, 0 },
148 struct lprocfs_vars lprocfs_module_vars[] = {
149 { "num_refs", lprocfs_rd_numrefs, 0, 0 },
154 LPROCFS_INIT_VARS(lprocfs_module_vars, lprocfs_obd_vars)