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. 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 outputting 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 for further call. The last patch adds range checks for fallback case when XFS_GETNEXTQUOTA is not available. The fallback case will be also executed in case that empty range is specified (e.g. -L <too high>), but will print nothing. Changes from v1: Darrick J. Wong: - Renamed get_quota() -> get_dquot() Christoph Hellwig: - Formatting: if() with tab, operators without spaces, long lines - Replace 'fs_disk_quota_t' with 'struct fs_disk_quota' - Merge and then split patch 2 & 3, so dump_file() and report_mount() are in separate patches Changes from v2: - Get rid of oid parameter Andrey Albershteyn (5): xfs_quota: separate quota info acquisition into get_dquot() xfs_quota: separate get_dquot() and dump_file() xfs_quota: separate get_dquot() and report_mount() 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 | 343 ++++++++++++++++++++++++------------------------- 1 file changed, 168 insertions(+), 175 deletions(-) -- 2.27.0