From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Anand Jain <anand.jain@oracle.com>, fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs/124: add balance --full-balance option
Date: Tue, 5 Dec 2017 16:30:33 +0800 [thread overview]
Message-ID: <0a70d47c-7bcc-a6ff-c79e-b988fd305818@gmx.com> (raw)
In-Reply-To: <20171205082628.1676-1-anand.jain@oracle.com>
[-- Attachment #1.1: Type: text/plain, Size: 1936 bytes --]
On 2017年12月05日 16:26, Anand Jain wrote:
> btrfs balance needs --full-balance option since 4.6, so check the
> version and then use it.
>
> As this may be useful for other btrfs tests as well, so this patch
> adds _btrfs_full_balance_option() to the common/btrfs file.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> common/btrfs | 13 +++++++++++++
> tests/btrfs/124 | 3 ++-
> 2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/common/btrfs b/common/btrfs
> index c09206c6f292..8ca6486b26dc 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -356,3 +356,16 @@ _btrfs_compression_algos()
> echo "${feature#/sys/fs/btrfs/features/compress_}"
> done
> }
> +
> +#btrfs-progs adds required --full-balance option since v4.6 so check for
> +#that and then return the required option.
> +_btrfs_full_balance_option()
> +{
> + ver=$($BTRFS_UTIL_PROG --version|awk '{print $2}'|cut -d"-" -f1 | cut -d"v" -f2)
I'm never a fan of version check.
Backporting or modified package version can easily screw this up.
Why not directly checking the help message of "btrfs balance start"?
Thanks,
Qu
> + tup1=$(echo $ver| cut -d"." -f1)
> + tup2=$(echo $ver| cut -d"." -f2)
> +
> + RET=""
> + (("$tup1" > "4")) && RET="--full-balance"
> + (("$tup1" == "4")) && (("tup2" >= "6")) && RET="--full-balance"
> +}
> diff --git a/tests/btrfs/124 b/tests/btrfs/124
> index a6486270a972..ec1d24b5ef42 100755
> --- a/tests/btrfs/124
> +++ b/tests/btrfs/124
> @@ -129,7 +129,8 @@ _run_btrfs_util_prog device scan
> _scratch_mount >> $seqres.full 2>&1
> _run_btrfs_util_prog filesystem show
> echo >> $seqres.full
> -_run_btrfs_util_prog balance start ${SCRATCH_MNT}
> +_btrfs_full_balance_option
> +_run_btrfs_util_prog balance start $RET ${SCRATCH_MNT}
>
> checkpoint2=`md5sum $SCRATCH_MNT/tf2`
> echo $checkpoint2 >> $seqres.full 2>&1
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]
next prev parent reply other threads:[~2017-12-05 8:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-05 8:26 [PATCH] btrfs/124: add balance --full-balance option Anand Jain
2017-12-05 8:30 ` Qu Wenruo [this message]
2017-12-05 8:40 ` Eryu Guan
2017-12-05 9:02 ` Anand Jain
2017-12-05 8:54 ` Anand Jain
2017-12-05 11:36 ` [PATCH v2] " Anand Jain
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=0a70d47c-7bcc-a6ff-c79e-b988fd305818@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=anand.jain@oracle.com \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).