All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: report sub-block project quotas in statfs
@ 2026-11-01 23:05 Hungyu Lin
  2026-11-02  2:23 ` Chao Yu via Linux-f2fs-devel
  0 siblings, 1 reply; 2+ messages in thread
From: Hungyu Lin @ 2026-11-01 23:05 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: Hungyu Lin, linux-kernel, linux-f2fs-devel

f2fs_statfs_project() converts the selected block quota from bytes to
filesystem blocks before checking whether a limit is set. A nonzero
limit smaller than one filesystem block therefore becomes zero and
skips the project block statistics.

For example, on a filesystem with 4 KiB blocks, setquota accepts a
1 KiB project hard limit, but df on the project-inherit directory
reports the filesystem-wide capacity and free space instead of zero
whole blocks. Quota enforcement still rejects a write that requires
another data block.

Check the byte limit before converting it to blocks. This distinguishes
a sub-block limit from an unlimited quota while retaining the existing
rounding and free-space calculations.

Fixes: ddc34e328d06 ("f2fs: introduce f2fs_statfs_project")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 1071059f2cc2..f1e98f5fa350 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -2228,11 +2228,11 @@ static int f2fs_statfs_project(struct super_block *sb,
 
 	limit = min_not_zero(dquot->dq_dqb.dqb_bsoftlimit,
 					dquot->dq_dqb.dqb_bhardlimit);
-	limit >>= sb->s_blocksize_bits;
 
 	if (limit) {
 		uint64_t remaining = 0;
 
+		limit >>= sb->s_blocksize_bits;
 		curblock = (dquot->dq_dqb.dqb_curspace +
 			    dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits;
 		if (limit > curblock)
-- 
2.43.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2026-11-02  2:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-01 23:05 [f2fs-dev] [PATCH] f2fs: report sub-block project quotas in statfs Hungyu Lin
2026-11-02  2:23 ` Chao Yu via Linux-f2fs-devel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.