Goffredo Baroncelli
2013-Nov-09 18:10 UTC
btrfs subvolume list: what is the meaning of "top level"
Hi all,
in "btrfs subvolume list" I supposed that "top level" is the
subvolume
"father" tree id. But the example below shows that I am wrong.
ghigo@venice:/tmp$ uname -a
Linux venice 3.11.7 #142 SMP Wed Nov 6 19:25:46 CET 2013 x86_64 GNU/Linux
ghigo@venice:/tmp$ sudo mkfs.btrfs /dev/loop0
WARNING! - Btrfs v0.20-rc1 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using
SMALL VOLUME: forcing mixed metadata/data groups
Created a data/metadata chunk of size 8388608
fs created label (null) on /dev/loop0
nodesize 4096 leafsize 4096 sectorsize 4096 size 1001.00MB
Btrfs v0.20-rc1
ghigo@venice:/tmp$ sudo mount /dev/loop0 t/
ghigo@venice:/tmp$ sudo mkdir t/dir
ghigo@venice:/tmp$ sudo btrfs sub create t/sub1
Create subvolume ''t/sub1''
ghigo@venice:/tmp$ sudo btrfs sub create t/dir/sub2
Create subvolume ''t/dir/sub2''
ghigo@venice:/tmp$ sudo btrfs sub create t/dir/sub3
Create subvolume ''t/dir/sub3''
ghigo@venice:/tmp$ sudo btrfs sub create t/dir/sub3/sub4
Create subvolume ''t/dir/sub3/sub4''
ghigo@venice:/tmp$ sudo btrfs sub create t/sub5
Create subvolume ''t/sub5''
ghigo@venice:/tmp$ sudo btrfs sub create t/sub5/sub6
Create subvolume ''t/sub5/sub6''
ghigo@venice:/tmp$ sudo btrfs sub list t/ | nl
1 ID 256 gen 5 top level 5 path sub1
2 ID 257 gen 6 top level 5 path dir/sub2
3 ID 258 gen 8 top level 5 path dir/sub3
4 ID 259 gen 8 top level 5 path dir/sub3/sub4
5 ID 260 gen 10 top level 5 path sub5
6 ID 261 gen 10 top level 5 path sub5/sub6
I expected that in the line 4, the top level should be 258; the same for
the line 6: top level should be 260. So my question is: what is the
meaning of the "top level" value ?
Thanks.
BR
G.Baroncelli
--
gpg @keyserver.linux.it: Goffredo Baroncelli (kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5
--
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
Chris Murphy
2013-Nov-09 20:18 UTC
Re: btrfs subvolume list: what is the meaning of "top level"
On Nov 9, 2013, at 11:10 AM, Goffredo Baroncelli <kreijack@inwind.it> wrote:> > 1 ID 256 gen 5 top level 5 path sub1 > 2 ID 257 gen 6 top level 5 path dir/sub2 > 3 ID 258 gen 8 top level 5 path dir/sub3 > 4 ID 259 gen 8 top level 5 path dir/sub3/sub4 > 5 ID 260 gen 10 top level 5 path sub5 > 6 ID 261 gen 10 top level 5 path sub5/sub6> > > I expected that in the line 4, the top level should be 258; the same for > the line 6: top level should be 260. So my question is: what is the > meaning of the "top level" value ?If you mount -o subvol=sub5 and then create a new subvolume, and then do a listing, you''ll see something like what you describe. It would look something like: 6 ID 262 gen 4 top level 260 path sub6 The "top level" is in a sense a prefix. So top level 5 means there is no prefix, the path listed is the full path. Whereas if the top level is e.g. 260, the implied prefix is sub5/. If you were to mount subvolid=259 and create a subvolume in at the root of the mountpoint, then do a subvolume listing, it would be listed with top level 259 and a path of merely "newname" rather than dir/sub3/sub4/newname. So just consider the top level a prefix for the listed path, and if the top level is 5, there is no prefix for path, the path is the full path. Chris Murphy-- 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
Goffredo Baroncelli
2013-Nov-10 07:38 UTC
Re: btrfs subvolume list: what is the meaning of "top level"
On 2013-11-09 21:18, Chris Murphy wrote:> > On Nov 9, 2013, at 11:10 AM, Goffredo Baroncelli <kreijack@inwind.it> > wrote: >> >> 1 ID 256 gen 5 top level 5 path sub1 2 ID 257 gen 6 top level 5 >> path dir/sub2 3 ID 258 gen 8 top level 5 path dir/sub3 4 ID 259 gen >> 8 top level 5 path dir/sub3/sub4 5 ID 260 gen 10 top level 5 path >> sub5 6 ID 261 gen 10 top level 5 path sub5/sub6 > >> >> >> I expected that in the line 4, the top level should be 258; the >> same for the line 6: top level should be 260. So my question is: >> what is the meaning of the "top level" value ? > > If you mount -o subvol=sub5 and then create a new subvolume, and then > do a listing, you''ll see something like what you describe. It would > look something like: > > 6 ID 262 gen 4 top level 260 path sub6 > > The "top level" is in a sense a prefix. So top level 5 means there is > no prefix, the path listed is the full path. Whereas if the top level > is e.g. 260, the implied prefix is sub5/.Chris, many thanks, not it is clear.> > If you were to mount subvolid=259 and create a subvolume in at the > root of the mountpoint, then do a subvolume listing, it would be > listed with top level 259 and a path of merely "newname" rather than > dir/sub3/sub4/newname. > > So just consider the top level a prefix for the listed path, and if > the top level is 5, there is no prefix for path, the path is the full > path. > > > Chris Murphy-- 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 >-- gpg @keyserver.linux.it: Goffredo Baroncelli (kreijackATinwind.it> Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5 -- 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
Goffredo Baroncelli
2013-Nov-10 07:55 UTC
Re: btrfs subvolume list: what is the meaning of "top level"
On 2013-11-10 08:38, Goffredo Baroncelli wrote:> On 2013-11-09 21:18, Chris Murphy wrote: >>[..]> Chris, many thanks, not it is clear.s/not/now/ Sorry :-) GB -- gpg @keyserver.linux.it: Goffredo Baroncelli (kreijackATinwind.it> Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5 -- 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