All of lore.kernel.org
 help / color / mirror / Atom feed
From: Goldwyn Rodrigues <rgoldwyn@suse.de>
To: linux-fsdevel@vger.kernel.org
Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: [PoC 1/7] Add kset to file_system_type
Date: Thu, 28 Apr 2016 21:01:16 -0500	[thread overview]
Message-ID: <1461895282-4941-2-git-send-email-rgoldwyn@suse.de> (raw)
In-Reply-To: <1461895282-4941-1-git-send-email-rgoldwyn@suse.de>

From: Goldwyn Rodrigues <rgoldwyn@suse.com>

Most of the filesystems use kset, even though they don't use
the functions/features associated with kset.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 fs/filesystems.c   | 3 +++
 include/linux/fs.h | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/filesystems.c b/fs/filesystems.c
index c5618db..64560a2 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -81,6 +81,8 @@ int register_filesystem(struct file_system_type * fs)
 	else
 		*p = fs;
 	write_unlock(&file_systems_lock);
+	if (!res && (fs->fs_flags & FS_CREATE_SYSFS))
+		fs->kset = kset_create_and_add(fs->name, NULL, fs_kobj);
 	return res;
 }
 
@@ -109,6 +111,7 @@ int unregister_filesystem(struct file_system_type * fs)
 			*tmp = fs->next;
 			fs->next = NULL;
 			write_unlock(&file_systems_lock);
+			kset_unregister(fs->kset);
 			synchronize_rcu();
 			return 0;
 		}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 70e61b5..cfea7b4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -35,6 +35,7 @@
 
 #include <asm/byteorder.h>
 #include <uapi/linux/fs.h>
+#include <linux/kobject.h>
 
 struct backing_dev_info;
 struct bdi_writeback;
@@ -42,7 +43,6 @@ struct export_operations;
 struct hd_geometry;
 struct iovec;
 struct kiocb;
-struct kobject;
 struct pipe_inode_info;
 struct poll_table_struct;
 struct kstatfs;
@@ -1980,6 +1980,7 @@ struct file_system_type {
 #define FS_USERNS_MOUNT		8	/* Can be mounted by userns root */
 #define FS_USERNS_DEV_MOUNT	16 /* A userns mount does not imply MNT_NODEV */
 #define FS_USERNS_VISIBLE	32	/* FS must already be visible */
+#define FS_CREATE_SYSFS		128	/* Create sysfs entries, temporary flag to explain RFC */
 #define FS_RENAME_DOES_D_MOVE	32768	/* FS will handle d_move() during rename() internally. */
 	struct dentry *(*mount) (struct file_system_type *, int,
 		       const char *, void *);
@@ -1996,6 +1997,7 @@ struct file_system_type {
 	struct lock_class_key i_lock_key;
 	struct lock_class_key i_mutex_key;
 	struct lock_class_key i_mutex_dir_key;
+	struct kset *kset;
 };
 
 #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)
-- 
2.6.6


  reply	other threads:[~2016-04-29  2:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29  2:01 [PoC 0/7] Kobjectify filesystem Goldwyn Rodrigues
2016-04-29  2:01 ` Goldwyn Rodrigues [this message]
2016-04-29  2:01 ` [PoC 2/7] Add kobject to super_block Goldwyn Rodrigues
2016-04-29  2:26   ` Al Viro
2016-04-29 19:09     ` Goldwyn Rodrigues
2016-04-29  2:01 ` [PoC 3/7] Create sysfs files under sb Goldwyn Rodrigues
2016-04-29  2:01 ` [PoC 4/7] Report file system events Goldwyn Rodrigues
2016-04-29  2:01 ` [PoC 5/7] ocfs2: Use the sb's kset Goldwyn Rodrigues
2016-04-29  2:01 ` [PoC 6/7] ocfs2: create filecheck files Goldwyn Rodrigues
2016-04-29  2:01 ` [PoC 7/7] ocfs2: report inode errors to userspace Goldwyn Rodrigues
2016-04-29 17:32 ` [PoC 0/7] Kobjectify filesystem Viacheslav Dubeyko
2016-04-29 18:28   ` Goldwyn Rodrigues
2016-04-29 20:16     ` Viacheslav Dubeyko
2016-04-29 22:09       ` Goldwyn Rodrigues
2016-04-29 22:31     ` Al Viro
2016-04-29 22:45       ` Goldwyn Rodrigues
2016-05-04 22:20       ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461895282-4941-2-git-send-email-rgoldwyn@suse.de \
    --to=rgoldwyn@suse.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=rgoldwyn@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.