Thread (11 messages) 11 messages, 6 authors, 2012-07-31
STALE5097d

[PATCH] Btrfs-progs: Enabled setting root subvolume with subvolid=0

From: Alexander Karbstein <hidden>
Date: 2012-07-31 00:54:45
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 btrfs_cmds.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/btrfs_cmds.c b/btrfs_cmds.c
index f2b6355..699d9b0 100644
--- a/btrfs_cmds.c
+++ b/btrfs_cmds.c
@@ -964,6 +964,11 @@ int do_set_default_subvol(int nargs, 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help