Skip to content

Commit e60aeb2

Browse files
Daeho JeongJaegeuk Kim
authored andcommitted
f2fs: make gc_urgent and gc_segment_mode sysfs node readable
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]>
1 parent 98e9286 commit e60aeb2

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

fs/f2fs/sysfs.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ enum {
4141
ATGC_INFO, /* struct atgc_management */
4242
};
4343

44+
static const char *gc_mode_names[MAX_GC_MODE] = {
45+
"GC_NORMAL",
46+
"GC_IDLE_CB",
47+
"GC_IDLE_GREEDY",
48+
"GC_IDLE_AT",
49+
"GC_URGENT_HIGH",
50+
"GC_URGENT_LOW",
51+
"GC_URGENT_MID"
52+
};
53+
4454
struct f2fs_attr {
4555
struct attribute attr;
4656
ssize_t (*show)(struct f2fs_attr *, struct f2fs_sb_info *, char *);
@@ -316,8 +326,13 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
316326
return sysfs_emit(buf, "%u\n", sbi->compr_new_inode);
317327
#endif
318328

329+
if (!strcmp(a->attr.name, "gc_urgent"))
330+
return sysfs_emit(buf, "%s\n",
331+
gc_mode_names[sbi->gc_mode]);
332+
319333
if (!strcmp(a->attr.name, "gc_segment_mode"))
320-
return sysfs_emit(buf, "%u\n", sbi->gc_segment_mode);
334+
return sysfs_emit(buf, "%s\n",
335+
gc_mode_names[sbi->gc_segment_mode]);
321336

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

0 commit comments

Comments
 (0)