From: Gabriel Niebler <gabriel.niebler@suse.com>
To: David Disseldorp <ddiss@suse.de>, fstests@vger.kernel.org
Subject: Re: [PATCH] common/btrfs: avoid reinitialization of unsupported profile array
Date: Tue, 7 Feb 2023 11:00:58 +0100 [thread overview]
Message-ID: <bae014d8-aabe-8f80-260a-d2767019f49e@suse.com> (raw)
In-Reply-To: <20230111105827.16852-1-ddiss@suse.de>
Am 11.01.23 um 11:58 schrieb David Disseldorp:
> The _btrfs_get_profile_configs() unsupported array doesn't change
> between configs, so avoid reinitializing it on each loop iteration.
>
> Signed-off-by: David Disseldorp <ddiss@suse.de>
> ---
> common/btrfs | 66 ++++++++++++++++++++++++++--------------------------
> 1 file changed, 33 insertions(+), 33 deletions(-)
>
> diff --git a/common/btrfs b/common/btrfs
> index ee673a93..9531c914 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -201,6 +201,39 @@ _btrfs_get_profile_configs()
> return
> fi
>
> + local unsupported=()
> + if [ "$1" == "replace" ]; then
> + # We can't do replace with these profiles because they
> + # imply only one device ($SCRATCH_DEV), and we need to
> + # keep $SCRATCH_DEV around for _scratch_mount
> + # and _check_scratch_fs.
> + unsupported+=(
> + "dup"
> + )
> + elif [ "$1" == "replace-missing" ]; then
> + # We can't replace missing devices with these profiles
> + # because there isn't enough redundancy.
> + unsupported+=(
> + "single"
> + "dup"
> + "raid0"
> + )
> + fi
> +
> + if _scratch_btrfs_is_zoned; then
> + # Zoned btrfs only supports SINGLE profile
> + unsupported+=(
> + "dup"
> + "raid0"
> + "raid1"
> + "raid1c3"
> + "raid1c4"
> + "raid10"
> + "raid5"
> + "raid6"
> + )
> + fi
> +
> if [ -z "$BTRFS_PROFILE_CONFIGS" ]; then
> # Default configurations to test.
> local configs=(
> @@ -222,39 +255,6 @@ _btrfs_get_profile_configs()
> for cfg in "${configs[@]}"; do
> local supported=true
> local profiles=(${cfg/:/ })
> - if [ "$1" == "replace" ]; then
> - # We can't do replace with these profiles because they
> - # imply only one device ($SCRATCH_DEV), and we need to
> - # keep $SCRATCH_DEV around for _scratch_mount
> - # and _check_scratch_fs.
> - local unsupported=(
> - "dup"
> - )
> - elif [ "$1" == "replace-missing" ]; then
> - # We can't replace missing devices with these profiles
> - # because there isn't enough redundancy.
> - local unsupported=(
> - "single"
> - "dup"
> - "raid0"
> - )
> - else
> - local unsupported=()
> - fi
> -
> - if _scratch_btrfs_is_zoned; then
> - # Zoned btrfs only supports SINGLE profile
> - unsupported+=(
> - "dup"
> - "raid0"
> - "raid1"
> - "raid1c3"
> - "raid1c4"
> - "raid10"
> - "raid5"
> - "raid6"
> - )
> - fi
>
> for unsupp in "${unsupported[@]}"; do
> if [ "${profiles[0]}" == "$unsupp" -o "${profiles[1]}" == "$unsupp" ]; then
This seems like a good change.
It only makes sense and in my local testing it reduced btrfs test run
time by 10-17 seconds overall.
Not a huge amount, but every little helps.
--
Gabriel Niebler (he/him/his)
Senior Full-Stack Web Developer
SUSE
gabriel.niebler@suse.com
www.suse.com
next prev parent reply other threads:[~2023-02-07 10:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-11 10:58 [PATCH] common/btrfs: avoid reinitialization of unsupported profile array David Disseldorp
2023-02-07 10:00 ` Gabriel Niebler [this message]
2023-02-09 15:11 ` Zorro Lang
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=bae014d8-aabe-8f80-260a-d2767019f49e@suse.com \
--to=gabriel.niebler@suse.com \
--cc=ddiss@suse.de \
--cc=fstests@vger.kernel.org \
/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