Skip to content

Commit 3fea064

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: sysfs: add encoding_flags entry
This patch adds a new sysfs entry /sys/fs/f2fs/<disk>/encoding_flags, it is a read-only entry to show the value of sb.s_encoding_flags, the value is hexadecimal. ============================ ========== Flag_Name Flag_Value ============================ ========== SB_ENC_STRICT_MODE_FL 0x00000001 SB_ENC_NO_COMPAT_FALLBACK_FL 0x00000002 ============================ ========== case#1 mkfs.f2fs -f -O casefold -C utf8:strict /dev/vda mount /dev/vda /mnt/f2fs cat /sys/fs/f2fs/vda/encoding_flags 1 case#2 mkfs.f2fs -f -O casefold -C utf8 /dev/vda fsck.f2fs --nolinear-lookup=1 /dev/vda mount /dev/vda /mnt/f2fs cat /sys/fs/f2fs/vda/encoding_flags 2 Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent dc6d9ef commit 3fea064

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Documentation/ABI/testing/sysfs-fs-f2fs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,3 +846,16 @@ Description: For several zoned storage devices, vendors will provide extra space
846846
reserved_blocks. However, it is not enough, since this extra space should
847847
not be shown to users. So, with this new sysfs node, we can hide the space
848848
by substracting reserved_blocks from total bytes.
849+
850+
What: /sys/fs/f2fs/<disk>/encoding_flags
851+
Date: April 2025
852+
Contact: "Chao Yu" <[email protected]>
853+
Description: This is a read-only entry to show the value of sb.s_encoding_flags, the
854+
value is hexadecimal.
855+
856+
============================ ==========
857+
Flag_Name Flag_Value
858+
============================ ==========
859+
SB_ENC_STRICT_MODE_FL 0x00000001
860+
SB_ENC_NO_COMPAT_FALLBACK_FL 0x00000002
861+
============================ ==========

fs/f2fs/sysfs.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,13 @@ static ssize_t encoding_show(struct f2fs_attr *a,
274274
return sysfs_emit(buf, "(none)\n");
275275
}
276276

277+
static ssize_t encoding_flags_show(struct f2fs_attr *a,
278+
struct f2fs_sb_info *sbi, char *buf)
279+
{
280+
return sysfs_emit(buf, "%x\n",
281+
le16_to_cpu(F2FS_RAW_SUPER(sbi)->s_encoding_flags));
282+
}
283+
277284
static ssize_t mounted_time_sec_show(struct f2fs_attr *a,
278285
struct f2fs_sb_info *sbi, char *buf)
279286
{
@@ -1158,6 +1165,7 @@ F2FS_GENERAL_RO_ATTR(features);
11581165
F2FS_GENERAL_RO_ATTR(current_reserved_blocks);
11591166
F2FS_GENERAL_RO_ATTR(unusable);
11601167
F2FS_GENERAL_RO_ATTR(encoding);
1168+
F2FS_GENERAL_RO_ATTR(encoding_flags);
11611169
F2FS_GENERAL_RO_ATTR(mounted_time_sec);
11621170
F2FS_GENERAL_RO_ATTR(main_blkaddr);
11631171
F2FS_GENERAL_RO_ATTR(pending_discard);
@@ -1270,6 +1278,7 @@ static struct attribute *f2fs_attrs[] = {
12701278
ATTR_LIST(reserved_blocks),
12711279
ATTR_LIST(current_reserved_blocks),
12721280
ATTR_LIST(encoding),
1281+
ATTR_LIST(encoding_flags),
12731282
ATTR_LIST(mounted_time_sec),
12741283
#ifdef CONFIG_F2FS_STAT_FS
12751284
ATTR_LIST(cp_foreground_calls),

0 commit comments

Comments
 (0)