All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@redhat.com>
To: Naohiro Aota <naohiro.aota@wdc.com>
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/2] common: introduce zone_capacity() to return a zone capacity
Date: Thu, 22 Sep 2022 23:41:32 +0800	[thread overview]
Message-ID: <20220922154132.dpadkhaccwzysq4d@zlang-mailbox> (raw)
In-Reply-To: <97ede9bba67f0848fc0b706d757170d7dfacb7fd.1663825728.git.naohiro.aota@wdc.com>

On Thu, Sep 22, 2022 at 02:54:58PM +0900, Naohiro Aota wrote:
> Introduce _zone_capacity() to return a zone capacity of the given address
> in the given device (optional). Rewrite btrfs/237 with it.
> 
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---
>  common/zbd      | 17 +++++++++++++++++
>  tests/btrfs/237 |  8 ++------
>  2 files changed, 19 insertions(+), 6 deletions(-)
>  create mode 100644 common/zbd
> 
> diff --git a/common/zbd b/common/zbd
> new file mode 100644
> index 000000000000..329bb7be6b7b
> --- /dev/null
> +++ b/common/zbd

I don't like this abbreviation :-P If others don't open this file and read the
comment in it, they nearly no chance to guess what's this file for.

> @@ -0,0 +1,17 @@
> +#
> +# Common zoned block device specific functions
> +#
> +
> +. common/filter
> +
> +_zone_capacity() {
> +    local phy=$1
> +    local dev=$2
> +
> +    [ -z "$dev" ] && dev=$SCRATCH_DEV
> +
> +    size=$($BLKZONE_PROG report -o $phy -l 1 $dev |\
> +	       _filter_blkzone_report |\
> +	       grep -Po "cap 0x[[:xdigit:]]+" | cut -d ' ' -f 2)
> +    echo $((size << 9))
> +}

Do you have more zone related helpers are going to provide? If only this
single one helper, I think it's not worth adding a new common file. You
can put it into common/rc simply, as there're already several *zone*
related helpers in it.

We can pick up these *zone* related function into a separate include file in
one day we feel it's time (too many related helpers, and better to be maintained
individually).

Thanks,
Zorro

> diff --git a/tests/btrfs/237 b/tests/btrfs/237
> index bc6522e2200a..101094b5ce70 100755
> --- a/tests/btrfs/237
> +++ b/tests/btrfs/237
> @@ -13,7 +13,7 @@
>  _begin_fstest auto quick zone balance
>  
>  # Import common functions.
> -. ./common/filter
> +. ./common/zbd
>  
>  # real QA test starts here
>  
> @@ -56,11 +56,7 @@ fi
>  
>  start_data_bg_phy=$(get_data_bg_physical)
>  start_data_bg_phy=$((start_data_bg_phy >> 9))
> -
> -size=$($BLKZONE_PROG report -o $start_data_bg_phy -l 1 $SCRATCH_DEV |\
> -	_filter_blkzone_report |\
> -	grep -Po "cap 0x[[:xdigit:]]+" | cut -d ' ' -f 2)
> -size=$((size << 9))
> +size=$(_zone_capacity $start_data_bg_phy)
>  
>  reclaim_threshold=75
>  echo $reclaim_threshold > /sys/fs/btrfs/"$uuid"/bg_reclaim_threshold
> -- 
> 2.37.3
> 


  reply	other threads:[~2022-09-22 15:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22  5:54 [PATCH 0/2] btrfs: test active zone tracking Naohiro Aota
2022-09-22  5:54 ` [PATCH 1/2] common: introduce zone_capacity() to return a zone capacity Naohiro Aota
2022-09-22 15:41   ` Zorro Lang [this message]
2022-09-23  8:02     ` Johannes Thumshirn
2022-09-23 11:51       ` Zorro Lang
2022-09-28  3:57         ` Naohiro Aota
2022-09-28  5:47           ` Zorro Lang
2022-09-28 15:32             ` Darrick J. Wong
2022-09-29  2:40               ` Naohiro Aota
2022-09-22  5:54 ` [PATCH 2/2] btrfs: test active zone tracking Naohiro Aota
2022-09-22 16:03   ` Zorro Lang
2022-09-28  3:58     ` Naohiro Aota
2022-09-22 12:18 ` [PATCH 0/2] " Johannes Thumshirn

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=20220922154132.dpadkhaccwzysq4d@zlang-mailbox \
    --to=zlang@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=naohiro.aota@wdc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.