Skip to contentSkip to conversation

lustre: llite: remove ll_sb

PATCH New James Simmons 2 participants 2 messages Aug 20, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 4/38 lustre: llite: remove ll_sb

The only user of ll_sb in struct ll_sb_info is used to query the name locate in the file_system_type. We can get that information from using the super block located in struct path instead. This enables us to use struct ll_sb_info directly for every sysfs or debugfs entry.

WC-bug-id: https://jira.whamcloud.com/browse/LU-8066
Reviewed-on: https://review.whamcloud.com/24031
WC-bug-id: https://jira.whamcloud.com/browse/LU-10824
Reviewed-on: https://review.whamcloud.com/33025

---
Changelog)
v1) initial patch
v2) Remove use of ll_mnt in fstype sysfs file

 drivers/staging/lustre/lustre/llite/llite_internal.h | 1 -
 drivers/staging/lustre/lustre/llite/llite_lib.c      | 6 ++----
 drivers/staging/lustre/lustre/llite/lproc_llite.c    | 5 +----
 3 files changed, 3 insertions(+), 9 deletions(-)
drivers/staging/lustre/lustre/llite/llite_internal.h +0 -1
index 2719bc53..92dc05d 100644
@@ -524,7 +524,6 @@ struct ll_sb_info {
 
 	__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;
 };
 
drivers/staging/lustre/lustre/llite/llite_lib.c +2 -4
index d16f5d1..d352287 100644
@@ -62,7 +62,7 @@
 #define log2(n) ffz(~(n))
 #endif
 
-static struct ll_sb_info *ll_init_sbi(struct super_block *sb)
+static struct ll_sb_info *ll_init_sbi(void)
 {
 	struct ll_sb_info *sbi = NULL;
 	unsigned long pages;
@@ -129,8 +129,6 @@ static struct ll_sb_info *ll_init_sbi(struct super_block *sb)
 	INIT_LIST_HEAD(&sbi->ll_squash.rsi_nosquash_nids);
 	init_rwsem(&sbi->ll_squash.rsi_sem);
 
-	sbi->ll_sb = sb;
-
 	return sbi;
 }
 
@@ -912,7 +910,7 @@ int ll_fill_super(struct super_block *sb)
 	try_module_get(THIS_MODULE);
 
 	/* client additional sb info */
-	sbi = ll_init_sbi(sb);
+	sbi = ll_init_sbi();
 	lsi->lsi_llsbi = sbi;
 	if (!sbi) {
 		module_put(THIS_MODULE);
drivers/staging/lustre/lustre/llite/lproc_llite.c +1 -4
index a9ad328..858d276 100644
@@ -212,10 +212,7 @@ static ssize_t client_type_show(struct kobject *kobj, struct attribute *attr,
 static ssize_t fstype_show(struct kobject *kobj, struct attribute *attr,
 			   char *buf)
 {
-	struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
-					      ll_kobj);
-
-	return sprintf(buf, "%s\n", sbi->ll_sb->s_type->name);
+	return sprintf(buf, "lustre\n");
 }
 LUSTRE_RO_ATTR(fstype);
 
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 4/38 lustre: llite: remove ll_sb

Quoted 5 lines · James Simmons

The only user of ll_sb in struct ll_sb_info is used to query the name locate in the file_system_type. We can get that information from using the super block located in struct path instead. This enables us to use struct ll_sb_info directly for every sysfs or debugfs entry.

The above no longer matches the below (and I do like the change in the below).
So I've changed the above to:

--------
The only user of ll_sb in struct ll_sb_info is used to query the name locate in the file_system_type. That information is now constant (always "lustre") so are can use a constant instead.
This enables us to use struct ll_sb_info directly for every sysfs or debugfs entry.
---------

Thanks,
NeilBrown

Quoted 81 lines

WC-bug-id: https://jira.whamcloud.com/browse/LU-8066
Reviewed-on: https://review.whamcloud.com/24031
WC-bug-id: https://jira.whamcloud.com/browse/LU-10824
Reviewed-on: https://review.whamcloud.com/33025

---
Changelog)
v1) initial patch
v2) Remove use of ll_mnt in fstype sysfs file

 drivers/staging/lustre/lustre/llite/llite_internal.h | 1 -
 drivers/staging/lustre/lustre/llite/llite_lib.c      | 6 ++----
 drivers/staging/lustre/lustre/llite/lproc_llite.c    | 5 +----
 3 files changed, 3 insertions(+), 9 deletions(-)
drivers/staging/lustre/lustre/llite/llite_internal.h +0 -1
index 2719bc53..92dc05d 100644
@@ -524,7 +524,6 @@ struct ll_sb_info {
 
 	__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;
 };
 
drivers/staging/lustre/lustre/llite/llite_lib.c +2 -4
index d16f5d1..d352287 100644
@@ -62,7 +62,7 @@
 #define log2(n) ffz(~(n))
 #endif
 
-static struct ll_sb_info *ll_init_sbi(struct super_block *sb)
+static struct ll_sb_info *ll_init_sbi(void)
 {
 	struct ll_sb_info *sbi = NULL;
 	unsigned long pages;
@@ -129,8 +129,6 @@ static struct ll_sb_info *ll_init_sbi(struct super_block *sb)
 	INIT_LIST_HEAD(&sbi->ll_squash.rsi_nosquash_nids);
 	init_rwsem(&sbi->ll_squash.rsi_sem);
 
-	sbi->ll_sb = sb;
-
 	return sbi;
 }
 
@@ -912,7 +910,7 @@ int ll_fill_super(struct super_block *sb)
 	try_module_get(THIS_MODULE);
 
 	/* client additional sb info */
-	sbi = ll_init_sbi(sb);
+	sbi = ll_init_sbi();
 	lsi->lsi_llsbi = sbi;
 	if (!sbi) {
 		module_put(THIS_MODULE);
drivers/staging/lustre/lustre/llite/lproc_llite.c +1 -4
index a9ad328..858d276 100644
@@ -212,10 +212,7 @@ static ssize_t client_type_show(struct kobject *kobj, struct attribute *attr,
 static ssize_t fstype_show(struct kobject *kobj, struct attribute *attr,
 			   char *buf)
 {
-	struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
-					      ll_kobj);
-
-	return sprintf(buf, "%s\n", sbi->ll_sb->s_type->name);
+	return sprintf(buf, "lustre\n");
 }
 LUSTRE_RO_ATTR(fstype);
 
Signature · 1 line
1.8.3.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180820/3cdd952c/attachment-0001.sig>