diff mbox series

[02/10] btrfs/028: use the helper _btrfs_kill_stress_balance_pid

Message ID 375e94a8cc448c369d4346cba2f6ef6f65b34df6.1711558345.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series fstests/btrfs: fixes for tests btrfs/06[0-9] and btrfs/07[0-4] | expand

Commit Message

Filipe Manana March 27, 2024, 5:11 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

Now that there's a helper to kill a background process that is running
_btrfs_stress_balance(), use it in btrfs/028. It's equivalent to the
existing code in btrfs/028.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 tests/btrfs/028 | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Anand Jain March 28, 2024, 8:41 a.m. UTC | #1
On 3/28/24 01:11, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Now that there's a helper to kill a background process that is running
> _btrfs_stress_balance(), use it in btrfs/028. It's equivalent to the
> existing code in btrfs/028.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
>   tests/btrfs/028 | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/btrfs/028 b/tests/btrfs/028
> index d860974e..8fbe8887 100755
> --- a/tests/btrfs/028
> +++ b/tests/btrfs/028
> @@ -44,12 +44,9 @@ balance_pid=$!
>   
>   # 30s is enough to trigger bug
>   sleep $((30*$TIME_FACTOR))
> -kill $fsstress_pid $balance_pid &> /dev/null
> -wait
> -
> -# kill _btrfs_stress_balance can't end balance, so call btrfs balance cancel
> -# to cancel running or paused balance. > -$BTRFS_UTIL_PROG balance cancel $SCRATCH_MNT &> /dev/null
> +kill $fsstress_pid &> /dev/null
> +wait $fsstress_pid &> /dev/null
> +_btrfs_kill_stress_balance_pid $balance_pid

  I didn't understand the point of replacing 'balance cancel'
  with 'kill'. The Git change log also doesn't say anything
  about it. The old code also tested BTRFS_IOC_BALANCE_CTL ioctl.

Thanks, Anand


>   _run_btrfs_util_prog filesystem sync $SCRATCH_MNT
>
Filipe Manana March 28, 2024, 9:25 a.m. UTC | #2
On Thu, Mar 28, 2024 at 8:41 AM Anand Jain <anand.jain@oracle.com> wrote:
>
> On 3/28/24 01:11, fdmanana@kernel.org wrote:
> > From: Filipe Manana <fdmanana@suse.com>
> >
> > Now that there's a helper to kill a background process that is running
> > _btrfs_stress_balance(), use it in btrfs/028. It's equivalent to the
> > existing code in btrfs/028.
> >
> > Signed-off-by: Filipe Manana <fdmanana@suse.com>
> > ---
> >   tests/btrfs/028 | 9 +++------
> >   1 file changed, 3 insertions(+), 6 deletions(-)
> >
> > diff --git a/tests/btrfs/028 b/tests/btrfs/028
> > index d860974e..8fbe8887 100755
> > --- a/tests/btrfs/028
> > +++ b/tests/btrfs/028
> > @@ -44,12 +44,9 @@ balance_pid=$!
> >
> >   # 30s is enough to trigger bug
> >   sleep $((30*$TIME_FACTOR))
> > -kill $fsstress_pid $balance_pid &> /dev/null
> > -wait
> > -
> > -# kill _btrfs_stress_balance can't end balance, so call btrfs balance cancel
> > -# to cancel running or paused balance. > -$BTRFS_UTIL_PROG balance cancel $SCRATCH_MNT &> /dev/null
> > +kill $fsstress_pid &> /dev/null
> > +wait $fsstress_pid &> /dev/null
> > +_btrfs_kill_stress_balance_pid $balance_pid
>
>   I didn't understand the point of replacing 'balance cancel'
>   with 'kill'. The Git change log also doesn't say anything
>   about it. The old code also tested BTRFS_IOC_BALANCE_CTL ioctl.

The point is to use the helper to kill the background task running
balance in a loop, so for every _btrfs_stress_balance() call we have a
matching _btrfs_kill_stress_balance_pid().

Doing the kill + cancel is equivalent to what the helper does, and the
goal of the test is not to exercise the balance cancel.

Thanks.


>
> Thanks, Anand
>
>
> >   _run_btrfs_util_prog filesystem sync $SCRATCH_MNT
> >
>
diff mbox series

Patch

diff --git a/tests/btrfs/028 b/tests/btrfs/028
index d860974e..8fbe8887 100755
--- a/tests/btrfs/028
+++ b/tests/btrfs/028
@@ -44,12 +44,9 @@  balance_pid=$!
 
 # 30s is enough to trigger bug
 sleep $((30*$TIME_FACTOR))
-kill $fsstress_pid $balance_pid &> /dev/null
-wait
-
-# kill _btrfs_stress_balance can't end balance, so call btrfs balance cancel
-# to cancel running or paused balance.
-$BTRFS_UTIL_PROG balance cancel $SCRATCH_MNT &> /dev/null
+kill $fsstress_pid &> /dev/null
+wait $fsstress_pid &> /dev/null
+_btrfs_kill_stress_balance_pid $balance_pid
 
 _run_btrfs_util_prog filesystem sync $SCRATCH_MNT