mbox series

[0/5] xfsprogs: optimize -L/-U range calls for xfs_quota's dump/report

Message ID 20220328222503.146496-1-aalbersh@redhat.com (mailing list archive)
Headers show
Series xfsprogs: optimize -L/-U range calls for xfs_quota's dump/report | expand

Message

Andrey Albershteyn March 28, 2022, 10:24 p.m. UTC
The xfs_quota's 'report' and 'dump' commands have -L and -U
arguments for restricting quota querying to the range of
UIDs/GIDs/PIDs. The current implementation is using XFS_GETQUOTA to
get every ID in specified range. It doesn't perform well on wider
ranges. The XFS_GETNEXTQUOTA is used only when upper limit is not
specified.  Also, the fallback case (UIDs from /etc/passwd) doesn't
take into account range
restriction and outputs all users with quota.

First 3 patches do minor refactoring to split acquisition and
printing of the quota information. This is not that necessary, but
makes it easier to manipulate with acquired data.

The 4th one replaces XFS_GETQUOTA based loop with XFS_GETNEXTQUOTA
one. The latter returns ID of the next user/group/project with
non-empty quota. The ID is then used in further call.

The last patch adds range checks for fallback case when
XFS_GETNEXTQUOTA is not avaliable.

The fallback case will be also executed in case that empty range is
specified (e.g. -L <too high>), but will print nothing.

Andrey Albershteyn (5):
  xfs_quota: separate quota info acquisition into get_quota()
  xfs_quota: create fs_disk_quota_t on upper level
  xfs_quota: split get_quota() and report_mount()/dump_file()
  xfs_quota: utilize XFS_GETNEXTQUOTA for ranged calls in report/dump
  xfs_quota: apply -L/-U range limits in uid/gid/pid loops

 quota/report.c | 319 ++++++++++++++++++++++++-------------------------
 1 file changed, 156 insertions(+), 163 deletions(-)