Skip to content

btrfs: add sysfs interface for qgroup

Qu Wenruo linux-btrfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 13 repliesIn review
  2. v11 patch 11 repliesSuperseded

Changes in v2 from the cover letter

- Add a new patch to change the return value type of btrfs_qgroup_level()

- Fix the wrong btrfs_sysfs_add_one_qgroup() call timming That function needs to allocate memory, thus can't be called in add_qgroup_rb() where some call sites are holding a spin lock. Delay btrfs_sysfs_add_one_qgroup() after add_qgroup_rb() until the spin lock is released.

- Skip qgroup sysfs interface for qgroup selftest
This makes no sense for selftest to initialize the sysfs interface and since we don't initialize fs_devices->kobj either, it's not possible to utilize the sysfs interface in selftest.

- Use proper helpers for qgroup BTRFS_ATTRs

- Use more human-readable names in qgroup sysfs entries

- Remove the unneeded completion for qgroup

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: use __u16 for the return value of btrfs_qgroup_level()fs/btrfs/qgroup.c include/uapi/linux/btrfs_tree.h+3 -30 replies
2/2btrfs: qgroup: add sysfs interface for debugfs/btrfs/ctree.h fs/btrfs/qgroup.c fs/btrfs/qgroup.h +2 more+204 -913 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] btrfs: add sysfs interface for qgroup

This patchset will add the following sysfs interfaces for qgroup:

/sys/fs/btrfs/<UUID>/qgroups/<qgroup_id>/reference /sys/fs/btrfs/<UUID>/qgroups/<qgroup_id>/exclusive /sys/fs/btrfs/<UUID>/qgroups/<qgroup_id>/max_reference /sys/fs/btrfs/<UUID>/qgroups/<qgroup_id>/max_exclusive /sys/fs/btrfs/<UUID>/qgroups/<qgroup_id>/limit_flags
^^^ Above are already in "btrfs qgroup show" command output ^^^

/sys/fs/btrfs/<UUID>/qgroups/<qgroup_id>/rsv_data /sys/fs/btrfs/<UUID>/qgroups/<qgroup_id>/rsv_meta_pertrans /sys/fs/btrfs/<UUID>/qgroups/<qgroup_id>/rsv_meta_prealloc

These interfaces are mostly for debug purpose, to give us a clear view of which part is leaking.

Changelog:
v2:
- Add a new patch to change the return value type of btrfs_qgroup_level()

- Fix the wrong btrfs_sysfs_add_one_qgroup() call timming That function needs to allocate memory, thus can't be called in add_qgroup_rb() where some call sites are holding a spin lock. Delay btrfs_sysfs_add_one_qgroup() after add_qgroup_rb() until the spin lock is released.

- Skip qgroup sysfs interface for qgroup selftest
This makes no sense for selftest to initialize the sysfs interface and since we don't initialize fs_devices->kobj either, it's not possible to utilize the sysfs interface in selftest.

- Use proper helpers for qgroup BTRFS_ATTRs

- Use more human-readable names in qgroup sysfs entries

- Remove the unneeded completion for qgroup

Qu Wenruo (2):
btrfs: use __u16 for the return value of btrfs_qgroup_level()
btrfs: qgroup: add sysfs interface for debug

 fs/btrfs/ctree.h                |   1 +
 fs/btrfs/qgroup.c               |  46 +++++++---
 fs/btrfs/qgroup.h               |  11 +++
 fs/btrfs/sysfs.c                | 151 ++++++++++++++++++++++++++++++++
 fs/btrfs/sysfs.h                |   6 ++
 include/uapi/linux/btrfs_tree.h |   4 +-
 6 files changed, 207 insertions(+), 12 deletions(-)
Signature · 1 line
2.27.0