From: Filipe Manana Date: Thu, 7 May 2026 12:05:16 +0000 (+0100) Subject: btrfs: use simple assertions where enough during inode logging and replay X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=fdae3bfd2d3cccc859e90a1754d596526609922a;p=thirdparty%2Flinux.git btrfs: use simple assertions where enough during inode logging and replay 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 Signed-off-by: Filipe Manana Signed-off-by: David Sterba --- diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index f91924372494f..12421ae640be5 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -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) {