public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_quota: display default limits for users with zero usage
@ 2026-04-14  7:19 Ravi Singh
  2026-04-14  8:02 ` Christoph Hellwig
  2026-04-14  9:40 ` Carlos Maiolino
  0 siblings, 2 replies; 3+ messages in thread
From: Ravi Singh @ 2026-04-14  7:19 UTC (permalink / raw)
  To: linux-xfs; +Cc: cem, djwong, hch, aalbersh

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"

Signed-off-by: Ravi Singh <ravising@redhat.com>
---
 quota/quota.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/quota/quota.c b/quota/quota.c
index fea55f03..08a07b20 100644
--- a/quota/quota.c
+++ b/quota/quota.c
@@ -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;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_quota: display default limits for users with zero usage
  2026-04-14  7:19 [PATCH] xfs_quota: display default limits for users with zero usage Ravi Singh
@ 2026-04-14  8:02 ` Christoph Hellwig
  2026-04-14  9:40 ` Carlos Maiolino
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-04-14  8:02 UTC (permalink / raw)
  To: Ravi Singh; +Cc: linux-xfs, cem, djwong, hch, aalbersh

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_quota: display default limits for users with zero usage
  2026-04-14  7:19 [PATCH] xfs_quota: display default limits for users with zero usage Ravi Singh
  2026-04-14  8:02 ` Christoph Hellwig
@ 2026-04-14  9:40 ` Carlos Maiolino
  1 sibling, 0 replies; 3+ messages in thread
From: Carlos Maiolino @ 2026-04-14  9:40 UTC (permalink / raw)
  To: Ravi Singh; +Cc: linux-xfs, djwong, hch, aalbersh

On Tue, Apr 14, 2026 at 03:19:21PM +0800, Ravi Singh wrote:
> 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"
> 
> Signed-off-by: Ravi Singh <ravising@redhat.com>

Looks good
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>


> ---
>  quota/quota.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/quota/quota.c b/quota/quota.c
> index fea55f03..08a07b20 100644
> --- a/quota/quota.c
> +++ b/quota/quota.c
> @@ -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;
> -- 
> 2.49.0
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-14  9:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-14  7:19 [PATCH] xfs_quota: display default limits for users with zero usage Ravi Singh
2026-04-14  8:02 ` Christoph Hellwig
2026-04-14  9:40 ` Carlos Maiolino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox