diff mbox

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

Message ID 2061327.l3bBKU3J9X@localhost.localdomain (mailing list archive)
State Under Review, archived
Headers show

Commit Message

Chandan Rajendra Sept. 11, 2013, 9:04 a.m. UTC
'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).

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
---
 man/btrfs.8.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

David Sterba Sept. 12, 2013, 1:29 p.m. UTC | #1
On Wed, Sep 11, 2013 at 02:34:05PM +0530, chandan wrote:
> --- a/man/btrfs.8.in
> +++ b/man/btrfs.8.in
> @@ -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.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chandan Rajendra Sept. 13, 2013, 5:32 a.m. UTC | #2
On Thursday, September 12, 2013 03:29:52 PM David Sterba wrote:
> 
> 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/linux-btrfs@vger.kernel.org/msg17973.html
should fix the issue.

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba Sept. 13, 2013, 12:58 p.m. UTC | #3
On Fri, Sep 13, 2013 at 11:02:10AM +0530, chandan wrote:
> On Thursday, September 12, 2013 03:29:52 PM David Sterba wrote:
> > 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.

> The patch provided at
> http://www.mail-archive.com/linux-btrfs@vger.kernel.org/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/linux-btrfs@vger.kernel.org/msg17952.html

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

david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/man/btrfs.8.in b/man/btrfs.8.in
index 61ffe8d..36846b6 100644
--- a/man/btrfs.8.in
+++ b/man/btrfs.8.in
@@ -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