X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Fobdfilter%2Flproc_obdfilter.c;h=308b8f294f8e9319ff8992e7299c089df391f13c;hb=c5050e412572b00cbe93d8517d2d1f767bebfa92;hp=a97605dd50489fcca9b6cee1a7991ead6e0e6172;hpb=e100c2f1e90dbc1df50b599065e2d75c62b6ebd3;p=fs%2Flustre-release.git diff --git a/lustre/obdfilter/lproc_obdfilter.c b/lustre/obdfilter/lproc_obdfilter.c index a97605d..308b8f2 100644 --- a/lustre/obdfilter/lproc_obdfilter.c +++ b/lustre/obdfilter/lproc_obdfilter.c @@ -1,7 +1,7 @@ /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * - * Copyright (C) 2002 Cluster File Systems, Inc. + * Copyright (C) 2002, 2003 Cluster File Systems, Inc. * * This file is part of Lustre, http://www.lustre.org. * @@ -20,114 +20,60 @@ * */ #define DEBUG_SUBSYSTEM S_CLASS -#include -#include -#include -#include -#include -int rd_uuid(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ - int len=0; - struct obd_device* dev=(struct obd_device*)data; - len+=snprintf(page, count, "%s\n", dev->obd_uuid); - return len; - - - -} -int rd_blksize(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device* temp=(struct obd_device*)data; - struct statfs mystats; +#include +#include +#include - int rc, len=0; +#include "filter_internal.h" - rc = vfs_statfs(temp->u.filter.fo_sb, &mystats); - if (rc) { - CERROR("obdfilter: statfs failed: rc %d\n", rc); - return 0; - } - len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_bsize)); - return len; - +#ifndef LPROCFS +static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; +static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; +#else -} -int rd_blktotal(char* page, char **start, off_t off, - int count, int *eof, void *data) +static int lprocfs_filter_rd_mntdev(char *page, char **start, off_t off, + int count, int *eof, void *data) { - struct obd_device* temp=(struct obd_device*)data; - struct statfs mystats; - - int rc, len=0; + struct obd_device* obd = (struct obd_device *)data; - rc = vfs_statfs(temp->u.filter.fo_sb, &mystats); - if (rc) { - CERROR("obdfilter: statfs failed: rc %d\n", rc); - return 0; - } - len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_blocks)); - return len; + LASSERT(obd != NULL); + LASSERT(obd->u.filter.fo_vfsmnt->mnt_devname); + *eof = 1; + return snprintf(page, count, "%s\n", + obd->u.filter.fo_vfsmnt->mnt_devname); } -int rd_blkfree(char* page, char **start, off_t off, - int count, int *eof, void *data) +static int lprocfs_filter_rd_last_id(char *page, char **start, off_t off, + int count, int *eof, void *data) { - struct obd_device* temp=(struct obd_device*)data; - struct statfs mystats; - - int rc, len=0; + struct obd_device *obd = data; - rc = vfs_statfs(temp->u.filter.fo_sb, &mystats); - if (rc) { - CERROR("obdfilter: statfs failed: rc %d\n", rc); + if (obd == NULL) return 0; - } - len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_bfree)); - return len; -} - -int rd_kbfree(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device* temp=(struct obd_device*)data; - struct statfs mystats; - - int rc, len=0, blk_size=0; - - rc = vfs_statfs(temp->u.filter.fo_sb, &mystats); - if (rc) { - CERROR("obdfilter: statfs failed: rc %d\n", rc); - return 0; - } - blk_size=mystats.f_bsize; - len+=snprintf(page, count, LPU64"\n", \ - (__u64)((mystats.f_bfree)/(blk_size*1024))); - return len; - + return snprintf(page, count, LPU64"\n", + filter_last_id(&obd->u.filter, 0)); } -int rd_fstype(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ - - struct obd_device* temp=(struct obd_device*)data; - int len=0; - - len+=snprintf(page, count, "%s\n", temp->u.filter.fo_fstype); - return len; - -} +static struct lprocfs_vars lprocfs_obd_vars[] = { + { "uuid", lprocfs_rd_uuid, 0, 0 }, + { "blocksize", lprocfs_rd_blksize, 0, 0 }, + { "kbytestotal", lprocfs_rd_kbytestotal, 0, 0 }, + { "kbytesfree", lprocfs_rd_kbytesfree, 0, 0 }, + { "filestotal", lprocfs_rd_filestotal, 0, 0 }, + { "filesfree", lprocfs_rd_filesfree, 0, 0 }, + //{ "filegroups", lprocfs_rd_filegroups, 0, 0 }, + { "fstype", lprocfs_rd_fstype, 0, 0 }, + { "mntdev", lprocfs_filter_rd_mntdev, 0, 0 }, + { "last_id", lprocfs_filter_rd_last_id, 0, 0 }, + { 0 } +}; -lprocfs_vars_t snmp_var_nm_1[]={ - {"snmp/uuid", rd_uuid, 0}, - {"snmp/f_blocksize",rd_blksize, 0}, - {"snmp/f_blockstotal",rd_blktotal, 0}, - {"snmp/f_blocksfree",rd_blkfree, 0}, - {"snmp/f_kbytesfree", rd_kbfree, 0}, - {"snmp/f_fstype", rd_fstype, 0}, - {0} +static struct lprocfs_vars lprocfs_module_vars[] = { + { "num_refs", lprocfs_rd_numrefs, 0, 0 }, + { 0 } }; + +#endif /* LPROCFS */ +LPROCFS_INIT_VARS(filter,lprocfs_module_vars, lprocfs_obd_vars)