linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: xfs@oss.sgi.com
Subject: [PATCH] xfstest/btrfs/001: fix the misuse of subvolume set-default
Date: Mon, 23 Sep 2013 16:47:29 +0800	[thread overview]
Message-ID: <1379926049-22135-1-git-send-email-bo.li.liu@oracle.com> (raw)

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


             reply	other threads:[~2013-09-23  8:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23  8:47 Liu Bo [this message]
2013-09-23 13:17 ` [PATCH] xfstest/btrfs/001: fix the misuse of subvolume set-default Josef Bacik
2013-09-23 14:37   ` Liu Bo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379926049-22135-1-git-send-email-bo.li.liu@oracle.com \
    --to=bo.li.liu@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).