On Tue, Jun 30, 2020 at 10:07:35AM +0200, David Sterba wrote: > We need to at lest have a solid idea how to extend it, not neccessarily > to implement it right now. Adding the group membership to qgroup > directories under the qgroup directory as symlinks between the kobjects > sounds ok-ish to me but it's a new idea and I need to think about it. So my current winner idea for the hierarchy representation is to keep all child qgroups as symlinks in the parent group. This does not require extra kojbect to keep, and the path in sysfs would reflect the hierarchy, like: /sys/fs/btrfs/UUID/qgroups/4_1/3_1/2_1/1234_0 This tracks only the parent -> child pointers, so to see all parent qgroups one has to build the reverse graph or simply search which 1st level directories contain the group as child. Implementation is one more sysfs_create_link, the leaf qgroups representing subvolumes will contain only the files with stats. One potential drawback is the maximum size of path that will not allow to show deep qgroup hierarchies, but still about 200-400 in case of average qgroup id 20 or 10 respectively.
