03.08.2019 9:17, Qu Wenruo пишет: > > > On 2019/8/3 下午1:31, Andrei Borzenkov wrote: >> 03.08.2019 2:09, Qu Wenruo пишет: >>> >>> >>> On 2019/8/3 上午2:08, Andrei Borzenkov wrote: >>>> bor@tw:~> sudo btrfs qgroup show . >>>> ERROR: cannot find the qgroup 0/789 >>>> bor@tw:~> >>>> >>>> Fine. This openSUSE with snapper which creates and automatically >>>> destroys snapshots and apparently either kernel or snapper now also >>>> remove corresponding qgroup. I played with snapshots and created several >>>> top level qgroups that included snapshot qgroups existing at this time. >>>> Now these snapshots are gone, their qgroups are gone ... >>> >>> Kernel version please. >>> >>> IIRC latest upstream kernel doesn't remove the level 0 qgroup. >> >> Yes? >> >>> It may be the userspace doing it improperly. >>> >> >> Not sure what "improperly" means here. snapper removes qgroup after >> deleting snapshot. What is "improper" here? > > Doing without using the qgroup ioctl, but some extra flag in snapshot > creation/deletion, which can also add relation at subv/snapshot creation > time. > As far as I can tell, this is exactly what snapper does: if (qgroup != no_qgroup) { size_t size = sizeof(btrfs_qgroup_inherit) + sizeof(((btrfs_qgroup_inherit*) 0)->qgroups[0]); vector buffer(size, 0); struct btrfs_qgroup_inherit* inherit = (btrfs_qgroup_inherit*) &buffer[0]; inherit->num_qgroups = 1; inherit->num_ref_copies = 0; inherit->num_excl_copies = 0; inherit->qgroups[0] = qgroup; args_v2.flags |= BTRFS_SUBVOL_QGROUP_INHERIT; args_v2.size = size; args_v2.qgroup_inherit = inherit; } Do you say it should not be doing it?