Skip to content

Commit

Permalink
f2fs: make gc_urgent and gc_segment_mode sysfs node readable
Browse files Browse the repository at this point in the history
Changed a way of showing values of them to use strings.

Signed-off-by: Daeho Jeong <[email protected]>
Reviewed-by: Chao Yu <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
  • Loading branch information
Daeho Jeong authored and Jaegeuk Kim committed Mar 21, 2022
1 parent 98e9286 commit e60aeb2
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion fs/f2fs/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ enum {
ATGC_INFO, /* struct atgc_management */
};

static const char *gc_mode_names[MAX_GC_MODE] = {
"GC_NORMAL",
"GC_IDLE_CB",
"GC_IDLE_GREEDY",
"GC_IDLE_AT",
"GC_URGENT_HIGH",
"GC_URGENT_LOW",
"GC_URGENT_MID"
};

struct f2fs_attr {
struct attribute attr;
ssize_t (*show)(struct f2fs_attr *, struct f2fs_sb_info *, char *);
Expand Down Expand Up @@ -316,8 +326,13 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
return sysfs_emit(buf, "%u\n", sbi->compr_new_inode);
#endif

if (!strcmp(a->attr.name, "gc_urgent"))
return sysfs_emit(buf, "%s\n",
gc_mode_names[sbi->gc_mode]);

if (!strcmp(a->attr.name, "gc_segment_mode"))
return sysfs_emit(buf, "%u\n", sbi->gc_segment_mode);
return sysfs_emit(buf, "%s\n",
gc_mode_names[sbi->gc_segment_mode]);

if (!strcmp(a->attr.name, "gc_reclaimed_segments")) {
return sysfs_emit(buf, "%u\n",
Expand Down

0 comments on commit e60aeb2

Please sign in to comment.