Skip to content

Commit

Permalink
f2fs: export ipu policy in debugfs
Browse files Browse the repository at this point in the history
Export ipu_policy as a string in debugfs for better readability and
it can help us better understand some strategies of the file system.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Yangtao Li authored and Jaegeuk Kim committed Feb 14, 2023
1 parent 273a51e commit f2e3578
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions fs/f2fs/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,17 @@ static char *s_flag[] = {
[SBI_IS_FREEZING] = " freezefs",
};

static const char *ipu_mode_names[F2FS_IPU_MAX] = {
[F2FS_IPU_FORCE] = "FORCE",
[F2FS_IPU_SSR] = "SSR",
[F2FS_IPU_UTIL] = "UTIL",
[F2FS_IPU_SSR_UTIL] = "SSR_UTIL",
[F2FS_IPU_FSYNC] = "FSYNC",
[F2FS_IPU_ASYNC] = "ASYNC",
[F2FS_IPU_NOCACHE] = "NOCACHE",
[F2FS_IPU_HONOR_OPU_WRITE] = "HONOR_OPU_WRITE",
};

static int stat_show(struct seq_file *s, void *v)
{
struct f2fs_stat_info *si;
Expand Down Expand Up @@ -384,6 +395,19 @@ static int stat_show(struct seq_file *s, void *v)
seq_printf(s, "Current Time Sec: %llu / Mounted Time Sec: %llu\n\n",
ktime_get_boottime_seconds(),
SIT_I(si->sbi)->mounted_time);

seq_puts(s, "Policy:\n");
seq_puts(s, " - IPU: [");
if (IS_F2FS_IPU_DISABLE(si->sbi)) {
seq_puts(s, " DISABLE");
} else {
unsigned long policy = SM_I(si->sbi)->ipu_policy;

for_each_set_bit(j, &policy, F2FS_IPU_MAX)
seq_printf(s, " %s", ipu_mode_names[j]);
}
seq_puts(s, " ]\n\n");

if (test_opt(si->sbi, DISCARD))
seq_printf(s, "Utilization: %u%% (%u valid blocks, %u discard blocks)\n",
si->utilization, si->valid_count, si->discard_blks);
Expand Down
1 change: 1 addition & 0 deletions fs/f2fs/segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ static inline int utilization(struct f2fs_sb_info *sbi)

#define F2FS_IPU_DISABLE 0

/* Modification on enum should be synchronized with ipu_mode_names array */
enum {
F2FS_IPU_FORCE,
F2FS_IPU_SSR,
Expand Down

0 comments on commit f2e3578

Please sign in to comment.