Skip to contentSkip to conversation

xfs_quota: display default limits for users with zero usage

PATCH In review Ravi Singh 3 participants 3 messages Apr 14

lore
Share & tools
lore

Ravi Singh

author
#0 lore raw

PATCH 1/1 xfs_quota: display default limits for users with zero usage

When the kernel returns default quota limits for IDs without a dquot on disk, xfs_quota suppresses the output because it only checks usage counters (d_bcount, d_icount, d_rtbcount). If all counters are zero the line is skipped even though non-zero limits apply.

Also check the soft/hard limit fields so that quota output is displayed whenever limits are configured, even if usage is zero.

This is the userspace companion to the kernel commit:
"xfs: return default quota limits for IDs without a dquot"

---
 quota/quota.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
quota/quota.c +6 -3
index fea55f03..08a07b20 100644
@@ -62,11 +62,14 @@ quota_mount(
 
 	if (!(flags & VERBOSE_FLAG)) {
 		count = 0;
-		if ((form & XFS_BLOCK_QUOTA) && d.d_bcount)
+		if ((form & XFS_BLOCK_QUOTA) &&
+		    (d.d_bcount || d.d_blk_softlimit || d.d_blk_hardlimit))
 			count++;
-		if ((form & XFS_INODE_QUOTA) && d.d_icount)
+		if ((form & XFS_INODE_QUOTA) &&
+		    (d.d_icount || d.d_ino_softlimit || d.d_ino_hardlimit))
 			count++;
-		if ((form & XFS_RTBLOCK_QUOTA) && d.d_rtbcount)
+		if ((form & XFS_RTBLOCK_QUOTA) &&
+		    (d.d_rtbcount || d.d_rtb_softlimit || d.d_rtb_hardlimit))
 			count++;
 		if (!count)
 			return 0;
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#2 lore raw
In reply to Ravi Singh
Quoted 5 lines · Ravi Singh

When the kernel returns default quota limits for IDs without a dquot on disk, xfs_quota suppresses the output because it only checks usage counters (d_bcount, d_icount, d_rtbcount). If all counters are zero the line is skipped even though non-zero limits apply.

Quoted 7 lines

Also check the soft/hard limit fields so that quota output is displayed whenever limits are configured, even if usage is zero.

This is the userspace companion to the kernel commit:
"xfs: return default quota limits for IDs without a dquot"

Looks good

Quoted 30 lines
---
 quota/quota.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
quota/quota.c +6 -3
index fea55f03..08a07b20 100644
@@ -62,11 +62,14 @@ quota_mount(
 
 	if (!(flags & VERBOSE_FLAG)) {
 		count = 0;
-		if ((form & XFS_BLOCK_QUOTA) && d.d_bcount)
+		if ((form & XFS_BLOCK_QUOTA) &&
+		    (d.d_bcount || d.d_blk_softlimit || d.d_blk_hardlimit))
 			count++;
-		if ((form & XFS_INODE_QUOTA) && d.d_icount)
+		if ((form & XFS_INODE_QUOTA) &&
+		    (d.d_icount || d.d_ino_softlimit || d.d_ino_hardlimit))
 			count++;
-		if ((form & XFS_RTBLOCK_QUOTA) && d.d_rtbcount)
+		if ((form & XFS_RTBLOCK_QUOTA) &&
+		    (d.d_rtbcount || d.d_rtb_softlimit || d.d_rtb_hardlimit))
 			count++;
 		if (!count)
 			return 0;
Signature · 1 line
2.49.0