Skip to contentSkip to conversation

bcachefs: fix typo in reference to BCACHEFS_DEBUG

PATCH In review Lukas Bulwahn 4 participants 7 messages Apr 11, 2024 – Apr 12, 2024 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcachefs: fix typo in reference to BCACHEFS_DEBUG

Commit ec9cc18fc2e6 ("bcachefs: Add checks for invalid snapshot IDs") intends to check the sanity of a snapshot and panic when BCACHEFS_DEBUG is set, but that conditional has a typo.

Fix the typo to refer to the actual existing Kconfig symbol.

This was found with ./scripts/checkkconfigsymbols.py.

---
 fs/bcachefs/snapshot.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/bcachefs/snapshot.h +1 -1
index b7d2fed37c4f..3fdb41b33d2d 100644
@@ -77,7 +77,7 @@ static inline u32 __bch2_snapshot_parent(struct bch_fs *c, u32 id)
 		return 0;
 
 	u32 parent = s->parent;
-	if (IS_ENABLED(CONFIG_BCACHEFS_DEBU) &&
+	if (IS_ENABLED(CONFIG_BCACHEFS_DEBUG) &&
 	    parent &&
 	    s->depth != snapshot_t(c, parent)->depth + 1)
 		panic("id %u depth=%u parent %u depth=%u\n",
Signature · 1 line
2.44.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Lukas Bulwahn

Commit ec9cc18fc2e6 ("bcachefs: Add checks for invalid snapshot IDs") intends to check the sanity of a snapshot and panic when BCACHEFS_DEBUG is set, but that conditional has a typo.

Fix the typo to refer to the actual existing Kconfig symbol.

This was found with ./scripts/checkkconfigsymbols.py.

---
  fs/bcachefs/snapshot.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/bcachefs/snapshot.h +0 -0
index b7d2fed37c4f..3fdb41b33d2d 100644

fs/bcachefs/snapshot.h static inline u32 __bch2_snapshot_parent(struct bch_fs *c, u32 id) · line 83

Quoted 8 lines
fs/bcachefs/snapshot.h +1 -1
@@ -77,7 +77,7 @@ static inline u32 __bch2_snapshot_parent(struct bch_fs *c, u32 id)
  		return 0;
 
  	u32 parent = s->parent;
-	if (IS_ENABLED(CONFIG_BCACHEFS_DEBU) &&
+	if (IS_ENABLED(CONFIG_BCACHEFS_DEBUG) &&
  	    parent &&
  	    s->depth != snapshot_t(c, parent)->depth + 1)
  		panic("id %u depth=%u parent %u depth=%u\n",
#2 lore raw
In reply to Lukas Bulwahn

Also, I am curious why such spelling errors cannot be detected at the compilation stage.

Quoted 26 lines · Lukas Bulwahn

Commit ec9cc18fc2e6 ("bcachefs: Add checks for invalid snapshot IDs") intends to check the sanity of a snapshot and panic when BCACHEFS_DEBUG is set, but that conditional has a typo.

Fix the typo to refer to the actual existing Kconfig symbol.

This was found with ./scripts/checkkconfigsymbols.py.

---
  fs/bcachefs/snapshot.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/bcachefs/snapshot.h +1 -1
index b7d2fed37c4f..3fdb41b33d2d 100644
@@ -77,7 +77,7 @@ static inline u32 __bch2_snapshot_parent(struct bch_fs *c, u32 id)
  		return 0;
 
  	u32 parent = s->parent;
-	if (IS_ENABLED(CONFIG_BCACHEFS_DEBU) &&
+	if (IS_ENABLED(CONFIG_BCACHEFS_DEBUG) &&
  	    parent &&
  	    s->depth != snapshot_t(c, parent)->depth + 1)
  		panic("id %u depth=%u parent %u depth=%u\n",
#3 lore raw
Quoted 3 lines · Hongbo Li

Also, I am curious why such spelling errors cannot be detected at the compilation stage.

The IS_ENABLED() macro is testing whether the define exists or not. In this case both "CONFIG_BCACHEFS_DEBUG" and "CONFIG_BCACHEFS_DEBU" do not exist for this config.

Lukas's scripts make a list of macros we expect to exist and then checks against the list.

regards,
dan carpenter

#4 lore raw

Thanks, I got it!

Quoted 15 lines · Dan Carpenter
Quoted 3 lines · Hongbo Li

Also, I am curious why such spelling errors cannot be detected at the compilation stage.

The IS_ENABLED() macro is testing whether the define exists or not. In this case both "CONFIG_BCACHEFS_DEBUG" and "CONFIG_BCACHEFS_DEBU" do not exist for this config.

Lukas's scripts make a list of macros we expect to exist and then checks against the list.

regards,
dan carpenter

#5 lore raw
In reply to Hongbo Li
Quoted 2 lines · Hongbo Li

Also, I am curious why such spelling errors cannot be detected at the compilation stage.

code coverage analysis would catch this. I'm one patch away from fully automated code coverage.

#6 lore raw

Thanks, got it. And I found many similar cases in other kernel modules. Also, the janitors project seems quite interesting.

Quoted 6 lines · Kent Overstreet
Quoted 2 lines · Hongbo Li

Also, I am curious why such spelling errors cannot be detected at the compilation stage.

code coverage analysis would catch this. I'm one patch away from fully automated code coverage.