From: braam Date: Fri, 1 Nov 2002 22:28:24 +0000 (+0000) Subject: - make rename fixes compatible with older kernels X-Git-Tag: v1_7_100~1^90~149 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=35b9a89205d6df2bf611e4e12c15ce526b3ea302;p=fs%2Flustre-release.git - make rename fixes compatible with older kernels - pick up fixes to head --- diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index efa28f3..428bd43 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -20,13 +20,10 @@ * */ #define DEBUG_SUBSYSTEM S_LLITE -#include -#include + #include -#include -#include -#include -#include +#include + int rd_path(char* page, char **start, off_t off, @@ -92,13 +89,13 @@ int rd_kbfree(char* page, char **start, off_t off, (sb->s_op->statfs)(sb, &mystats); blk_size=mystats.f_bsize; - len+=snprintf(page, count, LPU64"\n", \ + len+=snprintf(page, count, LPU64"\n", (__u64)((mystats.f_bfree)/(blk_size*1024))); return len; } -int rd_numobjects(char* page, char **start, off_t off, +int rd_filestotal(char* page, char **start, off_t off, int count, int *eof, void *data) { @@ -114,7 +111,7 @@ int rd_numobjects(char* page, char **start, off_t off, return len; } -int rd_objfree(char* page, char **start, off_t off, +int rd_filesfree(char* page, char **start, off_t off, int count, int *eof, void *data) { @@ -130,7 +127,7 @@ int rd_objfree(char* page, char **start, off_t off, return len; } -int rd_objgroups(char* page, char **start, off_t off, +int rd_filegroups(char* page, char **start, off_t off, int count, int *eof, void *data) { return 0; @@ -164,16 +161,16 @@ int rd_dev_uuid(char* page, char **start, off_t off, } -lprocfs_vars_t snmp_var_nm_1[]={ - {"snmp/uuid", rd_uuid, 0}, - {"snmp/mntpt_path", rd_path, 0}, - {"snmp/fs_type", rd_fstype, 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_objects", rd_numobjects, 0}, - {"snmp/f_objectsfree", rd_objfree, 0}, - {"snmp/f_objectgroups", rd_objgroups, 0}, +lprocfs_vars_t status_var_nm_1[]={ + {"status/uuid", rd_uuid, 0}, + {"status/mntpt_path", rd_path, 0}, + {"status/fs_type", rd_fstype, 0}, + {"status/blocksize",rd_blksize, 0}, + {"status/blockstotal",rd_blktotal, 0}, + {"status/blocksfree",rd_blkfree, 0}, + {"status/kbytesfree", rd_kbfree, 0}, + {"status/filestotal", rd_filestotal, 0}, + {"status/filesfree", rd_filesfree, 0}, + {"status/filegroups", rd_filegroups, 0}, {0} }; diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c index 5e15f60..8198dc6 100644 --- a/lustre/lov/lproc_lov.c +++ b/lustre/lov/lproc_lov.c @@ -20,15 +20,12 @@ * */ #define DEBUG_SUBSYSTEM S_CLASS -#include -#include -#include -#include -#include +#include +#include /* - * Common SNMP namespace + * Common STATUS namespace */ int rd_uuid(char* page, char **start, off_t off, @@ -47,43 +44,66 @@ int rd_stripesize(char* page, char **start, off_t off, struct obd_device* dev=(struct obd_device*)data; int len=0; struct lov_obd* lov=&dev->u.lov; - len+=snprintf(page, count, LPU64"\n", \ - (__u64)(lov->desc.ld_default_stripe_count)); + len+=snprintf(page, count, LPU64"\n", + (__u64)(lov->desc.ld_default_stripe_size)); return len; } -int rd_stripedepth(char* page, char **start, off_t off, +int rd_stripeoffset(char* page, char **start, off_t off, int count, int *eof, void *data) { struct obd_device* dev=(struct obd_device*)data; int len=0; struct lov_obd* lov=&dev->u.lov; - len+=snprintf(page, count, LPU64"\n", \ - lov->desc.ld_default_stripe_size); + len+=snprintf(page, count, LPU64"\n", + lov->desc.ld_default_stripe_offset); return len; } -int rd_stripefactor(char* page, char **start, off_t off, + +int rd_stripetype(char* page, char **start, off_t off, int count, int *eof, void *data) { struct obd_device* dev=(struct obd_device*)data; int len=0; struct lov_obd* lov=&dev->u.lov; - len+=snprintf(page, count, LPU64"\n", \ - lov->desc.ld_default_stripe_offset); + len+=snprintf(page, count, LPU64"\n", + (__u64)(lov->desc.ld_pattern)); return len; } +int rd_stripecount(char* page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_device* dev=(struct obd_device*)data; + int len=0; + struct lov_obd* lov=&dev->u.lov; + len+=snprintf(page, count, LPU64"\n", + (__u64)(lov->desc.ld_default_stripe_count)); + return len; -int rd_stripetype(char* page, char **start, off_t off, +} +int rd_numobd(char* page, char **start, off_t off, int count, int *eof, void *data) { struct obd_device* dev=(struct obd_device*)data; int len=0; struct lov_obd* lov=&dev->u.lov; - len+=snprintf(page, count, LPU64"\n", \ - (__u64)(lov->desc.ld_pattern)); + len+=snprintf(page, count, LPU64"\n", + (__u64)(lov->desc.ld_tgt_count)); + return len; + +} + +int rd_activeobd(char* page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_device* dev=(struct obd_device*)data; + int len=0; + struct lov_obd* lov=&dev->u.lov; + len+=snprintf(page, count, LPU64"\n", + (__u64)(lov->desc.ld_active_tgt_count)); return len; } @@ -139,10 +159,7 @@ int rd_target(char* page, char **start, off_t off, struct lov_obd* lov=&dev->u.lov; struct lov_tgt_desc* tgts=lov->tgts; while(idesc.ld_tgt_count){ - len+=snprintf(page, count, \ - "OBD Device [%d] UUID: %s\n", \ - i, tgts->uuid); - + len+=snprintf(page, count, "%d: %s\n", i, tgts->uuid); i++; tgts++; } @@ -155,26 +172,40 @@ int rd_mdc(char* page, char **start, off_t off, struct obd_device* dev=(struct obd_device*)data; int len=0; struct lov_obd* lov=&dev->u.lov; - len+=snprintf(page, count, \ - "%s\n", \ - lov->mdcobd->obd_uuid); + len+=snprintf(page, count, "%s\n", lov->mdcobd->obd_uuid); + return len; +} + +lprocfs_vars_t status_var_nm_1[]={ + {"status/uuid", rd_uuid, 0}, + {"status/stripesize",rd_stripesize, 0}, + {"status/stripeoffset",rd_stripeoffset, 0}, + {"status/stripecount",rd_stripecount, 0}, + {"status/stripetype", rd_stripetype, 0}, + {"status/numobd",rd_numobd, 0}, + {"status/activeobd", rd_activeobd, 0}, + {"status/objects", rd_numobjects, 0}, + {"status/objectsfree", rd_objfree, 0}, + {"status/objectgroups", rd_objgroups, 0}, + {"status/blocksize", rd_blksize, 0}, + {"status/blockstotal", rd_blktotal, 0}, + {"status/kbytesfree", rd_kbfree, 0}, + {"status/blocksfree", rd_blkfree, 0}, + {"status/target_obd", rd_target, 0}, + {"status/target_mdc", rd_mdc, 0}, + + {0} +}; +int rd_numdevices(char* page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_type* class=(struct obd_type*)data; + int len=0; + len+=snprintf(page, count, "%d\n", class->typ_refcnt); return len; } -lprocfs_vars_t snmp_var_nm_1[]={ - {"snmp/uuid", rd_uuid, 0}, - {"snmp/lov_stripesize",rd_stripesize, 0}, - {"snmp/lov_stripedepth",rd_stripedepth, 0}, - {"snmp/lov_stripefactor",rd_stripefactor, 0}, - {"snmp/lov_stripetype", rd_stripetype, 0}, - {"snmp/f_objects", rd_numobjects, 0}, - {"snmp/f_objectsfree", rd_objfree, 0}, - {"snmp/f_objectgroups", rd_objgroups, 0}, - {"snmp/f_blocksize", rd_blksize, 0}, - {"snmp/f_blockstotal", rd_blktotal, 0}, - {"snmp/f_kbytesfree", rd_kbfree, 0}, - {"snmp/f_blocksfree", rd_blkfree, 0}, - {"snmp/target_obd", rd_target, 0}, - {"snmp/target_mdc", rd_mdc, 0}, +lprocfs_vars_t status_class_var[]={ + {"status/num_devices", rd_numdevices, 0}, {0} }; diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c index 1497b9e..54d1d4c 100644 --- a/lustre/mdc/lproc_mdc.c +++ b/lustre/mdc/lproc_mdc.c @@ -20,11 +20,10 @@ * */ #define DEBUG_SUBSYSTEM S_CLASS -#include -#include -#include -#include -#include + +#include +#include + int rd_uuid(char* page, char **start, off_t off, int count, int *eof, void *data) @@ -40,16 +39,11 @@ int rd_uuid(char* page, char **start, off_t off, int rd_blksize(char* page, char **start, off_t off, int count, int *eof, void *data) { - return 0; -} -int rd_blktotal(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; -} -int rd_blkfree(char* page, char **start, off_t off, +} +int rd_kbtotal(char* page, char **start, off_t off, int count, int *eof, void *data) { return 0; @@ -61,19 +55,20 @@ int rd_kbfree(char* page, char **start, off_t off, return 0; } -int rd_numobjects(char* page, char **start, off_t off, + +int rd_files(char* page, char **start, off_t off, int count, int *eof, void *data) { return 0; } -int rd_objfree(char* page, char **start, off_t off, +int rd_filesfree(char* page, char **start, off_t off, int count, int *eof, void *data) { return 0; } -int rd_objgroups(char* page, char **start, off_t off, +int rd_filegroups(char* page, char **start, off_t off, int count, int *eof, void *data) { return 0; @@ -106,16 +101,28 @@ int rd_server_name(char* page, char **start, off_t off, } -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_objects", rd_numobjects, 0}, - {"snmp/f_objectsfree", rd_objfree, 0}, - {"snmp/f_objectgroups", rd_objgroups, 0}, - {"snmp/server_uuid", rd_server_uuid, 0}, - {"snmp/conn_uuid", rd_conn_uuid, 0}, +lprocfs_vars_t status_var_nm_1[]={ + {"status/uuid", rd_uuid, 0}, + {"status/blocksize",rd_blksize, 0}, + {"status/kbytestotal",rd_kbtotal, 0}, + {"status/kbytesfree", rd_kbfree, 0}, + {"status/files", rd_files, 0}, + {"status/filesfree", rd_filesfree, 0}, + {"status/filegroups", rd_filegroups, 0}, + {"status/server_uuid", rd_server_uuid, 0}, + {"status/conn_uuid", rd_conn_uuid, 0}, + {0} +}; +int rd_numdevices(char* page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_type* class=(struct obd_type*)data; + int len=0; + len+=snprintf(page, count, "%d\n", class->typ_refcnt); + return len; +} + +lprocfs_vars_t status_class_var[]={ + {"status/num_devices", rd_numdevices, 0}, {0} }; diff --git a/lustre/mds/lproc_mds.c b/lustre/mds/lproc_mds.c index 9302240..a65816f 100644 --- a/lustre/mds/lproc_mds.c +++ b/lustre/mds/lproc_mds.c @@ -20,11 +20,10 @@ * */ #define DEBUG_SUBSYSTEM S_CLASS -#include -#include -#include -#include -#include + +#include +#include + int rd_uuid(char* page, char **start, off_t off, int count, int *eof, void *data) @@ -101,7 +100,7 @@ int rd_kbfree(char* page, char **start, off_t off, return 0; } blk_size=mystats.f_bsize; - len+=snprintf(page, count, LPU64"\n", \ + len+=snprintf(page, count, LPU64"\n", (__u64)((mystats.f_bfree)/(blk_size*1024))); return len; @@ -132,8 +131,7 @@ int rd_ffiles(char* page, char **start, off_t off, return 0; } - len+=snprintf(page, count, LPU64"\n", \ - (__u64)(mystats.f_files)); + len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_files)); return len; @@ -153,8 +151,7 @@ int rd_inodesfree(char* page, char **start, off_t off, return 0; } - len+=snprintf(page, count, LPU64"\n", \ - (__u64)(mystats.f_ffree)); + len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.f_ffree)); return len; } @@ -163,15 +160,28 @@ int rd_filesets(char* page, char **start, off_t off, { return 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}, - {"snmp/f_files", rd_ffiles, 0}, - {"snmp/f_inodesfree", rd_inodesfree, 0}, - {"snmp/f_filesets", rd_filesets, 0}, +lprocfs_vars_t status_var_nm_1[]={ + {"status/uuid", rd_uuid, 0}, + {"status/f_blocksize",rd_blksize, 0}, + {"status/f_blockstotal",rd_blktotal, 0}, + {"status/f_blocksfree",rd_blkfree, 0}, + {"status/f_kbytesfree", rd_kbfree, 0}, + {"status/f_fstype", rd_fstype, 0}, + {"status/f_files", rd_ffiles, 0}, + {"status/f_inodesfree", rd_inodesfree, 0}, + {"status/f_filesets", rd_filesets, 0}, + {0} +}; +int rd_numdevices(char* page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_type* class=(struct obd_type*)data; + int len=0; + len+=snprintf(page, count, "%d\n", class->typ_refcnt); + return len; +} + +lprocfs_vars_t status_class_var[]={ + {"status/num_devices", rd_numdevices, 0}, {0} }; diff --git a/lustre/obdecho/lproc_echo.c b/lustre/obdecho/lproc_echo.c index 96ecf7f..4592f6b 100644 --- a/lustre/obdecho/lproc_echo.c +++ b/lustre/obdecho/lproc_echo.c @@ -19,12 +19,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ -#define DEBUG_SUBSYSTEM S_CLASS -#include -#include -#include -#include -#include +#define DEBUG_SUBSYSTEM S_ECHO + +#include +#include + int rd_uuid(char* page, char **start, off_t off, int count, int *eof, void *data) @@ -47,8 +46,22 @@ int rd_fstype(char* page, char **start, off_t off, } -lprocfs_vars_t snmp_var_nm_1[]={ - {"snmp/uuid", rd_uuid, 0}, - {"snmp/fstype", rd_fstype, 0}, +lprocfs_vars_t status_var_nm_1[]={ + {"status/uuid", rd_uuid, 0}, + {"status/fstype", rd_fstype, 0}, + {0} +}; + +int rd_numdevices(char* page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_type* class=(struct obd_type*)data; + int len=0; + len+=snprintf(page, count, "%d\n", class->typ_refcnt); + return len; +} + +lprocfs_vars_t status_class_var[]={ + {"status/num_devices", rd_numdevices, 0}, {0} }; diff --git a/lustre/obdfilter/lproc_obdfilter.c b/lustre/obdfilter/lproc_obdfilter.c index a97605d..ab37589 100644 --- a/lustre/obdfilter/lproc_obdfilter.c +++ b/lustre/obdfilter/lproc_obdfilter.c @@ -20,11 +20,10 @@ * */ #define DEBUG_SUBSYSTEM S_CLASS -#include -#include -#include -#include -#include + +#include +#include + int rd_uuid(char* page, char **start, off_t off, int count, int *eof, void *data) @@ -43,91 +42,110 @@ int rd_blksize(char* page, char **start, off_t off, struct obd_device* temp=(struct obd_device*)data; struct statfs mystats; - int rc, len=0; + int len=0; - 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)); + vfs_statfs(temp->u.filter.fo_sb, &mystats); + + len+=snprintf(page, count, "%ld\n", mystats.f_bsize); return len; } -int rd_blktotal(char* page, char **start, off_t off, +int rd_kbtotal(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 len=0; + __u64 result; - int rc, len=0; + vfs_statfs(temp->u.filter.fo_sb, &mystats); + + result=((__u64)(mystats.f_blocks*mystats.f_bsize))>>10; + + len+=snprintf(page, count, LPU64"\n", result); - 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; } -int rd_blkfree(char* page, char **start, off_t off, +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; + int len=0; + __u64 result; + + vfs_statfs(temp->u.filter.fo_sb, &mystats); + result=((__u64)(mystats.f_bfree*mystats.f_bsize))>>10; - 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_bfree)); + len+=snprintf(page, count, LPU64"\n", result); return len; } -int rd_kbfree(char* page, char **start, off_t off, +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; + +} +int rd_files(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; + int len=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; + vfs_statfs(temp->u.filter.fo_sb, &mystats); - len+=snprintf(page, count, LPU64"\n", \ - (__u64)((mystats.f_bfree)/(blk_size*1024))); + len+=snprintf(page, count, "%ld\n", mystats.f_files); return len; - } -int rd_fstype(char* page, char **start, off_t off, +int rd_filesfree(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 len=0; - len+=snprintf(page, count, "%s\n", temp->u.filter.fo_fstype); + vfs_statfs(temp->u.filter.fo_sb, &mystats); + + len+=snprintf(page, count, "%ld\n", mystats.f_ffree); return len; + +} + +lprocfs_vars_t status_var_nm_1[]={ + {"status/uuid", rd_uuid, 0}, + {"status/blocksize",rd_blksize, 0}, + {"status/kbytestotal",rd_kbtotal, 0}, + {"status/kbytesfree", rd_kbfree, 0}, + {"status/files", rd_files, 0}, + {"status/filesfree", rd_filesfree, 0}, + {"status/fstype", rd_fstype, 0}, + {0} +}; +int rd_numdevices(char* page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_type* class=(struct obd_type*)data; + int len=0; + len+=snprintf(page, count, "%d\n", class->typ_refcnt); + return len; } -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}, +lprocfs_vars_t status_class_var[]={ + {"status/num_devices", rd_numdevices, 0}, {0} }; diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 698184c..0ee8873 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -20,11 +20,9 @@ * */ #define DEBUG_SUBSYSTEM S_CLASS -#include -#include -#include -#include -#include + +#include +#include int rd_uuid(char* page, char **start, off_t off, int count, int *eof, void *data) @@ -100,16 +98,29 @@ int rd_conn_uuid(char* page, char **start, off_t off, } -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_objects", rd_numobjects, 0}, - {"snmp/f_objectsfree", rd_objfree, 0}, - {"snmp/f_objectgroups", rd_objgroups, 0}, - {"snmp/ost_server_uuid", rd_server_uuid, 0}, - {"snmp/ost_conn_uuid", rd_conn_uuid, 0}, +lprocfs_vars_t status_var_nm_1[]={ + {"status/uuid", rd_uuid, 0}, + {"status/f_blocksize",rd_blksize, 0}, + {"status/f_blockstotal",rd_blktotal, 0}, + {"status/f_blocksfree",rd_blkfree, 0}, + {"status/f_kbytesfree", rd_kbfree, 0}, + {"status/f_objects", rd_numobjects, 0}, + {"status/f_objectsfree", rd_objfree, 0}, + {"status/f_objectgroups", rd_objgroups, 0}, + {"status/ost_server_uuid", rd_server_uuid, 0}, + {"status/ost_conn_uuid", rd_conn_uuid, 0}, + {0} +}; +int rd_numdevices(char* page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_type* class=(struct obd_type*)data; + int len=0; + len+=snprintf(page, count, "%d\n", class->typ_refcnt); + return len; +} + +lprocfs_vars_t status_class_var[]={ + {"status/num_devices", rd_numdevices, 0}, {0} }; diff --git a/lustre/ost/lproc_ost.c b/lustre/ost/lproc_ost.c index 8a8f1e1..8878ad0 100644 --- a/lustre/ost/lproc_ost.c +++ b/lustre/ost/lproc_ost.c @@ -20,14 +20,10 @@ * */ #define DEBUG_SUBSYSTEM S_OST -#include -#include -#include -#include -#include -/* Required for 64 bit division */ -#include +#include +#include + int rd_uuid(char* page, char **start, off_t off, int count, int *eof, void *data) @@ -48,57 +44,43 @@ int rd_blksize(char* page, char **start, off_t off, struct ost_obd *ost=&temp->u.ost; struct lustre_handle *conn=&ost->ost_conn; struct obd_statfs mystats; - int rc, len=0; + int len=0; - rc = obd_statfs(conn, &mystats); - if (rc) { - CERROR("ost: statfs failed: rc %d\n", rc); - return 0; - } - len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.os_bsize)); + obd_statfs(conn, &mystats); + len+=snprintf(page, count, "%d\n", mystats.os_bsize); return len; } -int rd_blktotal(char* page, char **start, off_t off, +int rd_kbtotal(char* page, char **start, off_t off, int count, int *eof, void *data) { - struct obd_device* temp=(struct obd_device*)data; struct ost_obd *ost=&temp->u.ost; struct lustre_handle *conn=&ost->ost_conn; struct obd_statfs mystats; - int rc, len=0; + int len=0; + __u32 blk_size; + __u64 result; - rc = obd_statfs(conn, &mystats); - if (rc) { - CERROR("ost: statfs failed: rc %d\n", rc); - return 0; - } - len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.os_blocks)); - return len; -} + obd_statfs(conn, &mystats); -int rd_blkfree(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ + blk_size=mystats.os_bsize; + blk_size>>=10; - struct obd_device* temp=(struct obd_device*)data; - struct ost_obd *ost=&temp->u.ost; - struct lustre_handle *conn=&ost->ost_conn; - struct obd_statfs mystats; - int rc, len=0; + result=mystats.os_blocks; - rc = obd_statfs(conn, &mystats); - if (rc) { - CERROR("ost: statfs failed: rc %d\n", rc); - return 0; + while(blk_size>>=1){ + result<<=1; } - len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.os_bfree)); + + len+=snprintf(page, count, LPU64"\n", result); return len; + } + int rd_kbfree(char* page, char **start, off_t off, int count, int *eof, void *data) { @@ -107,30 +89,27 @@ int rd_kbfree(char* page, char **start, off_t off, struct ost_obd *ost=&temp->u.ost; struct lustre_handle *conn=&ost->ost_conn; struct obd_statfs mystats; - int rc, len=0; + int len=0; __u32 blk_size; __u64 result; - __u32 remainder; - rc = obd_statfs(conn, &mystats); - if (rc) { - CERROR("ost: statfs failed: rc %d\n", rc); - return 0; - } + obd_statfs(conn, &mystats); + blk_size=mystats.os_bsize; - blk_size*=1024; + blk_size>>=10; + result=mystats.os_bfree; - remainder=do_div(result, blk_size); - len+=snprintf(page, count, LPU64"\n", \ - result); + while(blk_size>>=1){ + result<<=1; + } + len+=snprintf(page, count, LPU64"\n", result); return len; - } -int rd_numobjects(char* page, char **start, off_t off, +int rd_files(char* page, char **start, off_t off, int count, int *eof, void *data) { @@ -138,19 +117,16 @@ int rd_numobjects(char* page, char **start, off_t off, struct ost_obd *ost=&temp->u.ost; struct lustre_handle *conn=&ost->ost_conn; struct obd_statfs mystats; - int rc, len=0; + int len=0; - rc = obd_statfs(conn, &mystats); - if (rc) { - CERROR("ost: statfs failed: rc %d\n", rc); - return 0; - } - len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.os_files)); + obd_statfs(conn, &mystats); + + len+=snprintf(page, count, LPU64"\n",mystats.os_files); return len; } -int rd_objfree(char* page, char **start, off_t off, +int rd_filesfree(char* page, char **start, off_t off, int count, int *eof, void *data) { @@ -158,14 +134,10 @@ int rd_objfree(char* page, char **start, off_t off, struct ost_obd *ost=&temp->u.ost; struct lustre_handle *conn=&ost->ost_conn; struct obd_statfs mystats; - int rc, len=0; + int len=0; - rc = obd_statfs(conn, &mystats); - if (rc) { - CERROR("ost: statfs failed: rc %d\n", rc); - return 0; - } - len+=snprintf(page, count, LPU64"\n", (__u64)(mystats.os_ffree)); + obd_statfs(conn, &mystats); + len+=snprintf(page, count, LPU64"\n", mystats.os_ffree); return len; } @@ -176,14 +148,27 @@ int rd_objgroups(char* page, char **start, off_t off, return 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_objects", rd_numobjects, 0}, - {"snmp/f_objectsfree", rd_objfree, 0}, - {"snmp/f_objectgroups", rd_objgroups, 0}, +lprocfs_vars_t status_var_nm_1[]={ + {"status/uuid", rd_uuid, 0}, + {"status/blocksize",rd_blksize, 0}, + {"status/kbytesfree", rd_kbfree, 0}, + {"status/kbytestotal", rd_kbtotal, 0}, + {"status/files", rd_files, 0}, + {"status/filesfree", rd_filesfree, 0}, + {"status/objectgroups", rd_objgroups, 0}, + {0} +}; + +int rd_numdevices(char* page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_type* class=(struct obd_type*)data; + int len=0; + len+=snprintf(page, count, "%d\n", class->typ_refcnt); + return len; +} + +lprocfs_vars_t status_class_var[]={ + {"status/num_devices", rd_numdevices, 0}, {0} }; diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 3e91850..48a8401 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -20,112 +20,34 @@ * */ #define DEBUG_SUBSYSTEM S_CLASS -#include -#include -#include -#include -#include - - +#include +#include int rd_uuid(char* page, char **start, off_t off, int count, int *eof, void *data) { int len=0; - len+=snprintf(page, count, "%s\n", \ + len+=snprintf(page, count, "%s\n", ((struct obd_device*)data)->obd_uuid); return len; } -int rd_blksize(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ - return 0; - -} -int rd_blktotal(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ - return 0; -} - -int rd_blkfree(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ - return 0; -} - -int rd_kbfree(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ - return 0; -} - -int rd_numobjects(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ - return 0; -} - -int rd_objfree(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ - return 0; -} - -int rd_objgroups(char* page, char **start, off_t off, - int count, int *eof, void *data) -{ - return 0; -} - - -int rd_fs_type(char* page, char **start, off_t off, +lprocfs_vars_t status_var_nm_1[]={ + {"status/uuid", rd_uuid, 0}, + {0} +}; +int rd_numdevices(char* page, char **start, off_t off, int count, int *eof, void *data) { - return 0; -} - -int rd_other(char* page, char **start, off_t off, int count, int *eof, - void *data) -{ - return 0; -} - -int rd_string(char* page, char **start, off_t off, int count, int *eof, - void *data) -{ - printk("Hello string"); - return 0; -} - -int lprocfs_ll_wr(struct file* file, const char *buffer, unsigned long count, - void *data) -{ - return 0; -} - -int wr_other(struct file* file, const char *buffer, unsigned long count, - void *data) -{ - return 0; + struct obd_type* class=(struct obd_type*)data; + int len=0; + len+=snprintf(page, count, "%d\n", class->typ_refcnt); + return len; } -int wr_string(struct file* file, const char *buffer, unsigned long count, - void *data) -{ - return 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_objects", rd_numobjects, 0}, - {"snmp/f_objectsfree", rd_objfree, 0}, - {"snmp/f_objectgroups", rd_objgroups, 0}, +lprocfs_vars_t status_class_var[]={ + {"status/num_devices", rd_numdevices, 0}, {0} }; diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 9ad4648..0a6184a 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -1,100 +1,100 @@ -!/bin/sh +!/bin/bash echo '=============================== test 1' mkdir /mnt/lustre/d1 mkdir /mnt/lustre/d1/d2 -sh llmountcleanup.sh +umount /mnt/lustre dmesg | grep -i destruct -sh llmount.sh +../utils/lconf --start 70 local.xml echo '=============================== test 2' mkdir /mnt/lustre/d1 touch /mnt/lustre/d1/f -sh llmountcleanup.sh +umount /mnt/lustre dmesg | grep -i destruct -sh llmount.sh +../utils/lconf --start 70 local.xml echo '===============================' test 3 mkdir /mnt/lustre/d1 umount /mnt/lustre -sh ../utils/lconf --start 70 local.xml +../utils/lconf --start 70 local.xml touch /mnt/lustre/d1/f -sh llmountcleanup.sh +umount /mnt/lustre dmesg | grep -i destruct -sh llmount.sh +../utils/lconf --start 70 local.xml echo '===============================' test 4 mkdir /mnt/lustre/d1 umount /mnt/lustre ../utils/lconf --start 70 local.xml mkdir /mnt/lustre/d1/d2 -sh llmountcleanup.sh +umount /mnt/lustre dmesg | grep -i destruct -sh llmount.sh +../utils/lconf --start 70 local.xml echo '===============================' test 5 mkdir /mnt/lustre/d1 mkdir /mnt/lustre/d1/d2 chmod 0666 /mnt/lustre/d1/d2 -sh llmountcleanup.sh +umount /mnt/lustre dmesg | grep -i destruct -sh llmount.sh +../utils/lconf --start 70 local.xml echo '===============================' test 6 touch /mnt/lustre/f chmod 0666 /mnt/lustre/f -sh llmountcleanup.sh +umount /mnt/lustre dmesg | grep -i destruct -sh llmount.sh +../utils/lconf --start 70 local.xml echo '===============================' test 7 mkdir /mnt/lustre/d ./mcreate /mnt/lustre/d/f chmod 0666 /mnt/lustre/d/f -sh llmountcleanup.sh +umount /mnt/lustre dmesg | grep -i destruct -sh llmount.sh +../utils/lconf --start 70 local.xml echo '===============================' test 8 mkdir /mnt/lustre/d touch /mnt/lustre/d/f chmod 0666 /mnt/lustre/d/f -sh llmountcleanup.sh +umount /mnt/lustre dmesg | grep -i destruct -sh llmount.sh +../utils/lconf --start 70 local.xml echo '===============================' test 9 mkdir /mnt/lustre/d mkdir /mnt/lustre/d/d2 mkdir /mnt/lustre/d/d2/d3 -sh llmountcleanup.sh +umount /mnt/lustre dmesg | grep -i destruct -sh llmount.sh +../utils/lconf --start 70 local.xml echo '===============================' test 10 mkdir /mnt/lustre/d mkdir /mnt/lustre/d/d2 touch /mnt/lustre/d/d2/f -sh llmountcleanup.sh +umount /mnt/lustre dmesg | grep -i destruct -sh llmount.sh +../utils/lconf --start 70 local.xml echo '===============================' test 11 mkdir /mnt/lustre/d mkdir /mnt/lustre/d/d2 chmod 0666 /mnt/lustre/d/d2 chmod 0555 /mnt/lustre/d/d2 -sh llmountcleanup.sh +umount /mnt/lustre dmesg | grep -i destruct -sh llmount.sh +../utils/lconf --start 70 local.xml echo '===============================' test 12 mkdir /mnt/lustre/d touch /mnt/lustre/d/f chmod 0666 /mnt/lustre/d/f chmod 0555 /mnt/lustre/d/f -sh llmountcleanup.sh +umount /mnt/lustre dmesg | grep -i destruct -sh llmount.sh +../utils/lconf --start 70 local.xml