f2fs: report sub-block project quotas in statfs
PATCH 1/1 f2fs: report sub-block project quotas in statfs
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.
--- fs/f2fs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/super.c +1 -1
@@ -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)
Signature · 1 line
2.43.0
Quoted 11 lines · Hungyu Lin
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.
Quoted 4 lines
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.
Quoted 2 lines
Fixes ddc34e328d06 ("f2fs: introduce f2fs_statfs_project")Signed-off-by Hungyu Lin <[email protected]>
Thanks,
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:
Quoted 5 lines · On Sun, 1 Nov 2026 23:05:52 +0000 you wrote:
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.
Quoted 7 lines
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.
[...]
Here is the summary with links:
- [f2fs-dev] f2fs: report sub-block project quotas in statfs
https://git.kernel.org/jaegeuk/f2fs/c/9b12299b437e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html