Skip to content

Commit 2a16f24

Browse files
chaseyuJaegeuk Kim
authored andcommitted
fsck.f2fs: honor --linear-lookup=X for Android case
Behavior summary: Android Distro By default disabled enabled Android case: 1) enabled -> disabled - mkfs.f2fs -f -g android -O casefold -C utf8:nohashonly /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 0 : 0] - fsck.f2fs -g android --nolinear-lookup=1 /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 2 : 2] - mkfs.f2fs -f -g android -O casefold -C utf8:nohashonly /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 0 : 0] - fsck.f2fs -g android /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 2 : 2] 2) disabled -> enabled - mkfs.f2fs -f -g android -O casefold -C utf8:hashonly /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 2 : 2] - fsck.f2fs -g android --nolinear-lookup=0 /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 0 : 0] Distro case: 1) enabled -> disabled - mkfs.f2fs -f -O casefold -C utf8:nohashonly /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 0 : 0] - fsck.f2fs --nolinear-lookup=1 /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 2 : 2] 2) disabled -> enabled - mkfs.f2fs -f -O casefold -C utf8:hashonly /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 2 : 2] - fsck.f2fs --nolinear-lookup=0 /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 0 : 0] 3) default - mkfs.f2fs -f -O casefold -C utf8:hashonly /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 2 : 2] - fsck.f2fs /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 2 : 2] - mkfs.f2fs -f -O casefold -C utf8:nohashonly /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 0 : 0] - fsck.f2fs /dev/vdb - dump.f2fs -d3 /dev/vdb |grep s_encoding_flags s_encoding_flags [0x 0 : 0] Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 5502245 commit 2a16f24

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

fsck/fsck.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,6 +2425,15 @@ void fsck_update_sb_flags(struct f2fs_sb_info *sbi)
24252425
struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi);
24262426
u16 flags = get_sb(s_encoding_flags);
24272427

2428+
/* handle default option for Android case */
2429+
if ((c.nolinear_lookup == LINEAR_LOOKUP_DEFAULT) &&
2430+
c.disabled_feature & F2FS_FEATURE_LINEAR_LOOKUP) {
2431+
c.nolinear_lookup = LINEAR_LOOKUP_DISABLE;
2432+
MSG(0, "Info: set default linear_lookup option: %s\n",
2433+
c.nolinear_lookup == LINEAR_LOOKUP_DISABLE ?
2434+
"disable" : "enable");
2435+
}
2436+
24282437
if (c.nolinear_lookup == LINEAR_LOOKUP_DEFAULT) {
24292438
MSG(0, "Info: Casefold: linear_lookup [%s]\n",
24302439
get_sb(s_encoding_flags) & F2FS_ENC_NO_COMPAT_FALLBACK_FL ?

fsck/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static void add_default_options(void)
226226
c.auto_fix = 1;
227227

228228
/* disable linear lookup by default */
229-
c.nolinear_lookup = LINEAR_LOOKUP_DISABLE;
229+
c.disabled_feature |= F2FS_FEATURE_LINEAR_LOOKUP;
230230
} else if (c.func == RESIZE) {
231231
c.force = 1;
232232
}

0 commit comments

Comments
 (0)