f2fs: subtract current_reserved_blocks from total
PATCH 1/1 f2fs: subtract current_reserved_blocks from total
From: Daeho Jeong <[email protected]>
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.
--- fs/f2fs/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/f2fs/super.c +1 -2
@@ -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 ;
Signature · 1 line
2.48.1.711.g2feabab25a-goog
Chao Yu
maintainerQuoted 7 lines · Daeho Jeong
From: Daeho Jeong <[email protected]>
current_reserved_blocksis 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.
Hi Daeho,
However, if there are other users e.g. oem or vendor want to use reserved_blocks and current_reserved_blocks sysfs interface to reserve space, then, total size will be less than 512GB?
What do you think of adding a new variable to indicate reserved space for zoned storage case only?
Thanks,
Quoted 22 lines
Signed-off-by Daeho Jeong <[email protected]>--- fs/f2fs/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)fs/f2fs/super.c +1
-2@@ -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 ;
Jaegeuk Kim
maintainerQuoted 9 lines · Chao Yu
Quoted 7 lines · Daeho Jeong
From: Daeho Jeong <[email protected]>
current_reserved_blocksis 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.
Quoted 8 lines
Hi Daeho,
However, if there are other users e.g. oem or vendor want to use
reserved_blocksandcurrent_reserved_blockssysfs interface to reserve space, then, total size will be less than 512GB?What do you think of adding a new variable to indicate reserved space for zoned storage case only?
Or, adding a sysfs entry like "carve_out" to determine this?
Quoted 26 lines
Thanks,
Quoted 22 lines
Signed-off-by Daeho Jeong <[email protected]>--- fs/f2fs/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)fs/f2fs/super.c +1
-2@@ -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 ;
Quoted 13 lines · Jaegeuk Kim
Quoted 11 lines · Chao Yu
Quoted 7 lines · Daeho Jeong
From: Daeho Jeong <[email protected]>
current_reserved_blocksis 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.Hi Daeho,
Quoted 8 lines
Quoted 6 lines
However, if there are other users e.g. oem or vendor want to use
reserved_blocksandcurrent_reserved_blockssysfs interface to reserve space, then, total size will be less than 512GB?What do you think of adding a new variable to indicate reserved space for zoned storage case only?
Or, adding a sysfs entry like "
carve_out" to determine this?
Good points. Thanks, guys.
Quoted 27 lines
Quoted 27 lines
Thanks,
Quoted 22 lines
Signed-off-by Daeho Jeong <[email protected]>--- fs/f2fs/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)fs/f2fs/super.c +1
-2@@ -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 ;