From d2600786960bcfcecf9bbfd5bd055cf27212c524 Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Wed, 15 Dec 2010 03:33:33 +0000 Subject: [PATCH] Fix missing entries in listing of subvolumes Stephane Chazelas writes: > I've got a btrfs FS with 84 subvolumes in it (some created with > "btrfs sub create", some with "btrfs sub snap" of the other > ones). There's no nesting of subvolumes at all (all direct children > of the root subvolume). > > The "btrfs subvolume list" is only showing 80 subvolumes. The 4 > missing ones (1 original volume, 3 snapshots) do exist on disk and > files in there have different st_devs from any other subvolume. > > I found > http://thread.gmane.org/gmane.comp.file-systems.btrfs/8123/focus=8208 > > which looks like the same issue, with Li Zefan saying he had a > fix, but I couldn't find any mention that it was actually fixed. Li Zefan replied: > After that, I posted a patch to fix btrfs-progs, which Chris aggreed > on: > > http://marc.info/?l=linux-btrfs&m=129238454714319&w=2 So this btrfs-progs patch should fix missing subvolumes in the output of "subvolume list": Signed-off-by: Li Zefan Signed-off-by: Hugo Mills --- btrfs-list.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/btrfs-list.c b/btrfs-list.c index bd0df9e5..5751f1dd 100644 --- a/btrfs-list.c +++ b/btrfs-list.c @@ -636,7 +636,10 @@ static int __list_subvol_search(int fd, struct root_lookup *root_lookup) /* this iteration is done, step forward one root for the next * ioctl */ - if (sk->min_objectid < (u64)-1) { + if (sk->min_type < BTRFS_ROOT_BACKREF_KEY) { + sk->min_type = BTRFS_ROOT_BACKREF_KEY; + sk->min_offset = 0; + } else if (sk->min_objectid < (u64)-1) { sk->min_objectid++; sk->min_type = BTRFS_ROOT_BACKREF_KEY; sk->min_offset = 0; -- 2.34.1