From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/3] btrfs-progs: convert/ext2: new debug environment variable to finetune transaction size
Date: Tue, 16 Jan 2024 19:31:52 +0100 [thread overview]
Message-ID: <20240116183152.GC31555@twin.jikos.cz> (raw)
In-Reply-To: <4c2f12dc417a192f4acfd804831401aadeeb9c42.1705135055.git.wqu@suse.com>
On Sat, Jan 13, 2024 at 07:15:29PM +1030, Qu Wenruo wrote:
> 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 <wqu@suse.com>
> ---
> 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)
There already is a function for parsing sizes parse_size_from_string()
in common/parse-utils.c.
next prev parent reply other threads:[~2024-01-16 18:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-13 8:45 [PATCH 0/3] btrfs-progs: allow tree-checker to be triggered more frequently for btrfs-convert Qu Wenruo
2024-01-13 8:45 ` [PATCH 1/3] btrfs-progs: convert/ext2: new debug environment variable to finetune transaction size Qu Wenruo
2024-01-16 18:31 ` David Sterba [this message]
2024-01-16 20:20 ` Qu Wenruo
2024-01-17 1:08 ` David Sterba
2024-01-17 2:26 ` Qu Wenruo
2024-01-13 8:45 ` [PATCH 2/3] btrfs-progs: new debug environment variable to finetune metadata cache size Qu Wenruo
2024-01-13 8:45 ` [PATCH 3/3] btrfs-progs: convert-tests: trigger tree-checker more frequently Qu Wenruo
2024-01-16 18:37 ` [PATCH 0/3] btrfs-progs: allow tree-checker to be triggered more frequently for btrfs-convert David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240116183152.GC31555@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox