Re: [PATCH 2/5] btrfs/282: append scrub status output to 282.full

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]





On 2023/12/7 17:50, David Disseldorp wrote:
Also, collapse the grep/cut usage into the existing awk one-liner.

Signed-off-by: David Disseldorp <ddiss@xxxxxxx>

This change itself is totally fine independent of the fix for btrfs/282.

Reviewed-by: Qu Wenruo <wqu@xxxxxxxx>

Thanks,
Qu
---
  tests/btrfs/282 | 10 ++++++----
  1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/btrfs/282 b/tests/btrfs/282
index 395e0626..66d14f82 100755
--- a/tests/btrfs/282
+++ b/tests/btrfs/282
@@ -60,8 +60,9 @@ $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >> $seqres.full
  # Error summary:    no errors found
  #
  # What we care is that Rate line.
-init_speed=$($BTRFS_UTIL_PROG scrub status --raw $SCRATCH_MNT | grep "Rate:" |\
-	     $AWK_PROG '{print $2}' | cut -f1 -d\/)
+init_speed=$($BTRFS_UTIL_PROG scrub status --raw $SCRATCH_MNT |\
+	     tee -a $seqres.full |\
+	     $AWK_PROG '$1 == "Rate:" {sub(/\/s/, "", $2); print $2}')

  # This can happen for older progs
  if [ -z "$init_speed" ]; then
@@ -76,8 +77,9 @@ echo "$target_speed" > "${devinfo_dir}/scrub_speed_max"

  # The second scrub, to check the throttled speed.
  $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >> $seqres.full
-speed=$($BTRFS_UTIL_PROG scrub status --raw $SCRATCH_MNT | grep "Rate:" |\
-	     $AWK_PROG '{print $2}' | cut -f1 -d\/)
+speed=$($BTRFS_UTIL_PROG scrub status --raw $SCRATCH_MNT |\
+	tee -a $seqres.full |\
+	$AWK_PROG '$1 == "Rate:" {sub(/\/s/, "", $2); print $2}')

  # We gave a +- 10% tolerance for the throttle
  if [ "$speed" -gt "$(( $target_speed * 11 / 10 ))" -o \





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux