The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Daeho Jeong <daeho43@gmail.com>
To: linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com
Cc: Daeho Jeong <daehojeong@google.com>
Subject: [PATCH] f2fs: subtract current_reserved_blocks from total
Date: Tue,  4 Mar 2025 11:20:41 -0800	[thread overview]
Message-ID: <20250304192041.4048741-1-daeho43@gmail.com> (raw)

From: Daeho Jeong <daehojeong@google.com>

current_reserved_blocks is not allowed to utilize. For some zoned
storage devices, vendors will provide extra space which was used for
device level GC than specs and we will use this space for filesystem
level GC. This extra space should not be shown to users, otherwise,
users will see not standardized size number like 530GB, not 512GB.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
 fs/f2fs/super.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 19b67828ae32..c346dcc2518a 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1833,10 +1833,9 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
 	buf->f_type = F2FS_SUPER_MAGIC;
 	buf->f_bsize = sbi->blocksize;
 
-	buf->f_blocks = total_count - start_count;
-
 	spin_lock(&sbi->stat_lock);
 
+	buf->f_blocks = total_count - start_count - sbi->current_reserved_blocks;
 	user_block_count = sbi->user_block_count;
 	total_valid_node_count = valid_node_count(sbi);
 	avail_node_count = sbi->total_node_count - F2FS_RESERVED_NODE_NUM;
-- 
2.48.1.711.g2feabab25a-goog


             reply	other threads:[~2025-03-04 19:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 19:20 Daeho Jeong [this message]
2025-03-05  9:10 ` [f2fs-dev] [PATCH] f2fs: subtract current_reserved_blocks from total Chao Yu
2025-03-05 14:35   ` Jaegeuk Kim
2025-03-05 16:03     ` Daeho Jeong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250304192041.4048741-1-daeho43@gmail.com \
    --to=daeho43@gmail.com \
    --cc=daehojeong@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox