From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> This creates the /sys/fs/<fs-type>/<s_id> directory. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> --- fs/super.c | 18 ++++++++++++++++++ include/linux/fs.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/fs/super.c b/fs/super.c index 74914b1..42568eb 100644 --- a/fs/super.c +++ b/fs/super.c @@ -414,6 +414,9 @@ void generic_shutdown_super(struct super_block *sb) sync_filesystem(sb); sb->s_flags &= ~MS_ACTIVE; + if (sb->s_type->sb_ktype) + kobject_put(&sb->s_kobj); + fsnotify_unmount_inodes(sb); cgroup_writeback_umount(); @@ -427,6 +430,9 @@ void generic_shutdown_super(struct super_block *sb) if (sop->put_super) sop->put_super(sb); + if (sb->s_type->sb_ktype) + wait_for_completion(&sb->s_kobj_del); + if (!list_empty(&sb->s_inodes)) { printk("VFS: Busy inodes after unmount of %s. " "Self-destruct in 5 seconds. Have a nice day...\n", @@ -1022,6 +1028,18 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, goto error; } + if (fs_type->sb_ktype) { + s->s_kobj.kset = fs_type->kset; + init_completion(&s->s_kobj_del); + error = kobject_init_and_add(&s->s_kobj, + fs_type->sb_ktype, + NULL, "%s", s->s_id); + if (error) { + deactivate_locked_super(s); + goto error; + } + } + s->s_flags |= MS_ACTIVE; bdev->bd_super = s; } diff --git a/include/linux/fs.h b/include/linux/fs.h index 019546b..5ac8883 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1419,6 +1419,8 @@ struct super_block { /* s_inode_list_lock protects s_inodes */ spinlock_t s_inode_list_lock ____cacheline_aligned_in_smp; struct list_head s_inodes; /* all inodes */ + struct kobject s_kobj; /* kobject to create /sys/fs/<type>/<s_id> */ + struct completion s_kobj_del; /* Wait for kobjects deletion */ }; extern struct timespec current_fs_time(struct super_block *sb); -- 2.6.6 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html