Skip to contentSkip to conversation

btrfs ASSERT() error when make C=1, but OK when make C=0

DISCUSSION Wang Yugui 2 participants 3 messages Dec 22, 2025 – Dec 25, 2025 Btrfs file system

lore
Share & tools
lore

Wang Yugui

author
#0 lore raw

Hi,

I noticed a lot of make C=1 error of btrfs ASSERT(), but make C=0 is OK.

block-group.c: note: in included file:
zoned.h:417:9: error: Expected ) in function call
zoned.h:417:9: error: got __VA_OPT__

static inline bool btrfs_zoned_bg_is_full(const struct btrfs_block_group *bg) {

L417:    ASSERT(btrfs_is_zoned(bg->fs_info));
    return (bg->alloc_offset == bg->zone_capacity);
}

Any help to fix it?

Best Regards
Wang Yugui ([email protected])
2025/12/22

#1 lore raw
Quoted 8 lines · Wang Yugui

Hi,

I noticed a lot of make C=1 error of btrfs ASSERT(), but make C=0 is OK.

block-group.c: note: in included file:
zoned.h:417:9: error: Expected ) in function call
zoned.h:417:9: error: got __VA_OPT__

You know this is from sparse right?

And sparse is known to cause false positive.

Quoted 8 lines

static inline bool btrfs_zoned_bg_is_full(const struct btrfs_block_group *bg) {

L417:    ASSERT(btrfs_is_zoned(bg->fs_info));
     return (bg->alloc_offset == bg->zone_capacity);
}

Any help to fix it?

Then why don't you dig it deeper?
You are an employed developer, not some newbie.

Do your work, not off load it to others.

Quoted 7 lines

Best Regards
Wang Yugui ([email protected])
2025/12/22

author
#2 lore raw
In reply to Wang Yugui

Hi

Quoted 9 lines

Hi,

I noticed a lot of make C=1 error of btrfs ASSERT(), but make C=0 is OK.

block-group.c: note: in included file:
zoned.h:417:9: error: Expected ) in function call
zoned.h:417:9: error: got __VA_OPT__

Quoted 7 lines

static inline bool btrfs_zoned_bg_is_full(const struct btrfs_block_group *bg) {

L417:    ASSERT(btrfs_is_zoned(bg->fs_info));
    return (bg->alloc_offset == bg->zone_capacity);
}

Any help to fix it?

We can walk around this problem with the flowing patch. It seems that sparse(make C=1) does yet not support __VA_OPT__.

fs/btrfs/messages.h +1 -1
index dea30823d61a..8755a5bc7ece 100644
@@ -111,7 +111,7 @@ static inline void verify_assert_printk_format(const char *fmt, ...) {
  * As ##__VA_ARGS__ cannot be at the beginning of the macro the __VA_OPT__ is needed
  * and supported since GCC 8 and Clang 12.
  */
-#define __REST_ARGS(_, ... ) __VA_OPT__(,) __VA_ARGS__
+#define __REST_ARGS(_, ... ) , ##__VA_ARGS__
 
 #if defined(CONFIG_CC_IS_CLANG) || GCC_VERSION >= 80000
 /*

Best Regards
Wang Yugui ([email protected])
2025/12/25