Skip to content

Commit 718693c

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: introduce cp_status sysfs entry
This patch adds a new sysfs entry named cp_status, it can output checkpoint flags in real time. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent fcc2d8c commit 718693c

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

Documentation/ABI/testing/sysfs-fs-f2fs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,30 @@ Description: Show status of f2fs superblock in real time.
466466
0x4000 SBI_IS_FREEZING freefs is in process
467467
====== ===================== =================================
468468

469+
What: /sys/fs/f2fs/<disk>/stat/cp_status
470+
Date: September 2022
471+
Contact: "Chao Yu" <chao.yu@oppo.com>
472+
Description: Show status of f2fs checkpoint in real time.
473+
474+
=============================== ==============================
475+
cp flag value
476+
CP_UMOUNT_FLAG 0x00000001
477+
CP_ORPHAN_PRESENT_FLAG 0x00000002
478+
CP_COMPACT_SUM_FLAG 0x00000004
479+
CP_ERROR_FLAG 0x00000008
480+
CP_FSCK_FLAG 0x00000010
481+
CP_FASTBOOT_FLAG 0x00000020
482+
CP_CRC_RECOVERY_FLAG 0x00000040
483+
CP_NAT_BITS_FLAG 0x00000080
484+
CP_TRIMMED_FLAG 0x00000100
485+
CP_NOCRC_RECOVERY_FLAG 0x00000200
486+
CP_LARGE_NAT_BITMAP_FLAG 0x00000400
487+
CP_QUOTA_NEED_FSCK_FLAG 0x00000800
488+
CP_DISABLED_FLAG 0x00001000
489+
CP_DISABLED_QUICK_FLAG 0x00002000
490+
CP_RESIZEFS_FLAG 0x00004000
491+
=============================== ==============================
492+
469493
What: /sys/fs/f2fs/<disk>/ckpt_thread_ioprio
470494
Date: January 2021
471495
Contact: "Daeho Jeong" <daehojeong@google.com>

fs/f2fs/sysfs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ static ssize_t sb_status_show(struct f2fs_attr *a,
128128
return sprintf(buf, "%lx\n", sbi->s_flag);
129129
}
130130

131+
static ssize_t cp_status_show(struct f2fs_attr *a,
132+
struct f2fs_sb_info *sbi, char *buf)
133+
{
134+
return sprintf(buf, "%x\n", le32_to_cpu(F2FS_CKPT(sbi)->ckpt_flags));
135+
}
136+
131137
static ssize_t pending_discard_show(struct f2fs_attr *a,
132138
struct f2fs_sb_info *sbi, char *buf)
133139
{
@@ -1029,8 +1035,10 @@ static struct attribute *f2fs_feat_attrs[] = {
10291035
ATTRIBUTE_GROUPS(f2fs_feat);
10301036

10311037
F2FS_GENERAL_RO_ATTR(sb_status);
1038+
F2FS_GENERAL_RO_ATTR(cp_status);
10321039
static struct attribute *f2fs_stat_attrs[] = {
10331040
ATTR_LIST(sb_status),
1041+
ATTR_LIST(cp_status),
10341042
NULL,
10351043
};
10361044
ATTRIBUTE_GROUPS(f2fs_stat);

0 commit comments

Comments
 (0)