staging/lustre/obdclass: Move common obd proc files to sysfs

This moves uuid display and also underlying fs statistics.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Oleg Drokin
2015-05-21 15:32:17 -04:00
committed by Greg Kroah-Hartman
parent 9b8013023c
commit 0bc36cb06e
8 changed files with 97 additions and 85 deletions

View File

@@ -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);

View File

@@ -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 }
};

View File

@@ -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 }
};

View File

@@ -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 },

View File

@@ -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 },

View File

@@ -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,
};

View File

@@ -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 },

View File

@@ -336,3 +336,51 @@ Contact: "Oleg Drokin" <oleg.drokin@intel.com>
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" <oleg.drokin@intel.com>
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" <oleg.drokin@intel.com>
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" <oleg.drokin@intel.com>
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" <oleg.drokin@intel.com>
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" <oleg.drokin@intel.com>
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" <oleg.drokin@intel.com>
Description:
Number of free inodes on backend filesystem for service
behind this obd.