Skip to contentSkip to conversation

staging/lustre/llite: move some procfs files to sysfs

PATCH In review [email protected] 2 participants 2 messages May 3, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 staging/lustre/llite: move some procfs files to sysfs

From: Oleg Drokin <[email protected]>

Move just first few files from /proc/fs/lustre/llite/*/ to /sys/fs/lustre/llite/*/:

blocksize    filesfree   fstype       kbytesfree   max_read_ahead_mb
client_type  filestotal  kbytesavail  kbytestotal  uuid

More to follow.

---
 .../staging/lustre/lustre/llite/llite_internal.h   |   4 +
 drivers/staging/lustre/lustre/llite/llite_lib.c    |   7 +-
 drivers/staging/lustre/lustre/llite/lproc_llite.c  | 190 ++++++++++++---------
 drivers/staging/lustre/lustre/llite/super25.c      |  11 +-
 4 files changed, 124 insertions(+), 88 deletions(-)
drivers/staging/lustre/lustre/llite/llite_internal.h +4 -0
index 1253b3c..5df2754 100644
@@ -524,6 +524,9 @@ struct ll_sb_info {
 	struct rmtacl_ctl_table   ll_rct;
 	struct eacl_table	 ll_et;
 	__kernel_fsid_t		  ll_fsid;
+	struct kobject		 ll_kobj; /* sysfs object */
+	struct super_block	*ll_sb; /* struct super_block (for sysfs code)*/
+	struct completion	 ll_kobj_unregister;
 };
 
 #define LL_DEFAULT_MAX_RW_CHUNK      (32 * 1024 * 1024)
@@ -645,6 +648,7 @@ struct lov_stripe_md;
 extern spinlock_t inode_lock;
 
 extern struct proc_dir_entry *proc_lustre_fs_root;
+extern struct kset *llite_kset;
 
 static inline struct inode *ll_info2i(struct ll_inode_info *lli)
 {
drivers/staging/lustre/lustre/llite/llite_lib.c +5 -2
index e5bac94..e2b3510 100644
@@ -58,6 +58,7 @@
 
 struct kmem_cache *ll_file_data_slab;
 struct proc_dir_entry *proc_lustre_fs_root;
+struct kset *llite_kset;
 
 static LIST_HEAD(ll_super_blocks);
 static DEFINE_SPINLOCK(ll_sb_lock);
@@ -66,7 +67,7 @@ static DEFINE_SPINLOCK(ll_sb_lock);
 #define log2(n) ffz(~(n))
 #endif
 
-static struct ll_sb_info *ll_init_sbi(void)
+static struct ll_sb_info *ll_init_sbi(struct super_block *sb)
 {
 	struct ll_sb_info *sbi = NULL;
 	unsigned long pages;
@@ -134,6 +135,8 @@ static struct ll_sb_info *ll_init_sbi(void)
 	atomic_set(&sbi->ll_agl_total, 0);
 	sbi->ll_flags |= LL_SBI_AGL_ENABLED;
 
+	sbi->ll_sb = sb;
+
 	return sbi;
 }
 
@@ -921,7 +924,7 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)
 	try_module_get(THIS_MODULE);
 
 	/* client additional sb info */
-	lsi->lsi_llsbi = sbi = ll_init_sbi();
+	lsi->lsi_llsbi = sbi = ll_init_sbi(sb);
 	if (!sbi) {
 		module_put(THIS_MODULE);
 		kfree(cfg);
drivers/staging/lustre/lustre/llite/lproc_llite.c +105 -85

336 lines not on this page · raw message

drivers/staging/lustre/lustre/llite/super25.c +10 -1
index a494f62..7ad00b3 100644
@@ -138,6 +138,12 @@ static int __init init_lustre_lite(void)
 
 	proc_lustre_fs_root = entry;
 
+	llite_kset = kset_create_and_add("llite", NULL, &lustre_kobj);
+	if (!llite_kset) {
+		rc = -ENOMEM;
+		goto out_proc;
+	}
+
 	cfs_get_random_bytes(seed, sizeof(seed));
 
 	/* Nodes with small feet have little entropy. The NID for this
@@ -155,7 +161,7 @@ static int __init init_lustre_lite(void)
 	setup_timer(&ll_capa_timer, ll_capa_timer_callback, 0);
 	rc = ll_capa_thread_start();
 	if (rc != 0)
-		goto out_proc;
+		goto out_sysfs;
 
 	rc = vvp_global_init();
 	if (rc != 0)
@@ -176,6 +182,8 @@ out_vvp:
 out_capa:
 	del_timer(&ll_capa_timer);
 	ll_capa_thread_stop();
+out_sysfs:
+	kset_unregister(llite_kset);
 out_proc:
 	lprocfs_remove(&proc_lustre_fs_root);
 out_cache:
@@ -201,6 +209,7 @@ static void __exit exit_lustre_lite(void)
 	lustre_register_client_process_config(NULL);
 
 	lprocfs_remove(&proc_lustre_fs_root);
+	kset_unregister(llite_kset);
 
 	ll_xattr_fini();
 	vvp_global_fini();
Signature · 1 line
2.1.0
#1 lore raw
Quoted 8 lines · On Sat, May 02, 2015 at 11:10:08PM -0400, [email protected] wrote:

From: Oleg Drokin <[email protected]>

Move just first few files from /proc/fs/lustre/llite/*/ to /sys/fs/lustre/llite/*/:

blocksize    filesfree   fstype       kbytesfree   max_read_ahead_mb
client_type  filestotal  kbytesavail  kbytestotal  uuid

More to follow.

Document please, try just doing one file per patch to make it easier to understand and review. And again, one value per file.

thanks,

greg k-h