mbox series

[0/3] btrfs-progs: subvolume-list: add qgroup sizes output

Message ID cover.1701160698.git.wqu@suse.com (mailing list archive)
Headers show
Series btrfs-progs: subvolume-list: add qgroup sizes output | expand

Message

Qu Wenruo Nov. 28, 2023, 8:44 a.m. UTC
ZFS' management tool is way better received than btrfs-progs, one of the
user-friendly point is the default `zpool list`, which includes the size
of each subvolume.

I'm not sure how ZFS handles it, but for btrfs we need qgroups (or the
faster but slightly less accurate squota) to get the accurate numbers.

But considering a lot of distro is enabling qgroup by default for
exactly the same reason, and during the years qgroup itself is also
under a lot of optimization, I believe adding sizes output for `btrfs
subvolume list` is an overall benefit for end uesrs.

This patch would do exactly so, the output example is:

 # ./btrfs subv list -t /mnt/btrfs/
 ID	gen	top level	rfer	excl	path
 --	---	---------	----	----	----
 256	11	5		1064960	1064960	subvol1
 257	11	5		4210688	4210688	subvol2

The extra columns are added depending on if qgroup is enabled, and we
allow users to force such output, but if qgroup is not enabled and we're
forced to output such sizes, a warning would be outputted and fill all
the sizes value as 0.

Thanks William Brown for the UI suggestion.

Although there are still some pitfalls, mentioned in the last patch.

Qu Wenruo (3):
  btrfs-progs: separate root attributes into a dedicated structure from
    root_info
  btrfs-progs: use root_attr structure to pass various attributes
  btrfs-progs: subvolume-list: output qgroup sizes for subvolumes

 Documentation/btrfs-subvolume.rst |  12 +-
 cmds/subvolume-list.c             | 572 ++++++++++++++++++------------
 2 files changed, 349 insertions(+), 235 deletions(-)

--
2.42.1

Comments

David Sterba Dec. 6, 2023, 9:30 p.m. UTC | #1
On Tue, Nov 28, 2023 at 07:14:50PM +1030, Qu Wenruo wrote:
> ZFS' management tool is way better received than btrfs-progs, one of the
> user-friendly point is the default `zpool list`, which includes the size
> of each subvolume.

The output of 'subvol list' needs a rework, it's from the early times.
Unfortunatelly lots of tools depend on the output format so it's not
easy to change it.

There's a WIP https://github.com/kdave/btrfs-progs/issues/515 with
outlined problems and proposed solutions.

To work around the compatibility problem and to bring a nice UI I've
proposed to create a completely new command and shamelessly copying what
https://github.com/speed47/btrfs-list does. Instead of adding new
features to current 'list' incrementally.

Adding the qgroups column is probably ok, I'll take another look.
Qu Wenruo March 21, 2024, 3:21 a.m. UTC | #2
A gentle ping?

Any feedback on the new columns?

Thanks,
Qu

在 2023/11/28 19:14, Qu Wenruo 写道:
> ZFS' management tool is way better received than btrfs-progs, one of the
> user-friendly point is the default `zpool list`, which includes the size
> of each subvolume.
> 
> I'm not sure how ZFS handles it, but for btrfs we need qgroups (or the
> faster but slightly less accurate squota) to get the accurate numbers.
> 
> But considering a lot of distro is enabling qgroup by default for
> exactly the same reason, and during the years qgroup itself is also
> under a lot of optimization, I believe adding sizes output for `btrfs
> subvolume list` is an overall benefit for end uesrs.
> 
> This patch would do exactly so, the output example is:
> 
>   # ./btrfs subv list -t /mnt/btrfs/
>   ID	gen	top level	rfer	excl	path
>   --	---	---------	----	----	----
>   256	11	5		1064960	1064960	subvol1
>   257	11	5		4210688	4210688	subvol2
> 
> The extra columns are added depending on if qgroup is enabled, and we
> allow users to force such output, but if qgroup is not enabled and we're
> forced to output such sizes, a warning would be outputted and fill all
> the sizes value as 0.
> 
> Thanks William Brown for the UI suggestion.
> 
> Although there are still some pitfalls, mentioned in the last patch.
> 
> Qu Wenruo (3):
>    btrfs-progs: separate root attributes into a dedicated structure from
>      root_info
>    btrfs-progs: use root_attr structure to pass various attributes
>    btrfs-progs: subvolume-list: output qgroup sizes for subvolumes
> 
>   Documentation/btrfs-subvolume.rst |  12 +-
>   cmds/subvolume-list.c             | 572 ++++++++++++++++++------------
>   2 files changed, 349 insertions(+), 235 deletions(-)
> 
> --
> 2.42.1
> 
>
David Sterba March 25, 2024, 10:44 p.m. UTC | #3
On Thu, Mar 21, 2024 at 01:51:16PM +1030, Qu Wenruo wrote:
> A gentle ping?
> 
> Any feedback on the new columns?

I sent my comment and reading it again I don't have anything to add, so
it would be better to continue there

https://lore.kernel.org/linux-btrfs/20231206213019.GT2751@twin.jikos.cz/