]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: use simple assertions where enough during inode logging and replay
authorFilipe Manana <fdmanana@suse.com>
Thu, 7 May 2026 12:05:16 +0000 (13:05 +0100)
committerFilipe Manana <fdmanana@suse.com>
Tue, 9 Jun 2026 10:49:24 +0000 (11:49 +0100)
In overwrite_item():

  There's no point in printing the root's ID if the assertion fails, since
  it can only be BTRFS_TREE_LOG_OBJECTID if it fails.

In log_new_delayed_dentries():

  There's no point in using a verbose assertion to print the value of
  ctx->logging_new_delayed_dentries because it's a boolean, so if the
  assertion fails we know its value is true (1).

So convert them to simpler assertion to make the code less verbose.
It also slightly reduces the object size, at least on x86_64 using
Debian's gcc 14.2.0-19 (if CONFIG_BTRFS_ASSERT is enabled in the kernel
config, which is the case for SUSE distributions for example).

Before:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  2028244  197176   15624 2241044  223214 fs/btrfs/btrfs.ko

After:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  2028228  197176   15624 2241028  223204 fs/btrfs/btrfs.ko

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c

index f91924372494fc7e831d54060213dcfed7228105..12421ae640be5fc1a6a24cb51f2b2ef8fa2fa4e0 100644 (file)
@@ -491,7 +491,7 @@ static int overwrite_item(struct walk_control *wc)
         * the leaf before writing into the log tree. See the comments at
         * copy_items() for more details.
         */
-       ASSERT(btrfs_root_id(root) != BTRFS_TREE_LOG_OBJECTID, "root_id=%llu", btrfs_root_id(root));
+       ASSERT(btrfs_root_id(root) != BTRFS_TREE_LOG_OBJECTID);
 
        item_size = btrfs_item_size(wc->log_leaf, wc->log_slot);
        src_ptr = btrfs_item_ptr_offset(wc->log_leaf, wc->log_slot);
@@ -6843,8 +6843,7 @@ static int log_new_delayed_dentries(struct btrfs_trans_handle *trans,
         */
        lockdep_assert_not_held(&inode->log_mutex);
 
-       ASSERT(!ctx->logging_new_delayed_dentries,
-              "ctx->logging_new_delayed_dentries=%d", ctx->logging_new_delayed_dentries);
+       ASSERT(!ctx->logging_new_delayed_dentries);
        ctx->logging_new_delayed_dentries = true;
 
        list_for_each_entry(item, delayed_ins_list, log_list) {