From: Alexander Karbstein <alexander.karbstein@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Alexander Karbstein <alexander.karbstein@gmail.com>
Subject: [PATCH V2] Btrfs-progs: Enabled setting root subvolume with subvolid=0
Date: Tue, 31 Jul 2012 19:11:21 +0200 [thread overview]
Message-ID: <1343754681-4454-2-git-send-email-alexander.karbstein@gmail.com> (raw)
In-Reply-To: <50173463.5060405@cn.fujitsu.com>
The command btrfs subvolume set-default 0 /path/to/fs changed the
default subvolume to whatever subvolume was currently mounted on
/path/to/fs. This patch changes this behaviour to set the default
subvolume to BTRFS_FS_TREE_OBJECTID in case the user asks for
subvolid=0
Signed-off-by: Alexander Karbstein <alexander.karbstein@gmail.com>
---
cmds-subvolume.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 3508ce6..8f8c918 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -25,6 +25,7 @@
#include <limits.h>
#include "kerncompat.h"
+#include "ctree.h"
#include "ioctl.h"
#include "commands.h"
@@ -464,6 +465,9 @@ static int cmd_subvol_set_default(int argc, char **argv)
fprintf(stderr, "ERROR: invalid tree id (%s)\n",subvolid);
return 30;
}
+ /* Using the original root fs tree */
+ if (objectid == 0ULL)
+ objectid = BTRFS_FS_TREE_OBJECTID;
ret = ioctl(fd, BTRFS_IOC_DEFAULT_SUBVOL, &objectid);
e = errno;
close(fd);
--
1.7.2.5
prev parent reply other threads:[~2012-07-31 17:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-30 7:56 subvolumes: default and IDs Florian Lindner
2012-07-30 11:29 ` Calvin Walton
2012-07-30 12:43 ` Swâmi Petaramesh
2012-07-30 12:18 ` Liu Bo
2012-07-31 0:28 ` Alexander Karbstein
2012-07-31 0:50 ` Alexander Karbstein
2012-07-31 0:53 ` [PATCH] Btrfs-progs: Enabled setting root subvolume with subvolid=0 Alexander Karbstein
2012-07-31 1:26 ` Liu Bo
2012-07-31 2:09 ` Alexander Karbstein
2012-07-31 17:11 ` [PATCH V2] " Alexander Karbstein
2012-07-31 17:11 ` Alexander Karbstein [this message]
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=1343754681-4454-2-git-send-email-alexander.karbstein@gmail.com \
--to=alexander.karbstein@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
/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).