From 0bc36cb06e4bc5e936f2f442535daf557c7a4200 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Thu, 21 May 2015 15:32:17 -0400 Subject: staging/lustre/obdclass: Move common obd proc files to sysfs This moves uuid display and also underlying fs statistics. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/lprocfs_status.h | 7 -- drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 3 - drivers/staging/lustre/lustre/lov/lproc_lov.c | 15 ---- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 14 ---- drivers/staging/lustre/lustre/mgc/lproc_mgc.c | 2 - .../lustre/lustre/obdclass/lprocfs_status.c | 79 ++++++++++++++-------- drivers/staging/lustre/lustre/osc/lproc_osc.c | 14 ---- drivers/staging/lustre/sysfs-fs-lustre | 48 +++++++++++++ 8 files changed, 97 insertions(+), 85 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 3225e3c..bbacda6 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -633,7 +633,6 @@ extern int lprocfs_wr_atomic(struct file *file, const char __user *buffer, extern int lprocfs_rd_uint(struct seq_file *m, void *data); extern int lprocfs_wr_uint(struct file *file, const char __user *buffer, unsigned long count, void *data); -extern int lprocfs_rd_uuid(struct seq_file *m, void *data); extern int lprocfs_rd_name(struct seq_file *m, void *data); extern int lprocfs_rd_server_uuid(struct seq_file *m, void *data); extern int lprocfs_rd_conn_uuid(struct seq_file *m, void *data); @@ -658,12 +657,6 @@ extern int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer, size_t count, loff_t *off); /* Statfs helpers */ -extern int lprocfs_rd_blksize(struct seq_file *m, void *data); -extern int lprocfs_rd_kbytestotal(struct seq_file *m, void *data); -extern int lprocfs_rd_kbytesfree(struct seq_file *m, void *data); -extern int lprocfs_rd_kbytesavail(struct seq_file *m, void *data); -extern int lprocfs_rd_filestotal(struct seq_file *m, void *data); -extern int lprocfs_rd_filesfree(struct seq_file *m, void *data); extern int lprocfs_write_helper(const char __user *buffer, unsigned long count, int *val); diff --git a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c index 76b32d5..debd897 100644 --- a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c +++ b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c @@ -204,13 +204,10 @@ static int lmv_target_seq_open(struct inode *inode, struct file *file) return 0; } -LPROC_SEQ_FOPS_RO_TYPE(lmv, uuid); - static struct lprocfs_vars lprocfs_lmv_obd_vars[] = { { "numobd", &lmv_numobd_fops, NULL, 0 }, { "placement", &lmv_placement_fops, NULL, 0 }, { "activeobd", &lmv_activeobd_fops, NULL, 0 }, - { "uuid", &lmv_uuid_fops, NULL, 0 }, { "desc_uuid", &lmv_desc_uuid_fops, NULL, 0 }, { NULL } }; diff --git a/drivers/staging/lustre/lustre/lov/lproc_lov.c b/drivers/staging/lustre/lustre/lov/lproc_lov.c index 18fdd7e..92489da 100644 --- a/drivers/staging/lustre/lustre/lov/lproc_lov.c +++ b/drivers/staging/lustre/lustre/lov/lproc_lov.c @@ -262,29 +262,14 @@ static int lov_target_seq_open(struct inode *inode, struct file *file) return 0; } -LPROC_SEQ_FOPS_RO_TYPE(lov, uuid); -LPROC_SEQ_FOPS_RO_TYPE(lov, filestotal); -LPROC_SEQ_FOPS_RO_TYPE(lov, filesfree); -LPROC_SEQ_FOPS_RO_TYPE(lov, blksize); -LPROC_SEQ_FOPS_RO_TYPE(lov, kbytestotal); -LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesfree); -LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesavail); - static struct lprocfs_vars lprocfs_lov_obd_vars[] = { - { "uuid", &lov_uuid_fops, NULL, 0 }, { "stripesize", &lov_stripesize_fops, NULL }, { "stripeoffset", &lov_stripeoffset_fops, NULL }, { "stripecount", &lov_stripecount_fops, NULL }, { "stripetype", &lov_stripetype_fops, NULL }, { "numobd", &lov_numobd_fops, NULL, 0 }, { "activeobd", &lov_activeobd_fops, NULL, 0 }, - { "filestotal", &lov_filestotal_fops, NULL, 0 }, - { "filesfree", &lov_filesfree_fops, NULL, 0 }, /*{ "filegroups", lprocfs_rd_filegroups, NULL, 0 },*/ - { "blocksize", &lov_blksize_fops, NULL, 0 }, - { "kbytestotal", &lov_kbytestotal_fops, NULL, 0 }, - { "kbytesfree", &lov_kbytesfree_fops, NULL, 0 }, - { "kbytesavail", &lov_kbytesavail_fops, NULL, 0 }, { "desc_uuid", &lov_desc_uuid_fops, NULL, 0 }, { NULL } }; diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c index 5c38cd7..b1ef178 100644 --- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c +++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c @@ -155,14 +155,7 @@ static struct file_operations mdc_kuc_fops = { LPROC_SEQ_FOPS_WR_ONLY(mdc, ping); -LPROC_SEQ_FOPS_RO_TYPE(mdc, uuid); LPROC_SEQ_FOPS_RO_TYPE(mdc, connect_flags); -LPROC_SEQ_FOPS_RO_TYPE(mdc, blksize); -LPROC_SEQ_FOPS_RO_TYPE(mdc, kbytestotal); -LPROC_SEQ_FOPS_RO_TYPE(mdc, kbytesfree); -LPROC_SEQ_FOPS_RO_TYPE(mdc, kbytesavail); -LPROC_SEQ_FOPS_RO_TYPE(mdc, filestotal); -LPROC_SEQ_FOPS_RO_TYPE(mdc, filesfree); LPROC_SEQ_FOPS_RO_TYPE(mdc, server_uuid); LPROC_SEQ_FOPS_RO_TYPE(mdc, conn_uuid); LPROC_SEQ_FOPS_RO_TYPE(mdc, timeouts); @@ -178,15 +171,8 @@ LPROC_SEQ_FOPS_RW_TYPE(mdc, import); LPROC_SEQ_FOPS_RW_TYPE(mdc, pinger_recov); static struct lprocfs_vars lprocfs_mdc_obd_vars[] = { - { "uuid", &mdc_uuid_fops, NULL, 0 }, { "ping", &mdc_ping_fops, NULL, 0222 }, { "connect_flags", &mdc_connect_flags_fops, NULL, 0 }, - { "blocksize", &mdc_blksize_fops, NULL, 0 }, - { "kbytestotal", &mdc_kbytestotal_fops, NULL, 0 }, - { "kbytesfree", &mdc_kbytesfree_fops, NULL, 0 }, - { "kbytesavail", &mdc_kbytesavail_fops, NULL, 0 }, - { "filestotal", &mdc_filestotal_fops, NULL, 0 }, - { "filesfree", &mdc_filesfree_fops, NULL, 0 }, /*{ "filegroups", lprocfs_rd_filegroups, NULL, 0 },*/ { "mds_server_uuid", &mdc_server_uuid_fops, NULL, 0 }, { "mds_conn_uuid", &mdc_conn_uuid_fops, NULL, 0 }, diff --git a/drivers/staging/lustre/lustre/mgc/lproc_mgc.c b/drivers/staging/lustre/lustre/mgc/lproc_mgc.c index ad889e7..34a9317 100644 --- a/drivers/staging/lustre/lustre/mgc/lproc_mgc.c +++ b/drivers/staging/lustre/lustre/mgc/lproc_mgc.c @@ -40,7 +40,6 @@ #include "../include/lprocfs_status.h" #include "mgc_internal.h" -LPROC_SEQ_FOPS_RO_TYPE(mgc, uuid); LPROC_SEQ_FOPS_RO_TYPE(mgc, connect_flags); LPROC_SEQ_FOPS_RO_TYPE(mgc, server_uuid); LPROC_SEQ_FOPS_RO_TYPE(mgc, conn_uuid); @@ -56,7 +55,6 @@ static int mgc_ir_state_seq_show(struct seq_file *m, void *v) LPROC_SEQ_FOPS_RO(mgc_ir_state); static struct lprocfs_vars lprocfs_mgc_obd_vars[] = { - { "uuid", &mgc_uuid_fops, NULL, 0 }, { "ping", &mgc_ping_fops, NULL, 0222 }, { "connect_flags", &mgc_connect_flags_fops, NULL, 0 }, { "mgs_server_uuid", &mgc_server_uuid_fops, NULL, 0 }, diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index e6f0d11..5b1b59a 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -501,15 +501,15 @@ int lprocfs_wr_atomic(struct file *file, const char __user *buffer, } EXPORT_SYMBOL(lprocfs_wr_atomic); -int lprocfs_rd_uuid(struct seq_file *m, void *data) +static ssize_t uuid_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - struct obd_device *obd = data; + struct obd_device *obd = container_of(kobj, struct obd_device, + obd_kobj); - LASSERT(obd != NULL); - seq_printf(m, "%s\n", obd->obd_uuid.uuid); - return 0; + return sprintf(buf, "%s\n", obd->obd_uuid.uuid); } -EXPORT_SYMBOL(lprocfs_rd_uuid); +LUSTRE_RO_ATTR(uuid); int lprocfs_rd_name(struct seq_file *m, void *data) { @@ -521,23 +521,27 @@ int lprocfs_rd_name(struct seq_file *m, void *data) } EXPORT_SYMBOL(lprocfs_rd_name); -int lprocfs_rd_blksize(struct seq_file *m, void *data) +static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - struct obd_device *obd = data; + struct obd_device *obd = container_of(kobj, struct obd_device, + obd_kobj); struct obd_statfs osfs; int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) - seq_printf(m, "%u\n", osfs.os_bsize); + return sprintf(buf, "%u\n", osfs.os_bsize); return rc; } -EXPORT_SYMBOL(lprocfs_rd_blksize); +LUSTRE_RO_ATTR(blocksize); -int lprocfs_rd_kbytestotal(struct seq_file *m, void *data) +static ssize_t kbytestotal_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - struct obd_device *obd = data; + struct obd_device *obd = container_of(kobj, struct obd_device, + obd_kobj); struct obd_statfs osfs; int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), @@ -549,16 +553,18 @@ int lprocfs_rd_kbytestotal(struct seq_file *m, void *data) while (blk_size >>= 1) result <<= 1; - seq_printf(m, "%llu\n", result); + return sprintf(buf, "%llu\n", result); } return rc; } -EXPORT_SYMBOL(lprocfs_rd_kbytestotal); +LUSTRE_RO_ATTR(kbytestotal); -int lprocfs_rd_kbytesfree(struct seq_file *m, void *data) +static ssize_t kbytesfree_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - struct obd_device *obd = data; + struct obd_device *obd = container_of(kobj, struct obd_device, + obd_kobj); struct obd_statfs osfs; int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), @@ -570,16 +576,18 @@ int lprocfs_rd_kbytesfree(struct seq_file *m, void *data) while (blk_size >>= 1) result <<= 1; - seq_printf(m, "%llu\n", result); + return sprintf(buf, "%llu\n", result); } return rc; } -EXPORT_SYMBOL(lprocfs_rd_kbytesfree); +LUSTRE_RO_ATTR(kbytesfree); -int lprocfs_rd_kbytesavail(struct seq_file *m, void *data) +static ssize_t kbytesavail_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - struct obd_device *obd = data; + struct obd_device *obd = container_of(kobj, struct obd_device, + obd_kobj); struct obd_statfs osfs; int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), @@ -591,40 +599,44 @@ int lprocfs_rd_kbytesavail(struct seq_file *m, void *data) while (blk_size >>= 1) result <<= 1; - seq_printf(m, "%llu\n", result); + return sprintf(buf, "%llu\n", result); } return rc; } -EXPORT_SYMBOL(lprocfs_rd_kbytesavail); +LUSTRE_RO_ATTR(kbytesavail); -int lprocfs_rd_filestotal(struct seq_file *m, void *data) +static ssize_t filestotal_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - struct obd_device *obd = data; + struct obd_device *obd = container_of(kobj, struct obd_device, + obd_kobj); struct obd_statfs osfs; int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) - seq_printf(m, "%llu\n", osfs.os_files); + return sprintf(buf, "%llu\n", osfs.os_files); return rc; } -EXPORT_SYMBOL(lprocfs_rd_filestotal); +LUSTRE_RO_ATTR(filestotal); -int lprocfs_rd_filesfree(struct seq_file *m, void *data) +static ssize_t filesfree_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - struct obd_device *obd = data; + struct obd_device *obd = container_of(kobj, struct obd_device, + obd_kobj); struct obd_statfs osfs; int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) - seq_printf(m, "%llu\n", osfs.os_ffree); + return sprintf(buf, "%llu\n", osfs.os_ffree); return rc; } -EXPORT_SYMBOL(lprocfs_rd_filesfree); +LUSTRE_RO_ATTR(filesfree); int lprocfs_rd_server_uuid(struct seq_file *m, void *data) { @@ -995,6 +1007,13 @@ int lprocfs_rd_connect_flags(struct seq_file *m, void *data) EXPORT_SYMBOL(lprocfs_rd_connect_flags); static struct attribute *obd_def_attrs[] = { + &lustre_attr_blocksize.attr, + &lustre_attr_kbytestotal.attr, + &lustre_attr_kbytesfree.attr, + &lustre_attr_kbytesavail.attr, + &lustre_attr_filestotal.attr, + &lustre_attr_filesfree.attr, + &lustre_attr_uuid.attr, NULL, }; diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index 93ad272..199913d 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -520,14 +520,7 @@ static ssize_t osc_obd_max_pages_per_rpc_seq_write(struct file *file, } LPROC_SEQ_FOPS(osc_obd_max_pages_per_rpc); -LPROC_SEQ_FOPS_RO_TYPE(osc, uuid); LPROC_SEQ_FOPS_RO_TYPE(osc, connect_flags); -LPROC_SEQ_FOPS_RO_TYPE(osc, blksize); -LPROC_SEQ_FOPS_RO_TYPE(osc, kbytestotal); -LPROC_SEQ_FOPS_RO_TYPE(osc, kbytesfree); -LPROC_SEQ_FOPS_RO_TYPE(osc, kbytesavail); -LPROC_SEQ_FOPS_RO_TYPE(osc, filestotal); -LPROC_SEQ_FOPS_RO_TYPE(osc, filesfree); LPROC_SEQ_FOPS_RO_TYPE(osc, server_uuid); LPROC_SEQ_FOPS_RO_TYPE(osc, conn_uuid); LPROC_SEQ_FOPS_RO_TYPE(osc, timeouts); @@ -539,15 +532,8 @@ LPROC_SEQ_FOPS_RW_TYPE(osc, import); LPROC_SEQ_FOPS_RW_TYPE(osc, pinger_recov); static struct lprocfs_vars lprocfs_osc_obd_vars[] = { - { "uuid", &osc_uuid_fops, NULL, 0 }, { "ping", &osc_ping_fops, NULL, 0222 }, { "connect_flags", &osc_connect_flags_fops, NULL, 0 }, - { "blocksize", &osc_blksize_fops, NULL, 0 }, - { "kbytestotal", &osc_kbytestotal_fops, NULL, 0 }, - { "kbytesfree", &osc_kbytesfree_fops, NULL, 0 }, - { "kbytesavail", &osc_kbytesavail_fops, NULL, 0 }, - { "filestotal", &osc_filestotal_fops, NULL, 0 }, - { "filesfree", &osc_filesfree_fops, NULL, 0 }, /*{ "filegroups", lprocfs_rd_filegroups, NULL, 0 },*/ { "ost_server_uuid", &osc_server_uuid_fops, NULL, 0 }, { "ost_conn_uuid", &osc_conn_uuid_fops, NULL, 0 }, diff --git a/drivers/staging/lustre/sysfs-fs-lustre b/drivers/staging/lustre/sysfs-fs-lustre index 9817cb3..61101f2 100644 --- a/drivers/staging/lustre/sysfs-fs-lustre +++ b/drivers/staging/lustre/sysfs-fs-lustre @@ -336,3 +336,51 @@ Contact: "Oleg Drokin" Description: Controls what percentage of ldlm callback threads is dedicated to "high priority" incoming requests. + +What: /sys/fs/lustre/{obdtype}/{connection_name}/blocksize +Date: May 2015 +Contact: "Oleg Drokin" +Description: + Blocksize on backend filesystem for service behind this obd + device (or biggest blocksize for compound devices like lov + and lmv) + +What: /sys/fs/lustre/{obdtype}/{connection_name}/kbytestotal +Date: May 2015 +Contact: "Oleg Drokin" +Description: + Total number of kilobytes of space on backend filesystem + for service behind this obd (or total amount for compound + devices like lov lmv) + +What: /sys/fs/lustre/{obdtype}/{connection_name}/kbytesfree +Date: May 2015 +Contact: "Oleg Drokin" +Description: + Number of free kilobytes on backend filesystem for service + behind this obd (or total amount for compound devices + like lov lmv) + +What: /sys/fs/lustre/{obdtype}/{connection_name}/kbytesavail +Date: May 2015 +Contact: "Oleg Drokin" +Description: + Number of kilobytes of free space on backend filesystem + for service behind this obd (or total amount for compound + devices like lov lmv) that is actually available for use + (taking into account per-client and filesystem reservations). + +What: /sys/fs/lustre/{obdtype}/{connection_name}/filestotal +Date: May 2015 +Contact: "Oleg Drokin" +Description: + Number of inodes on backend filesystem for service behind this + obd. + +What: /sys/fs/lustre/{obdtype}/{connection_name}/filesfree +Date: May 2015 +Contact: "Oleg Drokin" +Description: + Number of free inodes on backend filesystem for service + behind this obd. + -- cgit v1.1