From a7369bcd860af61a073cb2424139e3acccdcb203 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Thu, 14 Mar 2013 13:35:36 -0500 Subject: [PATCH] LU-1330 proc: remove osd proc handlers from lprocfs_status.c Move lprocfs_osd_rd_{blksize,{files,kbytes}{free,avail} to dt_object.c and rename them to lprocfs_dt_rd_blksize.... Remove the unused function lprocfs_obd_rd_mntdev(). Do not include lustre_{fsfilt,log,disk}.h or dt_object.h in lprocfs_status.c. Signed-off-by: John L. Hammond Change-Id: Ic54973f8bc6ec1d440fa76aadf0dd13629ce345c Reviewed-on: http://review.whamcloud.com/5721 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger --- lustre/include/dt_object.h | 15 +++++ lustre/include/lprocfs_status.h | 15 ----- lustre/lod/lproc_lod.c | 12 ++-- lustre/obdclass/dt_object.c | 119 ++++++++++++++++++++++++++++++++++++ lustre/obdclass/lprocfs_status.c | 127 --------------------------------------- lustre/osd-ldiskfs/osd_lproc.c | 12 ++-- lustre/osd-zfs/osd_lproc.c | 12 ++-- lustre/osp/lproc_osp.c | 12 ++-- 8 files changed, 158 insertions(+), 166 deletions(-) diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h index 1b8f71b..db982f4 100644 --- a/lustre/include/dt_object.h +++ b/lustre/include/dt_object.h @@ -1480,4 +1480,19 @@ static inline struct dt_thread_info *dt_info(const struct lu_env *env) int dt_global_init(void); void dt_global_fini(void); +# ifdef LPROCFS +int lprocfs_dt_rd_blksize(char *page, char **start, off_t off, + int count, int *eof, void *data); +int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off, + int count, int *eof, void *data); +int lprocfs_dt_rd_kbytesfree(char *page, char **start, off_t off, + int count, int *eof, void *data); +int lprocfs_dt_rd_kbytesavail(char *page, char **start, off_t off, + int count, int *eof, void *data); +int lprocfs_dt_rd_filestotal(char *page, char **start, off_t off, + int count, int *eof, void *data); +int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off, + int count, int *eof, void *data); +# endif /* LPROCFS */ + #endif /* __LUSTRE_DT_OBJECT_H */ diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 390a13c..349a62c 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -690,19 +690,6 @@ extern int lprocfs_rd_filesfree(char *page, char **start, off_t off, int count, int *eof, void *data); extern int lprocfs_rd_filegroups(char *page, char **start, off_t off, int count, int *eof, void *data); -extern int lprocfs_osd_rd_blksize(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_osd_rd_kbytesfree(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_osd_rd_kbytesavail(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_osd_rd_filestotal(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_osd_rd_filesfree(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_osd_rd_kbytestotal(char *page, char **start, off_t off, - int count, int *eof, void *data); - extern int lprocfs_write_helper(const char *buffer, unsigned long count, int *val); @@ -810,8 +797,6 @@ int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off, int lprocfs_obd_wr_recovery_time_hard(struct file *file, const char *buffer, unsigned long count, void *data); -int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off, - int count, int *eof, void *data); int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off, int count, int *eof, void *data); int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer, diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c index d900baa..e168a43 100644 --- a/lustre/lod/lproc_lod.c +++ b/lustre/lod/lproc_lod.c @@ -446,12 +446,12 @@ static struct lprocfs_vars lprocfs_lod_obd_vars[] = { }; static struct lprocfs_vars lprocfs_lod_osd_vars[] = { - { "blocksize", lprocfs_osd_rd_blksize, 0, 0 }, - { "kbytestotal", lprocfs_osd_rd_kbytestotal, 0, 0 }, - { "kbytesfree", lprocfs_osd_rd_kbytesfree, 0, 0 }, - { "kbytesavail", lprocfs_osd_rd_kbytesavail, 0, 0 }, - { "filestotal", lprocfs_osd_rd_filestotal, 0, 0 }, - { "filesfree", lprocfs_osd_rd_filesfree, 0, 0 }, + { "blocksize", lprocfs_dt_rd_blksize, 0, 0 }, + { "kbytestotal", lprocfs_dt_rd_kbytestotal, 0, 0 }, + { "kbytesfree", lprocfs_dt_rd_kbytesfree, 0, 0 }, + { "kbytesavail", lprocfs_dt_rd_kbytesavail, 0, 0 }, + { "filestotal", lprocfs_dt_rd_filestotal, 0, 0 }, + { "filesfree", lprocfs_dt_rd_filesfree, 0, 0 }, { 0 } }; diff --git a/lustre/obdclass/dt_object.c b/lustre/obdclass/dt_object.c index 6389e03..13962cd 100644 --- a/lustre/obdclass/dt_object.c +++ b/lustre/obdclass/dt_object.c @@ -934,3 +934,122 @@ out: return rc; } EXPORT_SYMBOL(dt_index_read); + +#ifdef LPROCFS + +int lprocfs_dt_rd_blksize(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct dt_device *dt = data; + struct obd_statfs osfs; + + int rc = dt_statfs(NULL, dt, &osfs); + if (rc != 0) { + *eof = 1; + rc = snprintf(page, count, "%d\n", + (unsigned) osfs.os_bsize); + } + + return rc; +} +EXPORT_SYMBOL(lprocfs_dt_rd_blksize); + +int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct dt_device *dt = data; + struct obd_statfs osfs; + + int rc = dt_statfs(NULL, dt, &osfs); + if (rc != 0) { + __u32 blk_size = osfs.os_bsize >> 10; + __u64 result = osfs.os_blocks; + + while (blk_size >>= 1) + result <<= 1; + + *eof = 1; + rc = snprintf(page, count, LPU64"\n", result); + } + + return rc; +} +EXPORT_SYMBOL(lprocfs_dt_rd_kbytestotal); + +int lprocfs_dt_rd_kbytesfree(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct dt_device *dt = data; + struct obd_statfs osfs; + + int rc = dt_statfs(NULL, dt, &osfs); + if (rc != 0) { + __u32 blk_size = osfs.os_bsize >> 10; + __u64 result = osfs.os_bfree; + + while (blk_size >>= 1) + result <<= 1; + + *eof = 1; + rc = snprintf(page, count, LPU64"\n", result); + } + + return rc; +} +EXPORT_SYMBOL(lprocfs_dt_rd_kbytesfree); + +int lprocfs_dt_rd_kbytesavail(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct dt_device *dt = data; + struct obd_statfs osfs; + + int rc = dt_statfs(NULL, dt, &osfs); + if (rc != 0) { + __u32 blk_size = osfs.os_bsize >> 10; + __u64 result = osfs.os_bavail; + + while (blk_size >>= 1) + result <<= 1; + + *eof = 1; + rc = snprintf(page, count, LPU64"\n", result); + } + + return rc; +} +EXPORT_SYMBOL(lprocfs_dt_rd_kbytesavail); + +int lprocfs_dt_rd_filestotal(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct dt_device *dt = data; + struct obd_statfs osfs; + + int rc = dt_statfs(NULL, dt, &osfs); + if (rc != 0) { + *eof = 1; + rc = snprintf(page, count, LPU64"\n", osfs.os_files); + } + + return rc; +} +EXPORT_SYMBOL(lprocfs_dt_rd_filestotal); + +int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct dt_device *dt = data; + struct obd_statfs osfs; + + int rc = dt_statfs(NULL, dt, &osfs); + if (rc != 0) { + *eof = 1; + rc = snprintf(page, count, LPU64"\n", osfs.os_ffree); + } + + return rc; +} +EXPORT_SYMBOL(lprocfs_dt_rd_filesfree); + +#endif /* LPROCFS */ diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index a966ed3..a95a731 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -46,11 +46,7 @@ #include #include -#include -#include -#include #include -#include #if defined(LPROCFS) @@ -611,21 +607,6 @@ int lprocfs_rd_blksize(char *page, char **start, off_t off, int count, } EXPORT_SYMBOL(lprocfs_rd_blksize); -int lprocfs_osd_rd_blksize(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct dt_device *dt = data; - struct obd_statfs osfs; - int rc = dt_statfs(NULL, dt, &osfs); - if (!rc) { - *eof = 1; - rc = snprintf(page, count, "%d\n", - (unsigned) osfs.os_bsize); - } - return rc; -} -EXPORT_SYMBOL(lprocfs_osd_rd_blksize); - int lprocfs_rd_kbytestotal(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -648,26 +629,6 @@ int lprocfs_rd_kbytestotal(char *page, char **start, off_t off, int count, } EXPORT_SYMBOL(lprocfs_rd_kbytestotal); -int lprocfs_osd_rd_kbytestotal(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct dt_device *dt = data; - struct obd_statfs osfs; - int rc = dt_statfs(NULL, dt, &osfs); - if (!rc) { - __u32 blk_size = osfs.os_bsize >> 10; - __u64 result = osfs.os_blocks; - - while (blk_size >>= 1) - result <<= 1; - - *eof = 1; - rc = snprintf(page, count, LPU64"\n", result); - } - return rc; -} -EXPORT_SYMBOL(lprocfs_osd_rd_kbytestotal); - int lprocfs_rd_kbytesfree(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -690,26 +651,6 @@ int lprocfs_rd_kbytesfree(char *page, char **start, off_t off, int count, } EXPORT_SYMBOL(lprocfs_rd_kbytesfree); -int lprocfs_osd_rd_kbytesfree(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct dt_device *dt = data; - struct obd_statfs osfs; - int rc = dt_statfs(NULL, dt, &osfs); - if (!rc) { - __u32 blk_size = osfs.os_bsize >> 10; - __u64 result = osfs.os_bfree; - - while (blk_size >>= 1) - result <<= 1; - - *eof = 1; - rc = snprintf(page, count, LPU64"\n", result); - } - return rc; -} -EXPORT_SYMBOL(lprocfs_osd_rd_kbytesfree); - int lprocfs_rd_kbytesavail(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -732,26 +673,6 @@ int lprocfs_rd_kbytesavail(char *page, char **start, off_t off, int count, } EXPORT_SYMBOL(lprocfs_rd_kbytesavail); -int lprocfs_osd_rd_kbytesavail(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct dt_device *dt = data; - struct obd_statfs osfs; - int rc = dt_statfs(NULL, dt, &osfs); - if (!rc) { - __u32 blk_size = osfs.os_bsize >> 10; - __u64 result = osfs.os_bavail; - - while (blk_size >>= 1) - result <<= 1; - - *eof = 1; - rc = snprintf(page, count, LPU64"\n", result); - } - return rc; -} -EXPORT_SYMBOL(lprocfs_osd_rd_kbytesavail); - int lprocfs_rd_filestotal(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -769,21 +690,6 @@ int lprocfs_rd_filestotal(char *page, char **start, off_t off, int count, } EXPORT_SYMBOL(lprocfs_rd_filestotal); -int lprocfs_osd_rd_filestotal(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct dt_device *dt = data; - struct obd_statfs osfs; - int rc = dt_statfs(NULL, dt, &osfs); - if (!rc) { - *eof = 1; - rc = snprintf(page, count, LPU64"\n", osfs.os_files); - } - - return rc; -} -EXPORT_SYMBOL(lprocfs_osd_rd_filestotal); - int lprocfs_rd_filesfree(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -800,20 +706,6 @@ int lprocfs_rd_filesfree(char *page, char **start, off_t off, int count, } EXPORT_SYMBOL(lprocfs_rd_filesfree); -int lprocfs_osd_rd_filesfree(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct dt_device *dt = data; - struct obd_statfs osfs; - int rc = dt_statfs(NULL, dt, &osfs); - if (!rc) { - *eof = 1; - rc = snprintf(page, count, LPU64"\n", osfs.os_ffree); - } - return rc; -} -EXPORT_SYMBOL(lprocfs_osd_rd_filesfree); - int lprocfs_rd_server_uuid(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -2681,25 +2573,6 @@ int lprocfs_obd_wr_recovery_time_hard(struct file *file, const char *buffer, } EXPORT_SYMBOL(lprocfs_obd_wr_recovery_time_hard); -#ifdef HAVE_SERVER_SUPPORT -int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device *obd = (struct obd_device *)data; - struct lustre_mount_info *lmi; - const char *dev_name; - - LASSERT(obd != NULL); - lmi = server_get_mount_2(obd->obd_name); - dev_name = get_mntdev_name(lmi->lmi_sb); - LASSERT(dev_name != NULL); - *eof = 1; - server_put_mount_2(obd->obd_name, lmi->lmi_mnt); - return snprintf(page, count, "%s\n", dev_name); -} -EXPORT_SYMBOL(lprocfs_obd_rd_mntdev); -#endif - int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off, int count, int *eof, void *data) { diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c index 773b3e7..e459411 100644 --- a/lustre/osd-ldiskfs/osd_lproc.c +++ b/lustre/osd-ldiskfs/osd_lproc.c @@ -515,12 +515,12 @@ int lprocfs_osd_wr_readcache(struct file *file, const char *buffer, } struct lprocfs_vars lprocfs_osd_obd_vars[] = { - { "blocksize", lprocfs_osd_rd_blksize, 0, 0 }, - { "kbytestotal", lprocfs_osd_rd_kbytestotal, 0, 0 }, - { "kbytesfree", lprocfs_osd_rd_kbytesfree, 0, 0 }, - { "kbytesavail", lprocfs_osd_rd_kbytesavail, 0, 0 }, - { "filestotal", lprocfs_osd_rd_filestotal, 0, 0 }, - { "filesfree", lprocfs_osd_rd_filesfree, 0, 0 }, + { "blocksize", lprocfs_dt_rd_blksize, 0, 0 }, + { "kbytestotal", lprocfs_dt_rd_kbytestotal, 0, 0 }, + { "kbytesfree", lprocfs_dt_rd_kbytesfree, 0, 0 }, + { "kbytesavail", lprocfs_dt_rd_kbytesavail, 0, 0 }, + { "filestotal", lprocfs_dt_rd_filestotal, 0, 0 }, + { "filesfree", lprocfs_dt_rd_filesfree, 0, 0 }, { "fstype", lprocfs_osd_rd_fstype, 0, 0 }, { "mntdev", lprocfs_osd_rd_mntdev, 0, 0 }, { "force_sync", 0, lprocfs_osd_wr_force_sync }, diff --git a/lustre/osd-zfs/osd_lproc.c b/lustre/osd-zfs/osd_lproc.c index 7befd14..f85accf 100644 --- a/lustre/osd-zfs/osd_lproc.c +++ b/lustre/osd-zfs/osd_lproc.c @@ -168,12 +168,12 @@ static int lprocfs_osd_wr_iused_est(struct file *file, const char *buffer, } struct lprocfs_vars lprocfs_osd_obd_vars[] = { - { "blocksize", lprocfs_osd_rd_blksize, 0, 0 }, - { "kbytestotal", lprocfs_osd_rd_kbytestotal, 0, 0 }, - { "kbytesfree", lprocfs_osd_rd_kbytesfree, 0, 0 }, - { "kbytesavail", lprocfs_osd_rd_kbytesavail, 0, 0 }, - { "filestotal", lprocfs_osd_rd_filestotal, 0, 0 }, - { "filesfree", lprocfs_osd_rd_filesfree, 0, 0 }, + { "blocksize", lprocfs_dt_rd_blksize, 0, 0 }, + { "kbytestotal", lprocfs_dt_rd_kbytestotal, 0, 0 }, + { "kbytesfree", lprocfs_dt_rd_kbytesfree, 0, 0 }, + { "kbytesavail", lprocfs_dt_rd_kbytesavail, 0, 0 }, + { "filestotal", lprocfs_dt_rd_filestotal, 0, 0 }, + { "filesfree", lprocfs_dt_rd_filesfree, 0, 0 }, { "fstype", lprocfs_osd_rd_fstype, 0, 0 }, { "mntdev", lprocfs_osd_rd_mntdev, 0, 0 }, { "force_sync", 0, lprocfs_osd_wr_force_sync }, diff --git a/lustre/osp/lproc_osp.c b/lustre/osp/lproc_osp.c index b84b453..422ab57 100644 --- a/lustre/osp/lproc_osp.c +++ b/lustre/osp/lproc_osp.c @@ -462,12 +462,12 @@ static struct lprocfs_vars lprocfs_osp_obd_vars[] = { }; static struct lprocfs_vars lprocfs_osp_osd_vars[] = { - { "blocksize", lprocfs_osd_rd_blksize, 0, 0 }, - { "kbytestotal", lprocfs_osd_rd_kbytestotal, 0, 0 }, - { "kbytesfree", lprocfs_osd_rd_kbytesfree, 0, 0 }, - { "kbytesavail", lprocfs_osd_rd_kbytesavail, 0, 0 }, - { "filestotal", lprocfs_osd_rd_filestotal, 0, 0 }, - { "filesfree", lprocfs_osd_rd_filesfree, 0, 0 }, + { "blocksize", lprocfs_dt_rd_blksize, 0, 0 }, + { "kbytestotal", lprocfs_dt_rd_kbytestotal, 0, 0 }, + { "kbytesfree", lprocfs_dt_rd_kbytesfree, 0, 0 }, + { "kbytesavail", lprocfs_dt_rd_kbytesavail, 0, 0 }, + { "filestotal", lprocfs_dt_rd_filestotal, 0, 0 }, + { "filesfree", lprocfs_dt_rd_filesfree, 0, 0 }, { 0 } }; -- 1.8.3.1