btrfs/085: check flakey device instead of backend device
[xfstests-dev.git] / tests / btrfs / 085
index d82f79ac3152415c154bb5ab3f669f6ead324a61..2a31eefd2013092e817731cc1ebb8df61f5d1ad3 100755 (executable)
@@ -1,4 +1,7 @@
 #!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2015 SUSE.  All Rights Reserved.
+#
 # FS QA Test No. btrfs/085
 #
 # Tests to ensure that orphan items are properly created and cleaned up
 #    (i.e. btrfs subvol set-default)
 # 3) Non-default subvolume lookup
 #
-#-----------------------------------------------------------------------
-# Copyright (c) 2015 SUSE.  All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-#-----------------------------------------------------------------------
-#
-
 seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
@@ -55,17 +39,14 @@ _supported_fs btrfs
 _supported_os Linux
 _require_scratch
 _require_dm_target flakey
-_need_to_be_root
-
-BTRFS_DEBUG_TREE_PROG="`set_prog_path btrfs-debug-tree`"
-_require_command "$BTRFS_DEBUG_TREE_PROG" btrfs-debug-tree
+_require_btrfs_command inspect-internal dump-tree
 
 rm -f $seqres.full
 
 has_orphan_item()
 {
        INO=$1
-       if $BTRFS_DEBUG_TREE_PROG $SCRATCH_DEV | \
+       if $BTRFS_UTIL_PROG inspect-internal dump-tree $FLAKEY_DEV | \
                grep -q "key (ORPHAN ORPHAN_ITEM $INO)"; then
                return 0
        fi
@@ -135,14 +116,14 @@ test_orphan()
 
 new_subvolume()
 {
-       _run_btrfs_util_prog subvol create $SCRATCH_MNT/testdir
+       _run_btrfs_util_prog subvolume create $SCRATCH_MNT/testdir
 }
 
 new_default()
 {
        new_subvolume
-       SUB=$($BTRFS_UTIL_PROG subvol list $SCRATCH_MNT |awk '{print $2}')
-       _run_btrfs_util_prog subvol set-default $SUB $SCRATCH_MNT
+       SUB=$($BTRFS_UTIL_PROG subvolume list $SCRATCH_MNT |awk '{print $2}')
+       _run_btrfs_util_prog subvolume set-default $SUB $SCRATCH_MNT
 
        _unmount_flakey
        _mount_flakey