Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b558f0cc authored by Jaegeuk Kim's avatar Jaegeuk Kim Committed by Daniel Rosenberg
Browse files

BACKPORT: f2fs: expose # of overprivision segments



This is useful when checking conditions during checkpoint=disable in Android.

Bug: 330501081
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit ed5309ad137e1f467ca1e1b61be3dc39d144316c)
[hakan: Resolved minor conflict in Documentation/ABI/testing/sysfs-fs-f2fs]
Signed-off-by: default avatarHåkan Kvist <hakan.kvist@sony.com>
Change-Id: I0bd59501836fbe8fe361da2872ae660f3ac1f541
parent ffb0cc52
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -347,3 +347,8 @@ Date: April 2020
Contact:	"Daeho Jeong" <daehojeong@google.com>
Description:	Give a way to change iostat_period time. 3secs by default.
		The new iostat trace gives stats gap given the period.

What:		/sys/fs/f2fs/<disk>/ovp_segments
Date:		March 2021
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:	Shows the number of overprovision segments.
+9 −0
Original line number Diff line number Diff line
@@ -87,6 +87,13 @@ static ssize_t free_segments_show(struct f2fs_attr *a,
			(unsigned long long)(free_segments(sbi)));
}

static ssize_t ovp_segments_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{
	return sprintf(buf, "%llu\n",
			(unsigned long long)(overprovision_segments(sbi)));
}

static ssize_t lifetime_write_kbytes_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{
@@ -570,6 +577,7 @@ F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, data_io_flag, data_io_flag);
F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, node_io_flag, node_io_flag);
F2FS_GENERAL_RO_ATTR(dirty_segments);
F2FS_GENERAL_RO_ATTR(free_segments);
F2FS_GENERAL_RO_ATTR(ovp_segments);
F2FS_GENERAL_RO_ATTR(lifetime_write_kbytes);
F2FS_GENERAL_RO_ATTR(features);
F2FS_GENERAL_RO_ATTR(current_reserved_blocks);
@@ -659,6 +667,7 @@ static struct attribute *f2fs_attrs[] = {
	ATTR_LIST(node_io_flag),
	ATTR_LIST(dirty_segments),
	ATTR_LIST(free_segments),
	ATTR_LIST(ovp_segments),
	ATTR_LIST(unusable),
	ATTR_LIST(lifetime_write_kbytes),
	ATTR_LIST(features),