nilfs2: add /sys/fs/nilfs2/<device>/segments group

This patch adds creation of /sys/fs/nilfs2/<device>/segments
group.

The segments group contains attributes that describe
details about volume's segments:
(1) segments_number - show number of segments on volume.
(2) blocks_per_segment - show number of blocks in segment.
(3) clean_segments - show count of clean segments.
(4) dirty_segments - show count of dirty segments.

Signed-off-by: Vyacheslav Dubeyko <Vyacheslav.Dubeyko@hgst.com>
Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Michael L. Semon <mlsemon35@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Vyacheslav Dubeyko
2014-08-08 14:20:46 -07:00
committed by Linus Torvalds
parent abc968dbf2
commit ef43d5cd84
3 changed files with 143 additions and 1 deletions

View File

@@ -30,6 +30,8 @@
* @sg_superblock_kobj_unregister: completion state
* @sg_segctor_kobj: /sys/fs/<nilfs>/<device>/segctor
* @sg_segctor_kobj_unregister: completion state
* @sg_segments_kobj: /sys/fs/<nilfs>/<device>/segments
* @sg_segments_kobj_unregister: completion state
*/
struct nilfs_sysfs_dev_subgroups {
/* /sys/fs/<nilfs>/<device>/superblock */
@@ -39,6 +41,10 @@ struct nilfs_sysfs_dev_subgroups {
/* /sys/fs/<nilfs>/<device>/segctor */
struct kobject sg_segctor_kobj;
struct completion sg_segctor_kobj_unregister;
/* /sys/fs/<nilfs>/<device>/segments */
struct kobject sg_segments_kobj;
struct completion sg_segments_kobj_unregister;
};
#define NILFS_COMMON_ATTR_STRUCT(name) \
@@ -62,6 +68,7 @@ struct nilfs_##name##_attr { \
};
NILFS_DEV_ATTR_STRUCT(dev);
NILFS_DEV_ATTR_STRUCT(segments);
NILFS_DEV_ATTR_STRUCT(superblock);
NILFS_DEV_ATTR_STRUCT(segctor);
@@ -92,6 +99,11 @@ NILFS_DEV_ATTR_STRUCT(segctor);
#define NILFS_DEV_RW_ATTR(name) \
NILFS_RW_ATTR(dev, name)
#define NILFS_SEGMENTS_RO_ATTR(name) \
NILFS_RO_ATTR(segments, name)
#define NILFS_SEGMENTS_RW_ATTR(name) \
NILFS_RW_ATTR(segs_info, name)
#define NILFS_SUPERBLOCK_RO_ATTR(name) \
NILFS_RO_ATTR(superblock, name)
#define NILFS_SUPERBLOCK_RW_ATTR(name) \
@@ -108,6 +120,8 @@ NILFS_DEV_ATTR_STRUCT(segctor);
(&nilfs_feature_attr_##name.attr)
#define NILFS_DEV_ATTR_LIST(name) \
(&nilfs_dev_attr_##name.attr)
#define NILFS_SEGMENTS_ATTR_LIST(name) \
(&nilfs_segments_attr_##name.attr)
#define NILFS_SUPERBLOCK_ATTR_LIST(name) \
(&nilfs_superblock_attr_##name.attr)
#define NILFS_SEGCTOR_ATTR_LIST(name) \