Btrfs: make subvol=0 mount the original default root
diff mbox

Message ID 20091214191838.GC2165@localhost.localdomain
State Accepted
Headers show

Commit Message

Josef Bacik Dec. 14, 2009, 7:18 p.m. UTC
None

Patch
diff mbox

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index bcbdc1b..ccc0380 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -305,9 +305,15 @@  static int btrfs_parse_early_options(const char *options, fmode_t flags,
 		switch (token) {
 		case Opt_subvol:
 			intarg = 0;
-			match_int(&args[0], &intarg);
-			if (intarg)
-				*subvol_objectid = intarg;
+			error = match_int(&args[0], &intarg);
+			if (!error) {
+				/* we want the original fs_tree */
+				if (!intarg)
+					*subvol_objectid =
+						BTRFS_FS_TREE_OBJECTID;
+				else
+					*subvol_objectid = intarg;
+			}
 			break;
 		case Opt_device:
 			error = btrfs_scan_one_device(match_strdup(&args[0]),