From patchwork Sat Jan 13 08:45:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13518900 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9F2A384 for ; Sat, 13 Jan 2024 08:45:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="rrpCQV/B"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="rrpCQV/B" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D331D22300 for ; Sat, 13 Jan 2024 08:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1705135554; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yd8C5R+MoZXv/XRzZ7zT9HELV0cOVxC5Slc7NI+9UMY=; b=rrpCQV/BIqlJcxYO1iUuaXKia7eaHQMvIU+zndsxOwGyGYTvehm0/CSS9pA2yZDqppfLLK ZQpePP6VjvCua4lXHI1owPW9gXBcnzMdFQ/dvPFAlalntjQFhrsVItwmYz7XRDBoF0dXrE HesyzjV95zmqwk5WqeLNi3joB3baxKs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1705135554; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yd8C5R+MoZXv/XRzZ7zT9HELV0cOVxC5Slc7NI+9UMY=; b=rrpCQV/BIqlJcxYO1iUuaXKia7eaHQMvIU+zndsxOwGyGYTvehm0/CSS9pA2yZDqppfLLK ZQpePP6VjvCua4lXHI1owPW9gXBcnzMdFQ/dvPFAlalntjQFhrsVItwmYz7XRDBoF0dXrE HesyzjV95zmqwk5WqeLNi3joB3baxKs= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1FB4713676 for ; Sat, 13 Jan 2024 08:45:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id oPIoNcFNomVLeQAAD6G6ig (envelope-from ) for ; Sat, 13 Jan 2024 08:45:53 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 1/3] btrfs-progs: convert/ext2: new debug environment variable to finetune transaction size Date: Sat, 13 Jan 2024 19:15:29 +1030 Message-ID: <4c2f12dc417a192f4acfd804831401aadeeb9c42.1705135055.git.wqu@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: 0.70 X-Spamd-Result: default: False [0.70 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[linux-btrfs@vger.kernel.org]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Spam-Flag: NO Since we got a recent bug report about tree-checker triggered for large fs conversion, we need a properly way to trigger the problem for test case purpose. To trigger that bug, we need to meet several conditions: - We need to read some tree blocks which has half-backed inodes - We need a large enough enough fs to generate more tree blocks than our cache. For our existing test cases, firstly the fs is not that large, thus we may even go just one transaction to generate all the inodes. Secondly we have a global cache for tree blocks, which means a lot of written tree blocks are still in the cache, thus won't trigger tree-checker. To make the problem much easier for our existing test case to expose, this patch would introduce a debug environment variable: BTRFS_PROGS_DEBUG_BLOCKS_USED_THRESHOLD. This would affects the threshold for the transaction size, setting it to a much smaller value would make the bug much easier to trigger. Signed-off-by: Qu Wenruo --- common/utils.c | 62 +++++++++++++++++++++++++++++++++++++++++++ common/utils.h | 1 + convert/source-ext2.c | 9 ++++++- 3 files changed, 71 insertions(+), 1 deletion(-) diff --git a/common/utils.c b/common/utils.c index 62f0e3f48b39..e6070791f5cc 100644 --- a/common/utils.c +++ b/common/utils.c @@ -956,6 +956,68 @@ u8 rand_u8(void) return (u8)(rand_u32()); } +/* + * Parse a u64 value from an environment variable. + * + * Supports unit suffixes "KMGTP", the suffix is always 2 ** 10 based. + * With proper overflow detection. + * + * The string must end with '\0', anything unexpected non-suffix string, + * including space, would lead to -EINVAL and no value updated. + */ +int get_env_u64(const char *env_name, u64 *value_ret) +{ + char *env_value_str; + char *retptr = NULL; + int shift = 0; + u64 value; + + env_value_str = getenv(env_name); + if (!env_value_str) + return -ENOENT; + value = strtoull(env_value_str, &retptr, 0); + /* No numeric string found. */ + if (retptr == env_value_str) + return -EINVAL; + if (value == ULLONG_MAX && errno == ERANGE) + return -ERANGE; + /* memparse_safe() like suffix detection. */ + switch (*retptr) { + case 'K': + case 'k': + shift = 10; + break; + case 'M': + case 'm': + shift = 20; + break; + case 'G': + case 'g': + shift = 30; + break; + case 'T': + case 't': + shift = 40; + break; + case 'P': + case 'p': + shift = 50; + break; + } + if (shift) { + retptr++; + if (value >> (64 - shift)) + return -ERANGE; + value <<= shift; + } + if (*retptr != '\0') + return -EINVAL; + pr_verbose(LOG_VERBOSE, "received env \"%s\" value %llu\n", + env_name, value); + *value_ret = value; + return 0; +} + void btrfs_config_init(void) { bconf.output_format = CMD_FORMAT_TEXT; diff --git a/common/utils.h b/common/utils.h index dcd817144f9c..30c75339b05b 100644 --- a/common/utils.h +++ b/common/utils.h @@ -132,6 +132,7 @@ u32 rand_u32(void); u64 rand_u64(void); unsigned int rand_range(unsigned int upper); void init_rand_seed(u64 seed); +int get_env_u64(const char *env_name, u64 *value_ret); char *btrfs_test_for_multiple_profiles(int fd); int btrfs_warn_multiple_profiles(int fd); diff --git a/convert/source-ext2.c b/convert/source-ext2.c index f56d79734715..e5f85111a711 100644 --- a/convert/source-ext2.c +++ b/convert/source-ext2.c @@ -30,6 +30,7 @@ #include "kernel-shared/file-item.h" #include "common/extent-cache.h" #include "common/messages.h" +#include "common/utils.h" #include "convert/common.h" #include "convert/source-fs.h" #include "convert/source-ext2.h" @@ -974,6 +975,11 @@ static int ext2_copy_inodes(struct btrfs_convert_context *cctx, ext2_ino_t ext2_ino; u64 objectid; struct btrfs_trans_handle *trans; + /* The hint on when to commit the transaction. */ + u64 blocks_used_threshold = SZ_2M; + + get_env_u64("BTRFS_PROGS_DEBUG_BLOCKS_USED_THRESHOLD", + &blocks_used_threshold); trans = btrfs_start_transaction(root, 1); if (IS_ERR(trans)) @@ -1014,7 +1020,8 @@ static int ext2_copy_inodes(struct btrfs_convert_context *cctx, * large enough to contain over 300 inlined files or * around 26k file extents. Which should be good enough. */ - if (trans->blocks_used >= SZ_2M / root->fs_info->nodesize) { + if (trans->blocks_used >= + (blocks_used_threshold / root->fs_info->nodesize)) { ret = btrfs_commit_transaction(trans, root); if (ret < 0) { errno = -ret; From patchwork Sat Jan 13 08:45:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13518901 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2CBC7E6 for ; Sat, 13 Jan 2024 08:45:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="thKO830Y"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="thKO830Y" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0D2C722301 for ; Sat, 13 Jan 2024 08:45:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1705135556; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xIrKLlxboeuTO0Iz3/DMqmd85/kfDqfm7m4Ob4C86sk=; b=thKO830YML9GBfQsCOX8wwAn/0UFcYtj2MlhY9H0AWBsNcXHqy2/9c13Wcfztral06BdvO bRVtXEIx6ZjkZyxWgRBuDhp1xnPI6v9BAK8n98pWK1D8rEfxDpxrNuqdZLZRte0cjaAXBZ IwxF88dA2UjmVKxunryVkdFQaD9QnNI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1705135556; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xIrKLlxboeuTO0Iz3/DMqmd85/kfDqfm7m4Ob4C86sk=; b=thKO830YML9GBfQsCOX8wwAn/0UFcYtj2MlhY9H0AWBsNcXHqy2/9c13Wcfztral06BdvO bRVtXEIx6ZjkZyxWgRBuDhp1xnPI6v9BAK8n98pWK1D8rEfxDpxrNuqdZLZRte0cjaAXBZ IwxF88dA2UjmVKxunryVkdFQaD9QnNI= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 4DFA313676 for ; Sat, 13 Jan 2024 08:45:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id UBX/BMNNomVLeQAAD6G6ig (envelope-from ) for ; Sat, 13 Jan 2024 08:45:55 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/3] btrfs-progs: new debug environment variable to finetune metadata cache size Date: Sat, 13 Jan 2024 19:15:30 +1030 Message-ID: <07579fc7e3a960384f9e4e455c11c3407f68cab1.1705135055.git.wqu@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [4.90 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[linux-btrfs@vger.kernel.org]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: **** X-Spam-Score: 4.90 X-Spam-Flag: NO Since we got a recent bug report about tree-checker triggered for large fs conversion, we need a properly way to trigger the problem for test case purpose. To trigger that bug, we need to meet several conditions: - We need to read some tree blocks which has half-backed inodes - We need a large enough enough fs to generate more tree blocks than our cache. For our existing test cases, firstly the fs is not that large, thus we may even go just one transaction to generate all the inodes. Secondly we have a global cache for tree blocks, which means a lot of written tree blocks are still in the cache, thus won't trigger tree-checker. To make the problem much easier for our existing test case to expose, this patch would introduce a debug environment variable: BTRFS_PROGS_DEBUG_METADATA_CACHE_SIZE. This variable allows us to finetune the cache size, so that we can reduce the metadata cache size and trigger more read thus more tree-checker checks to shake out more bugs. Signed-off-by: Qu Wenruo --- kernel-shared/extent_io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel-shared/extent_io.c b/kernel-shared/extent_io.c index ee19430daa12..ce5e4ffb7a59 100644 --- a/kernel-shared/extent_io.c +++ b/kernel-shared/extent_io.c @@ -43,7 +43,10 @@ static void free_extent_buffer_final(struct extent_buffer *eb); void extent_buffer_init_cache(struct btrfs_fs_info *fs_info) { - fs_info->max_cache_size = total_memory() / 4; + u64 max_cache_size = total_memory() / 4; + + get_env_u64("BTRFS_PROGS_DEBUG_METADATA_CACHE_SIZE", &max_cache_size); + fs_info->max_cache_size = max_cache_size; fs_info->cache_size = 0; INIT_LIST_HEAD(&fs_info->lru); } From patchwork Sat Jan 13 08:45:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13518902 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2939D17EB for ; Sat, 13 Jan 2024 08:45:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="iktPLysm"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="iktPLysm" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3C8DE22302 for ; Sat, 13 Jan 2024 08:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1705135557; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LQOLUmK4HcgSZNrAI1BQsy9N2LDLCDtgmOG0RMf2X/E=; b=iktPLysm/9/8gxzwuiDizgug0p4lpQIQbNy/u9awokW+0rZmPzqvRUzjZmRyWRTWmCa8to 0/CyaXNh23Id1BR2jWMvsVy8REPmheIILYZtxtqMgJBZn4qb74cqu1CQkP3dmBgPKXK5It N8CPxSDhte85bH6wFawvLzG+jEAy8eY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1705135557; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LQOLUmK4HcgSZNrAI1BQsy9N2LDLCDtgmOG0RMf2X/E=; b=iktPLysm/9/8gxzwuiDizgug0p4lpQIQbNy/u9awokW+0rZmPzqvRUzjZmRyWRTWmCa8to 0/CyaXNh23Id1BR2jWMvsVy8REPmheIILYZtxtqMgJBZn4qb74cqu1CQkP3dmBgPKXK5It N8CPxSDhte85bH6wFawvLzG+jEAy8eY= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7BC3E13676 for ; Sat, 13 Jan 2024 08:45:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id CCIlEMRNomVLeQAAD6G6ig (envelope-from ) for ; Sat, 13 Jan 2024 08:45:56 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 3/3] btrfs-progs: convert-tests: trigger tree-checker more frequently Date: Sat, 13 Jan 2024 19:15:31 +1030 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Level: Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=iktPLysm X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-1.51 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_MED(-2.00)[suse.com:dkim]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[linux-btrfs@vger.kernel.org]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; DKIM_TRACE(0.00)[suse.com:+]; MX_GOOD(-0.01)[]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:dkim,suse.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Spam-Score: -1.51 X-Rspamd-Queue-Id: 3C8DE22302 X-Spam-Flag: NO Inspired by a recent bug report where a large ext4 fs can lead to tree-checker warning on bad previous key objectid, we need a way to trigger tree-checker more frequently to shake out hidden bugs. This patch would set blocks_used threshold of btrfs-convert to 16K, and global metadata cache size to 16K (instead of 1/4 of total memory) for convert-tests/001 and convert-tests/003. With those two small values, it's already enough to trigger the bad previous key objectid bugs (without the proper fixes): [TEST/conv] 001-ext2-basic [TEST/conv] ext2 4k nodesize, btrfs defaults failed: /home/adam/btrfs-progs/btrfs-convert -N 4096 /home/adam/btrfs-progs/tests/test.img test failed for case 001-ext2-basic And the failure is exactly the reported one: Create ext2 image file Create btrfs metadata Copy inodes [o] [ 0/ 529] corrupt leaf: root=5 block=147079168 slot=25 ino=267, invalid previous key objectid, have 266 expect 267 Signed-off-by: Qu Wenruo --- tests/convert-tests/001-ext2-basic/test.sh | 7 +++++++ tests/convert-tests/003-ext4-basic/test.sh | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/tests/convert-tests/001-ext2-basic/test.sh b/tests/convert-tests/001-ext2-basic/test.sh index 6dc105b55e27..35bc39cee243 100755 --- a/tests/convert-tests/001-ext2-basic/test.sh +++ b/tests/convert-tests/001-ext2-basic/test.sh @@ -10,6 +10,13 @@ setup_root_helper prepare_test_dev check_kernel_support_acl +# Extra finetunes to make btrfs-convert to commit transaction for each copied +# inode, and keep cached tree blocks to minimal. +# This is to ensure tree-checker is triggered for as many tree blocks as +# possible, and expose any bad convert metadata behavior. +export BTRFS_PROGS_DEBUG_BLOCKS_USED_THRESHOLD=16K +export BTRFS_PROGS_DEBUG_METADATA_CACHE_SIZE=16K + # Iterate over defaults and options that are not tied to hardware capabilities # or number of devices for feature in '' 'block-group-tree' ; do diff --git a/tests/convert-tests/003-ext4-basic/test.sh b/tests/convert-tests/003-ext4-basic/test.sh index 8ae5264cb340..64041d91fcb8 100755 --- a/tests/convert-tests/003-ext4-basic/test.sh +++ b/tests/convert-tests/003-ext4-basic/test.sh @@ -10,6 +10,13 @@ setup_root_helper prepare_test_dev check_kernel_support_acl +# Extra finetunes to make btrfs-convert to commit transaction for each copied +# inode, and keep cached tree blocks to minimal. +# This is to ensure tree-checker is triggered for as many tree blocks as +# possible, and expose any bad convert metadata behavior. +export BTRFS_PROGS_DEBUG_BLOCKS_USED_THRESHOLD=16K +export BTRFS_PROGS_DEBUG_METADATA_CACHE_SIZE=16K + # Iterate over defaults and options that are not tied to hardware capabilities # or number of devices for feature in '' 'block-group-tree' ; do