Skip to contentSkip to conversation

ext4: report delalloc reserve as non-free in statfs mangled by project quota

PATCH Applied Konstantin Khlebnikov 3 participants 3 messages Feb 2, 2018 – May 21, 2018 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: report delalloc reserve as non-free in statfs mangled by project quota

This reserved space isn't committed yet but cannot be used for allocations. For userspace it has no difference from used space. XFS already does this.

Fixes 689c958cbe6b ("ext4: add project quota support")
---
 fs/ext4/super.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ext4/super.c +2 -1
index 5de959fb0244..13ce97b9e820 100644
@@ -5227,7 +5227,8 @@ static int ext4_statfs_project(struct super_block *sb,
 		 dquot->dq_dqb.dqb_bsoftlimit :
 		 dquot->dq_dqb.dqb_bhardlimit) >> sb->s_blocksize_bits;
 	if (limit && buf->f_blocks > limit) {
-		curblock = dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits;
+		curblock = (dquot->dq_dqb.dqb_curspace +
+			    dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits;
 		buf->f_blocks = limit;
 		buf->f_bfree = buf->f_bavail =
 			(buf->f_blocks > curblock) ?
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Konstantin Khlebnikov

This reserved space isn't committed yet but cannot be used for allocations. For userspace it has no difference from used space. XFS already does this.

Fixes 689c958cbe6b ("ext4: add project quota support")

The patch looks good. You can add:

Honza

Quoted 19 lines
---
 fs/ext4/super.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ext4/super.c +2 -1
index 5de959fb0244..13ce97b9e820 100644
@@ -5227,7 +5227,8 @@ static int ext4_statfs_project(struct super_block *sb,
 		 dquot->dq_dqb.dqb_bsoftlimit :
 		 dquot->dq_dqb.dqb_bhardlimit) >> sb->s_blocksize_bits;
 	if (limit && buf->f_blocks > limit) {
-		curblock = dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits;
+		curblock = (dquot->dq_dqb.dqb_curspace +
+			    dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits;
 		buf->f_blocks = limit;
 		buf->f_bfree = buf->f_bavail =
 			(buf->f_blocks > curblock) ?
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR