Stephane Chazelas <stephane.chazelas@gmail.com> 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 <lizf@cn.fujitsu.com> 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 <lizf@cn.fujitsu.com>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
/* 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;