summaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/sysfs.c
diff options
context:
space:
mode:
authorVyacheslav Dubeyko <Vyacheslav.Dubeyko@hgst.com>2014-08-08 14:20:50 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-08 15:57:21 -0700
commita2ecb791a9d6e71a2d37d66034475a92ebc7e02c (patch)
treef9f5c2d3bd24ef0105786d73561bbcafaca3fb25 /fs/nilfs2/sysfs.c
parent02a0ba1c60c2ad532322089a60256c8b0f46678c (diff)
downloadlinux-stable-a2ecb791a9d6e71a2d37d66034475a92ebc7e02c.tar.gz
linux-stable-a2ecb791a9d6e71a2d37d66034475a92ebc7e02c.tar.bz2
linux-stable-a2ecb791a9d6e71a2d37d66034475a92ebc7e02c.zip
nilfs2: add /sys/fs/nilfs2/<device>/mounted_snapshots group
This patch adds creation of /sys/fs/nilfs2/<device>/mounted_snapshots group. The mounted_snapshots group contains group for every mounted snapshot. 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>
Diffstat (limited to 'fs/nilfs2/sysfs.c')
-rw-r--r--fs/nilfs2/sysfs.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/fs/nilfs2/sysfs.c b/fs/nilfs2/sysfs.c
index 5cc735fcc1d5..fc0c961d486a 100644
--- a/fs/nilfs2/sysfs.c
+++ b/fs/nilfs2/sysfs.c
@@ -112,6 +112,32 @@ void nilfs_sysfs_delete_##name##_group(struct the_nilfs *nilfs) \
}
/************************************************************************
+ * NILFS mounted snapshots attrs *
+ ************************************************************************/
+
+static const char mounted_snapshots_readme_str[] =
+ "The mounted_snapshots group contains group for\n"
+ "every mounted snapshot.\n";
+
+static ssize_t
+nilfs_mounted_snapshots_README_show(struct nilfs_mounted_snapshots_attr *attr,
+ struct the_nilfs *nilfs, char *buf)
+{
+ return snprintf(buf, PAGE_SIZE, mounted_snapshots_readme_str);
+}
+
+NILFS_MOUNTED_SNAPSHOTS_RO_ATTR(README);
+
+static struct attribute *nilfs_mounted_snapshots_attrs[] = {
+ NILFS_MOUNTED_SNAPSHOTS_ATTR_LIST(README),
+ NULL,
+};
+
+NILFS_DEV_INT_GROUP_OPS(mounted_snapshots, dev);
+NILFS_DEV_INT_GROUP_TYPE(mounted_snapshots, dev);
+NILFS_DEV_INT_GROUP_FNS(mounted_snapshots, dev);
+
+/************************************************************************
* NILFS checkpoints attrs *
************************************************************************/
@@ -866,10 +892,14 @@ int nilfs_sysfs_create_device_group(struct super_block *sb)
if (err)
goto free_dev_subgroups;
- err = nilfs_sysfs_create_checkpoints_group(nilfs);
+ err = nilfs_sysfs_create_mounted_snapshots_group(nilfs);
if (err)
goto cleanup_dev_kobject;
+ err = nilfs_sysfs_create_checkpoints_group(nilfs);
+ if (err)
+ goto delete_mounted_snapshots_group;
+
err = nilfs_sysfs_create_segments_group(nilfs);
if (err)
goto delete_checkpoints_group;
@@ -893,6 +923,9 @@ delete_segments_group:
delete_checkpoints_group:
nilfs_sysfs_delete_checkpoints_group(nilfs);
+delete_mounted_snapshots_group:
+ nilfs_sysfs_delete_mounted_snapshots_group(nilfs);
+
cleanup_dev_kobject:
kobject_del(&nilfs->ns_dev_kobj);
@@ -905,6 +938,7 @@ failed_create_device_group:
void nilfs_sysfs_delete_device_group(struct the_nilfs *nilfs)
{
+ nilfs_sysfs_delete_mounted_snapshots_group(nilfs);
nilfs_sysfs_delete_checkpoints_group(nilfs);
nilfs_sysfs_delete_segments_group(nilfs);
nilfs_sysfs_delete_superblock_group(nilfs);