]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
btrfs: add helper to kill background process running _btrfs_stress_defrag
authorFilipe Manana <fdmanana@suse.com>
Wed, 27 Mar 2024 17:11:39 +0000 (17:11 +0000)
committerAnand Jain <anand.jain@oracle.com>
Wed, 3 Apr 2024 07:08:24 +0000 (15:08 +0800)
commitd6b4a1531fbb15dee7db86272eabe4fd86c49465
treefd2b335e0b4d967d885bb8238e5fba4bce567e28
parentb2a3bc018fe0e23c2fbd9df89353ca048b28ad73
btrfs: add helper to kill background process running _btrfs_stress_defrag

Killing a background process running _btrfs_stress_defrag() is not as
simple as sending a signal to the process and waiting for it to die.
Therefore we have the following logic to terminate such process:

       kill $pid
       wait $pid
       while ps aux | grep "btrfs filesystem defrag" | grep -qv grep; do
           sleep 1
       done

Since this is repeated in several test cases, move this logic to a common
helper and use it in all affected test cases. This will help to avoid
repeating the same code again several times in upcoming changes.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
common/btrfs
tests/btrfs/062
tests/btrfs/067
tests/btrfs/070
tests/btrfs/072
tests/btrfs/074