diff options
author | Oleg Drokin <green@linuxhacker.ru> | 2015-05-21 15:31:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-31 10:48:02 +0900 |
commit | 5804b11e1487558c6740282a01a08bb4ba0c6d06 (patch) | |
tree | b03ecb61617d6085baafb0241871b38842209ac6 | |
parent | 364bcfc8634d5625dbb41683b061bddf307a70e8 (diff) | |
download | op-kernel-dev-5804b11e1487558c6740282a01a08bb4ba0c6d06.zip op-kernel-dev-5804b11e1487558c6740282a01a08bb4ba0c6d06.tar.gz |
staging/lustre/llite: move /proc/fs/lustre/llite/kbytes* to sysfs
Move kbytestotal, kbytesavail and kbytesfree files from
/proc/fs/lustre/llite/* to /sys/fs/lustre/llite/*/
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/lustre/lustre/llite/lproc_llite.c | 45 | ||||
-rw-r--r-- | drivers/staging/lustre/sysfs-fs-lustre | 20 |
2 files changed, 44 insertions, 21 deletions
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index bdf1f38..0010ac2 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -66,14 +66,15 @@ static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr, } LUSTRE_RO_ATTR(blocksize); -static int ll_kbytestotal_seq_show(struct seq_file *m, void *v) +static ssize_t kbytestotal_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - struct super_block *sb = (struct super_block *)m->private; + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kobj); struct obd_statfs osfs; int rc; - LASSERT(sb != NULL); - rc = ll_statfs_internal(sb, &osfs, + rc = ll_statfs_internal(sbi->ll_sb, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) { @@ -83,21 +84,22 @@ static int ll_kbytestotal_seq_show(struct seq_file *m, void *v) while (blk_size >>= 1) result <<= 1; - seq_printf(m, "%llu\n", result); + rc = sprintf(buf, "%llu\n", result); } return rc; } -LPROC_SEQ_FOPS_RO(ll_kbytestotal); +LUSTRE_RO_ATTR(kbytestotal); -static int ll_kbytesfree_seq_show(struct seq_file *m, void *v) +static ssize_t kbytesfree_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - struct super_block *sb = (struct super_block *)m->private; + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kobj); struct obd_statfs osfs; int rc; - LASSERT(sb != NULL); - rc = ll_statfs_internal(sb, &osfs, + rc = ll_statfs_internal(sbi->ll_sb, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) { @@ -107,21 +109,22 @@ static int ll_kbytesfree_seq_show(struct seq_file *m, void *v) while (blk_size >>= 1) result <<= 1; - seq_printf(m, "%llu\n", result); + rc = sprintf(buf, "%llu\n", result); } return rc; } -LPROC_SEQ_FOPS_RO(ll_kbytesfree); +LUSTRE_RO_ATTR(kbytesfree); -static int ll_kbytesavail_seq_show(struct seq_file *m, void *v) +static ssize_t kbytesavail_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - struct super_block *sb = (struct super_block *)m->private; + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kobj); struct obd_statfs osfs; int rc; - LASSERT(sb != NULL); - rc = ll_statfs_internal(sb, &osfs, + rc = ll_statfs_internal(sbi->ll_sb, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) { @@ -131,12 +134,12 @@ static int ll_kbytesavail_seq_show(struct seq_file *m, void *v) while (blk_size >>= 1) result <<= 1; - seq_printf(m, "%llu\n", result); + rc = sprintf(buf, "%llu\n", result); } return rc; } -LPROC_SEQ_FOPS_RO(ll_kbytesavail); +LUSTRE_RO_ATTR(kbytesavail); static int ll_filestotal_seq_show(struct seq_file *m, void *v) { @@ -840,9 +843,6 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = { /* { "mntpt_path", ll_rd_path, 0, 0 }, */ { "fstype", &ll_fstype_fops, NULL, 0 }, { "site", &ll_site_stats_fops, NULL, 0 }, - { "kbytestotal", &ll_kbytestotal_fops, NULL, 0 }, - { "kbytesfree", &ll_kbytesfree_fops, NULL, 0 }, - { "kbytesavail", &ll_kbytesavail_fops, NULL, 0 }, { "filestotal", &ll_filestotal_fops, NULL, 0 }, { "filesfree", &ll_filesfree_fops, NULL, 0 }, { "client_type", &ll_client_type_fops, NULL, 0 }, @@ -874,6 +874,9 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = { static struct attribute *llite_attrs[] = { &lustre_attr_blocksize.attr, + &lustre_attr_kbytestotal.attr, + &lustre_attr_kbytesfree.attr, + &lustre_attr_kbytesavail.attr, NULL, }; diff --git a/drivers/staging/lustre/sysfs-fs-lustre b/drivers/staging/lustre/sysfs-fs-lustre index 85b0ba7..889cef4 100644 --- a/drivers/staging/lustre/sysfs-fs-lustre +++ b/drivers/staging/lustre/sysfs-fs-lustre @@ -45,3 +45,23 @@ Date: May 2015 Contact: "Oleg Drokin" <oleg.drokin@intel.com> Description: Biggest blocksize on object storage server for this filesystem. + +What: /sys/fs/lustre/llite/<fsname>-<uuid>/kbytestotal +Date: May 2015 +Contact: "Oleg Drokin" <oleg.drokin@intel.com> +Description: + Shows total number of kilobytes of space on this filesystem + +What: /sys/fs/lustre/llite/<fsname>-<uuid>/kbytesfree +Date: May 2015 +Contact: "Oleg Drokin" <oleg.drokin@intel.com> +Description: + Shows total number of free kilobytes of space on this filesystem + +What: /sys/fs/lustre/llite/<fsname>-<uuid>/kbytesavail +Date: May 2015 +Contact: "Oleg Drokin" <oleg.drokin@intel.com> +Description: + Shows total number of free kilobytes of space on this filesystem + actually available for use (taking into account per-client + grants and filesystem reservations). |