Skip to contentSkip to conversation

btrfs-progs: btrfs.8.in: Add info about reverting back to root subvolume.

PATCH In review chandan 2 participants 4 messages Sep 11, 2013 – Sep 13, 2013 Btrfs file system

lore
Share & tools
lore

chandan

author
#0 lore raw

PATCH 1/1 btrfs-progs: btrfs.8.in: Add info about reverting back to root subvolume.

'btrfs subvolume list <path>' does not list the root subvolume's ID. Hence there is no way for the user to set the root subvolume as the default subvolume unless he knows about the magic number 5 (i.e. BTRFS_FS_TREE_OBJECTID).

---
 man/btrfs.8.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
man/btrfs.8.in +2 -1
index 61ffe8d..36846b6 100644
@@ -244,7 +244,8 @@ is similar to \fBsubvolume list\fR command.
 \fBsubvolume set-default\fR\fI <id> <path>\fR
 Set the subvolume of the filesystem \fI<path>\fR which is mounted as
 \fIdefault\fR. The subvolume is identified by \fI<id>\fR, which
-is returned by the \fBsubvolume list\fR command.
+is returned by the \fBsubvolume list\fR command. The default subvolume
+can be set to the root subvolume by passing an \fI<id>\fR value of 5.
 .TP
 
 \fBsubvolume find-new\fR\fI <subvolume> <last_gen>\fR
Signature · 1 line
1.8.3.1
#1 lore raw

man/btrfs.8.in is similar to \fBsubvolume list\fR command. · line 248

Quoted 9 lines · chandan
man/btrfs.8.in +2 -1
@@ -244,7 +244,8 @@ is similar to \fBsubvolume list\fR command.
 \fBsubvolume set-default\fR\fI <id> <path>\fR
 Set the subvolume of the filesystem \fI<path>\fR which is mounted as
 \fIdefault\fR. The subvolume is identified by \fI<id>\fR, which
-is returned by the \fBsubvolume list\fR command.
+is returned by the \fBsubvolume list\fR command. The default subvolume
+can be set to the root subvolume by passing an \fI<id>\fR value of 5.

The number 5 is an implementation detail, we should recommend to use 0.

author
#2 lore raw
Quoted 3 lines · David Sterba

The number 5 is an implementation detail, we should recommend to use 0.

In the current btrfs kernel code if 0 is passed as the subvolume id, the btrfs_ioctl_default_subvol() function sets the subvolume id to the objectid of the current subvolume. The patch provided at
http://www.mail-archive.com/[email protected]/msg17973.html
should fix the issue.

#3 lore raw
Quoted 6 lines · chandan
Quoted 2 lines · David Sterba

The number 5 is an implementation detail, we should recommend to use 0.

In the current btrfs kernel code if 0 is passed as the subvolume id, the btrfs_ioctl_default_subvol() function sets the subvolume id to the objectid of the current subvolume.

Uh, that's right.

Quoted 3 lines

The patch provided at
http://www.mail-archive.com/[email protected]/msg17973.html
should fix the issue.

I think this is the intended behaviour, 'set-default 0' should set the toplevel subvolume (ie id 5), the same way as the mount option 'subvolid'. I see that Alex came to the same conclusion in
http://www.mail-archive.com/[email protected]/msg17952.html

But, this should be fixed in kernel, so any tool that uses the ioctl directly gets the same result.

david