linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfstest/btrfs/001: fix the misuse of subvolume set-default
@ 2013-09-23  8:47 Liu Bo
  2013-09-23 13:17 ` Josef Bacik
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Bo @ 2013-09-23  8:47 UTC (permalink / raw)
  To: linux-btrfs; +Cc: xfs

The command is
btrfs subvolume set-default <subvolid> <path>.

It uses @subvolid to control the default subvolume and
@subvolid=0 has always been parsed into FS_TREE no matter
what subvolume @path points to.

So in order to set a subvolume to the default one, we need
to get the id of this subvolume first.

Also fix a typo:
s/sbuvolid/subvolid/g

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 tests/btrfs/001     |    5 +++--
 tests/btrfs/001.out |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/btrfs/001 b/tests/btrfs/001
index 9aa2431..1864e01 100755
--- a/tests/btrfs/001
+++ b/tests/btrfs/001
@@ -77,12 +77,13 @@ ls $SCRATCH_MNT/subvol
 echo "Creating file bar in subvol"
 dd if=/dev/zero of=$SCRATCH_MNT/subvol/bar bs=1M count=1 &> /dev/null
 echo "Setting subvol to the default"
-$BTRFS_UTIL_PROG subvolume set-default 0 $SCRATCH_MNT/subvol | _filter_scratch
+subid=`$BTRFS_UTIL_PROG subvolume list $SCRATCH_MNT | grep subvol | awk '{print $2}'`
+$BTRFS_UTIL_PROG subvolume set-default $subid $SCRATCH_MNT | _filter_scratch
 _scratch_remount
 echo "List root dir which is now subvol"
 ls $SCRATCH_MNT
 _scratch_unmount
-echo "Mounting sbuvolid=0 for the root dir"
+echo "Mounting subvolid=0 for the root dir"
 _scratch_mount "-o subvolid=0"
 echo "List root dir"
 ls $SCRATCH_MNT
diff --git a/tests/btrfs/001.out b/tests/btrfs/001.out
index c782bde..7810c27 100644
--- a/tests/btrfs/001.out
+++ b/tests/btrfs/001.out
@@ -22,7 +22,7 @@ Creating file bar in subvol
 Setting subvol to the default
 List root dir which is now subvol
 bar
-Mounting sbuvolid=0 for the root dir
+Mounting subvolid=0 for the root dir
 List root dir
 snap
 subvol
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-23 14:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-23  8:47 [PATCH] xfstest/btrfs/001: fix the misuse of subvolume set-default Liu Bo
2013-09-23 13:17 ` Josef Bacik
2013-09-23 14:37   ` Liu Bo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).