linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: use hardlimit as sub-fs size if both hard/soft limits are set
@ 2018-03-25  5:16 Chengguang Xu
  2018-03-26 19:22 ` Darrick J. Wong
  0 siblings, 1 reply; 6+ messages in thread
From: Chengguang Xu @ 2018-03-25  5:16 UTC (permalink / raw)
  To: linux-xfs; +Cc: darrick.wong, bfoster, sandeen, Chengguang Xu

In current implementation, we size the fs(sub-fs via project quota) at
the soft limit and simply call it 100% used if the limit is exceeded.
It is reasonable when only a soft limit is set, but we should use the
hard limit if both hard/soft limits are set, so that quota-df reflects
the usage information more accurately.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 fs/xfs/xfs_qm_bhv.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/xfs/xfs_qm_bhv.c b/fs/xfs/xfs_qm_bhv.c
index 2be6d27..43b0fe8 100644
--- a/fs/xfs/xfs_qm_bhv.c
+++ b/fs/xfs/xfs_qm_bhv.c
@@ -35,9 +35,9 @@
 {
 	uint64_t		limit;
 
-	limit = dqp->q_core.d_blk_softlimit ?
-		be64_to_cpu(dqp->q_core.d_blk_softlimit) :
-		be64_to_cpu(dqp->q_core.d_blk_hardlimit);
+	limit = dqp->q_core.d_blk_hardlimit ?
+		be64_to_cpu(dqp->q_core.d_blk_hardlimit) :
+		be64_to_cpu(dqp->q_core.d_blk_softlimit);
 	if (limit && statp->f_blocks > limit) {
 		statp->f_blocks = limit;
 		statp->f_bfree = statp->f_bavail =
@@ -45,9 +45,9 @@
 			 (statp->f_blocks - dqp->q_res_bcount) : 0;
 	}
 
-	limit = dqp->q_core.d_ino_softlimit ?
-		be64_to_cpu(dqp->q_core.d_ino_softlimit) :
-		be64_to_cpu(dqp->q_core.d_ino_hardlimit);
+	limit = dqp->q_core.d_ino_hardlimit ?
+		be64_to_cpu(dqp->q_core.d_ino_hardlimit) :
+		be64_to_cpu(dqp->q_core.d_ino_softlimit);
 	if (limit && statp->f_files > limit) {
 		statp->f_files = limit;
 		statp->f_ffree =
-- 
1.8.3.1


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

end of thread, other threads:[~2018-04-05 21:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-25  5:16 [PATCH] xfs: use hardlimit as sub-fs size if both hard/soft limits are set Chengguang Xu
2018-03-26 19:22 ` Darrick J. Wong
2018-03-26 19:43   ` Darrick J. Wong
2018-03-27  0:14   ` cgxu519
2018-04-05  1:40   ` cgxu519
2018-04-05 21:44     ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).