Skip to contentSkip to conversation

staging: lustre: use module_name() macro for debug printf

PATCH In review Arnd Bergmann 2 participants 2 messages Mar 13, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: lustre: use module_name() macro for debug printf

We now allow lustre to be built when CONFIG_MODULES is disabled, but that causes a build failure:

In file included from drivers/staging/lustre/include/linux/libcfs/libcfs.h:42,
from drivers/staging/lustre/lustre/obdclass/lu_object.c:44:
drivers/staging/lustre/lustre/obdclass/lu_object.c: In function 'lu_context_key_degister':
drivers/staging/lustre/lustre/obdclass/lu_object.c:1410:51: error: dereferencing pointer to incomplete type 'struct module'

This particular case can be avoided by using the module_name() macro that was designed exactly to handle printing the name of a module in all configurations.

---
 drivers/staging/lustre/lustre/obdclass/lu_object.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/obdclass/lu_object.c +2 -2
index 8ddf23b82a2c..3ae16e8501c2 100644
@@ -1407,7 +1407,7 @@ void lu_context_key_degister(struct lu_context_key *key)
 	while (atomic_read(&key->lct_used) > 1) {
 		spin_unlock(&lu_keys_guard);
 		CDEBUG(D_INFO, "%s: \"%s\" %p, %d\n",
-		       __func__, key->lct_owner ? key->lct_owner->name : "",
+		       __func__, module_name(key->lct_owner),
 		       key, atomic_read(&key->lct_used));
 		schedule();
 		spin_lock(&lu_keys_guard);
@@ -1547,7 +1547,7 @@ void lu_context_key_quiesce(struct lu_context_key *key)
 			spin_unlock(&lu_keys_guard);
 			CDEBUG(D_INFO, "%s: \"%s\" %p, %d (%d)\n",
 			       __func__,
-			       key->lct_owner ? key->lct_owner->name : "",
+			       module_name(key->lct_owner),
 			       key, atomic_read(&key->lct_used),
 			atomic_read(&lu_key_initing_cnt));
 			schedule();
Signature · 1 line
2.9.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Arnd Bergmann

We now allow lustre to be built when CONFIG_MODULES is disabled, but that causes a build failure:

In file included from drivers/staging/lustre/include/linux/libcfs/libcfs.h:42,
from drivers/staging/lustre/lustre/obdclass/lu_object.c:44:
drivers/staging/lustre/lustre/obdclass/lu_object.c: In function 'lu_context_key_degister':
drivers/staging/lustre/lustre/obdclass/lu_object.c:1410:51: error: dereferencing pointer to incomplete type 'struct module'

This particular case can be avoided by using the module_name() macro that was designed exactly to handle printing the name of a module in all configurations.

Learn something new every day :-)

Thanks,
NeilBrown

Quoted 31 lines
---
 drivers/staging/lustre/lustre/obdclass/lu_object.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/obdclass/lu_object.c +2 -2
index 8ddf23b82a2c..3ae16e8501c2 100644
@@ -1407,7 +1407,7 @@ void lu_context_key_degister(struct lu_context_key *key)
 	while (atomic_read(&key->lct_used) > 1) {
 		spin_unlock(&lu_keys_guard);
 		CDEBUG(D_INFO, "%s: \"%s\" %p, %d\n",
-		       __func__, key->lct_owner ? key->lct_owner->name : "",
+		       __func__, module_name(key->lct_owner),
 		       key, atomic_read(&key->lct_used));
 		schedule();
 		spin_lock(&lu_keys_guard);
@@ -1547,7 +1547,7 @@ void lu_context_key_quiesce(struct lu_context_key *key)
 			spin_unlock(&lu_keys_guard);
 			CDEBUG(D_INFO, "%s: \"%s\" %p, %d (%d)\n",
 			       __func__,
-			       key->lct_owner ? key->lct_owner->name : "",
+			       module_name(key->lct_owner),
 			       key, atomic_read(&key->lct_used),
 			atomic_read(&lu_key_initing_cnt));
 			schedule();
Signature · 1 line
2.9.0

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel