Lines Matching refs:sbi
60 void f2fs_build_fault_attr(struct f2fs_sb_info *sbi, unsigned int rate, in f2fs_build_fault_attr() argument
63 struct f2fs_fault_info *ffi = &F2FS_OPTION(sbi).fault_info; in f2fs_build_fault_attr()
209 void f2fs_printk(struct f2fs_sb_info *sbi, const char *fmt, ...) in f2fs_printk() argument
221 KERN_SOH_ASCII, level, sbi->sb->s_id, &vaf); in f2fs_printk()
256 static inline void limit_reserve_root(struct f2fs_sb_info *sbi) in limit_reserve_root() argument
258 block_t limit = min((sbi->user_block_count << 1) / 1000, in limit_reserve_root()
259 sbi->user_block_count - sbi->reserved_blocks); in limit_reserve_root()
262 if (test_opt(sbi, RESERVE_ROOT) && in limit_reserve_root()
263 F2FS_OPTION(sbi).root_reserved_blocks > limit) { in limit_reserve_root()
264 F2FS_OPTION(sbi).root_reserved_blocks = limit; in limit_reserve_root()
265 f2fs_info(sbi, "Reduce reserved blocks for root = %u", in limit_reserve_root()
266 F2FS_OPTION(sbi).root_reserved_blocks); in limit_reserve_root()
268 if (!test_opt(sbi, RESERVE_ROOT) && in limit_reserve_root()
269 (!uid_eq(F2FS_OPTION(sbi).s_resuid, in limit_reserve_root()
271 !gid_eq(F2FS_OPTION(sbi).s_resgid, in limit_reserve_root()
273 f2fs_info(sbi, "Ignore s_resuid=%u, s_resgid=%u w/o reserve_root", in limit_reserve_root()
275 F2FS_OPTION(sbi).s_resuid), in limit_reserve_root()
277 F2FS_OPTION(sbi).s_resgid)); in limit_reserve_root()
293 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_set_qf_name() local
297 if (sb_any_quota_loaded(sb) && !F2FS_OPTION(sbi).s_qf_names[qtype]) { in f2fs_set_qf_name()
298 f2fs_err(sbi, "Cannot change journaled quota options when quota turned on"); in f2fs_set_qf_name()
301 if (f2fs_sb_has_quota_ino(sbi)) { in f2fs_set_qf_name()
302 f2fs_info(sbi, "QUOTA feature is enabled, so ignore qf_name"); in f2fs_set_qf_name()
308 f2fs_err(sbi, "Not enough memory for storing quotafile name"); in f2fs_set_qf_name()
311 if (F2FS_OPTION(sbi).s_qf_names[qtype]) { in f2fs_set_qf_name()
312 if (strcmp(F2FS_OPTION(sbi).s_qf_names[qtype], qname) == 0) in f2fs_set_qf_name()
315 f2fs_err(sbi, "%s quota file already specified", in f2fs_set_qf_name()
320 f2fs_err(sbi, "quotafile must be on filesystem root"); in f2fs_set_qf_name()
323 F2FS_OPTION(sbi).s_qf_names[qtype] = qname; in f2fs_set_qf_name()
324 set_opt(sbi, QUOTA); in f2fs_set_qf_name()
333 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_clear_qf_name() local
335 if (sb_any_quota_loaded(sb) && F2FS_OPTION(sbi).s_qf_names[qtype]) { in f2fs_clear_qf_name()
336 f2fs_err(sbi, "Cannot change journaled quota options when quota turned on"); in f2fs_clear_qf_name()
339 kvfree(F2FS_OPTION(sbi).s_qf_names[qtype]); in f2fs_clear_qf_name()
340 F2FS_OPTION(sbi).s_qf_names[qtype] = NULL; in f2fs_clear_qf_name()
344 static int f2fs_check_quota_options(struct f2fs_sb_info *sbi) in f2fs_check_quota_options() argument
351 if (test_opt(sbi, PRJQUOTA) && !f2fs_sb_has_project_quota(sbi)) { in f2fs_check_quota_options()
352 f2fs_err(sbi, "Project quota feature not enabled. Cannot enable project quota enforcement."); in f2fs_check_quota_options()
355 if (F2FS_OPTION(sbi).s_qf_names[USRQUOTA] || in f2fs_check_quota_options()
356 F2FS_OPTION(sbi).s_qf_names[GRPQUOTA] || in f2fs_check_quota_options()
357 F2FS_OPTION(sbi).s_qf_names[PRJQUOTA]) { in f2fs_check_quota_options()
358 if (test_opt(sbi, USRQUOTA) && in f2fs_check_quota_options()
359 F2FS_OPTION(sbi).s_qf_names[USRQUOTA]) in f2fs_check_quota_options()
360 clear_opt(sbi, USRQUOTA); in f2fs_check_quota_options()
362 if (test_opt(sbi, GRPQUOTA) && in f2fs_check_quota_options()
363 F2FS_OPTION(sbi).s_qf_names[GRPQUOTA]) in f2fs_check_quota_options()
364 clear_opt(sbi, GRPQUOTA); in f2fs_check_quota_options()
366 if (test_opt(sbi, PRJQUOTA) && in f2fs_check_quota_options()
367 F2FS_OPTION(sbi).s_qf_names[PRJQUOTA]) in f2fs_check_quota_options()
368 clear_opt(sbi, PRJQUOTA); in f2fs_check_quota_options()
370 if (test_opt(sbi, GRPQUOTA) || test_opt(sbi, USRQUOTA) || in f2fs_check_quota_options()
371 test_opt(sbi, PRJQUOTA)) { in f2fs_check_quota_options()
372 f2fs_err(sbi, "old and new quota format mixing"); in f2fs_check_quota_options()
376 if (!F2FS_OPTION(sbi).s_jquota_fmt) { in f2fs_check_quota_options()
377 f2fs_err(sbi, "journaled quota format not specified"); in f2fs_check_quota_options()
382 if (f2fs_sb_has_quota_ino(sbi) && F2FS_OPTION(sbi).s_jquota_fmt) { in f2fs_check_quota_options()
383 f2fs_info(sbi, "QUOTA feature is enabled, so ignore jquota_fmt"); in f2fs_check_quota_options()
384 F2FS_OPTION(sbi).s_jquota_fmt = 0; in f2fs_check_quota_options()
392 struct f2fs_sb_info *sbi = F2FS_SB(sb); in parse_options() local
423 set_opt(sbi, BG_GC); in parse_options()
424 clear_opt(sbi, FORCE_FG_GC); in parse_options()
426 clear_opt(sbi, BG_GC); in parse_options()
427 clear_opt(sbi, FORCE_FG_GC); in parse_options()
429 set_opt(sbi, BG_GC); in parse_options()
430 set_opt(sbi, FORCE_FG_GC); in parse_options()
438 set_opt(sbi, DISABLE_ROLL_FORWARD); in parse_options()
442 set_opt(sbi, DISABLE_ROLL_FORWARD); in parse_options()
447 set_opt(sbi, DISCARD); in parse_options()
450 if (f2fs_sb_has_blkzoned(sbi)) { in parse_options()
451 f2fs_warn(sbi, "discard is required for zoned block devices"); in parse_options()
454 clear_opt(sbi, DISCARD); in parse_options()
457 set_opt(sbi, NOHEAP); in parse_options()
460 clear_opt(sbi, NOHEAP); in parse_options()
464 set_opt(sbi, XATTR_USER); in parse_options()
467 clear_opt(sbi, XATTR_USER); in parse_options()
470 set_opt(sbi, INLINE_XATTR); in parse_options()
473 clear_opt(sbi, INLINE_XATTR); in parse_options()
478 set_opt(sbi, INLINE_XATTR_SIZE); in parse_options()
479 F2FS_OPTION(sbi).inline_xattr_size = arg; in parse_options()
483 f2fs_info(sbi, "user_xattr options not supported"); in parse_options()
486 f2fs_info(sbi, "nouser_xattr options not supported"); in parse_options()
489 f2fs_info(sbi, "inline_xattr options not supported"); in parse_options()
492 f2fs_info(sbi, "noinline_xattr options not supported"); in parse_options()
497 set_opt(sbi, POSIX_ACL); in parse_options()
500 clear_opt(sbi, POSIX_ACL); in parse_options()
504 f2fs_info(sbi, "acl options not supported"); in parse_options()
507 f2fs_info(sbi, "noacl options not supported"); in parse_options()
515 F2FS_OPTION(sbi).active_logs = arg; in parse_options()
518 set_opt(sbi, DISABLE_EXT_IDENTIFY); in parse_options()
521 set_opt(sbi, INLINE_DATA); in parse_options()
524 set_opt(sbi, INLINE_DENTRY); in parse_options()
527 clear_opt(sbi, INLINE_DENTRY); in parse_options()
530 set_opt(sbi, FLUSH_MERGE); in parse_options()
533 clear_opt(sbi, FLUSH_MERGE); in parse_options()
536 set_opt(sbi, NOBARRIER); in parse_options()
539 set_opt(sbi, FASTBOOT); in parse_options()
542 set_opt(sbi, EXTENT_CACHE); in parse_options()
545 clear_opt(sbi, EXTENT_CACHE); in parse_options()
548 clear_opt(sbi, INLINE_DATA); in parse_options()
551 set_opt(sbi, DATA_FLUSH); in parse_options()
556 if (test_opt(sbi, RESERVE_ROOT)) { in parse_options()
557 f2fs_info(sbi, "Preserve previous reserve_root=%u", in parse_options()
558 F2FS_OPTION(sbi).root_reserved_blocks); in parse_options()
560 F2FS_OPTION(sbi).root_reserved_blocks = arg; in parse_options()
561 set_opt(sbi, RESERVE_ROOT); in parse_options()
569 f2fs_err(sbi, "Invalid uid value %d", arg); in parse_options()
572 F2FS_OPTION(sbi).s_resuid = uid; in parse_options()
579 f2fs_err(sbi, "Invalid gid value %d", arg); in parse_options()
582 F2FS_OPTION(sbi).s_resgid = gid; in parse_options()
591 if (f2fs_sb_has_blkzoned(sbi)) { in parse_options()
592 f2fs_warn(sbi, "adaptive mode is not allowed with zoned block device feature"); in parse_options()
596 set_opt_mode(sbi, F2FS_MOUNT_ADAPTIVE); in parse_options()
599 set_opt_mode(sbi, F2FS_MOUNT_LFS); in parse_options()
610 f2fs_warn(sbi, "Not support %d, larger than %d", in parse_options()
614 F2FS_OPTION(sbi).write_io_size_bits = arg; in parse_options()
620 f2fs_build_fault_attr(sbi, arg, F2FS_ALL_FAULT_TYPE); in parse_options()
621 set_opt(sbi, FAULT_INJECTION); in parse_options()
627 f2fs_build_fault_attr(sbi, 0, arg); in parse_options()
628 set_opt(sbi, FAULT_INJECTION); in parse_options()
632 f2fs_info(sbi, "fault_injection options not supported"); in parse_options()
636 f2fs_info(sbi, "fault_type options not supported"); in parse_options()
648 set_opt(sbi, USRQUOTA); in parse_options()
651 set_opt(sbi, GRPQUOTA); in parse_options()
654 set_opt(sbi, PRJQUOTA); in parse_options()
687 F2FS_OPTION(sbi).s_jquota_fmt = QFMT_VFS_OLD; in parse_options()
690 F2FS_OPTION(sbi).s_jquota_fmt = QFMT_VFS_V0; in parse_options()
693 F2FS_OPTION(sbi).s_jquota_fmt = QFMT_VFS_V1; in parse_options()
696 clear_opt(sbi, QUOTA); in parse_options()
697 clear_opt(sbi, USRQUOTA); in parse_options()
698 clear_opt(sbi, GRPQUOTA); in parse_options()
699 clear_opt(sbi, PRJQUOTA); in parse_options()
716 f2fs_info(sbi, "quota operations not supported"); in parse_options()
725 F2FS_OPTION(sbi).whint_mode = WHINT_MODE_USER; in parse_options()
728 F2FS_OPTION(sbi).whint_mode = WHINT_MODE_OFF; in parse_options()
731 F2FS_OPTION(sbi).whint_mode = WHINT_MODE_FS; in parse_options()
745 F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_DEFAULT; in parse_options()
748 F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_REUSE; in parse_options()
761 F2FS_OPTION(sbi).fsync_mode = FSYNC_MODE_POSIX; in parse_options()
764 F2FS_OPTION(sbi).fsync_mode = FSYNC_MODE_STRICT; in parse_options()
767 F2FS_OPTION(sbi).fsync_mode = in parse_options()
777 if (!f2fs_sb_has_encrypt(sbi)) { in parse_options()
778 f2fs_err(sbi, "Encrypt feature is off"); in parse_options()
782 F2FS_OPTION(sbi).test_dummy_encryption = true; in parse_options()
783 f2fs_info(sbi, "Test dummy encryption mode enabled"); in parse_options()
785 f2fs_info(sbi, "Test dummy encryption mount option ignored"); in parse_options()
794 F2FS_OPTION(sbi).unusable_cap = in parse_options()
795 sbi->user_block_count; in parse_options()
797 F2FS_OPTION(sbi).unusable_cap = in parse_options()
798 (sbi->user_block_count / 100) * arg; in parse_options()
799 set_opt(sbi, DISABLE_CHECKPOINT); in parse_options()
804 F2FS_OPTION(sbi).unusable_cap = arg; in parse_options()
805 set_opt(sbi, DISABLE_CHECKPOINT); in parse_options()
808 set_opt(sbi, DISABLE_CHECKPOINT); in parse_options()
811 clear_opt(sbi, DISABLE_CHECKPOINT); in parse_options()
814 f2fs_err(sbi, "Unrecognized mount option \"%s\" or missing value", in parse_options()
820 if (f2fs_check_quota_options(sbi)) in parse_options()
823 if (f2fs_sb_has_quota_ino(sbi) && !f2fs_readonly(sbi->sb)) { in parse_options()
824 f2fs_info(sbi, "Filesystem with quota feature cannot be mounted RDWR without CONFIG_QUOTA"); in parse_options()
827 if (f2fs_sb_has_project_quota(sbi) && !f2fs_readonly(sbi->sb)) { in parse_options()
828 …f2fs_err(sbi, "Filesystem with project quota feature cannot be mounted RDWR without CONFIG_QUOTA"); in parse_options()
833 if (f2fs_sb_has_casefold(sbi)) { in parse_options()
834 f2fs_err(sbi, in parse_options()
840 if (F2FS_IO_SIZE_BITS(sbi) && !test_opt(sbi, LFS)) { in parse_options()
841 f2fs_err(sbi, "Should set mode=lfs with %uKB-sized IO", in parse_options()
842 F2FS_IO_SIZE_KB(sbi)); in parse_options()
846 if (test_opt(sbi, INLINE_XATTR_SIZE)) { in parse_options()
849 if (!f2fs_sb_has_extra_attr(sbi) || in parse_options()
850 !f2fs_sb_has_flexible_inline_xattr(sbi)) { in parse_options()
851 f2fs_err(sbi, "extra_attr or flexible_inline_xattr feature is off"); in parse_options()
854 if (!test_opt(sbi, INLINE_XATTR)) { in parse_options()
855 f2fs_err(sbi, "inline_xattr_size option should be set with inline_xattr option"); in parse_options()
862 if (F2FS_OPTION(sbi).inline_xattr_size < min_size || in parse_options()
863 F2FS_OPTION(sbi).inline_xattr_size > max_size) { in parse_options()
864 f2fs_err(sbi, "inline xattr size is out of range: %d ~ %d", in parse_options()
870 if (test_opt(sbi, DISABLE_CHECKPOINT) && test_opt(sbi, LFS)) { in parse_options()
871 f2fs_err(sbi, "LFS not compatible with checkpoint=disable\n"); in parse_options()
878 if (F2FS_OPTION(sbi).active_logs != NR_CURSEG_TYPE) in parse_options()
879 F2FS_OPTION(sbi).whint_mode = WHINT_MODE_OFF; in parse_options()
914 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); in f2fs_drop_inode() local
921 if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) { in f2fs_drop_inode()
922 if (inode->i_ino == F2FS_NODE_INO(sbi) || in f2fs_drop_inode()
923 inode->i_ino == F2FS_META_INO(sbi)) { in f2fs_drop_inode()
976 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); in f2fs_inode_dirtied() local
979 spin_lock(&sbi->inode_lock[DIRTY_META]); in f2fs_inode_dirtied()
984 stat_inc_dirty_inode(sbi, DIRTY_META); in f2fs_inode_dirtied()
988 &sbi->inode_list[DIRTY_META]); in f2fs_inode_dirtied()
989 inc_page_count(sbi, F2FS_DIRTY_IMETA); in f2fs_inode_dirtied()
991 spin_unlock(&sbi->inode_lock[DIRTY_META]); in f2fs_inode_dirtied()
997 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); in f2fs_inode_synced() local
999 spin_lock(&sbi->inode_lock[DIRTY_META]); in f2fs_inode_synced()
1001 spin_unlock(&sbi->inode_lock[DIRTY_META]); in f2fs_inode_synced()
1006 dec_page_count(sbi, F2FS_DIRTY_IMETA); in f2fs_inode_synced()
1011 spin_unlock(&sbi->inode_lock[DIRTY_META]); in f2fs_inode_synced()
1021 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); in f2fs_dirty_inode() local
1023 if (inode->i_ino == F2FS_NODE_INO(sbi) || in f2fs_dirty_inode()
1024 inode->i_ino == F2FS_META_INO(sbi)) in f2fs_dirty_inode()
1042 static void destroy_percpu_info(struct f2fs_sb_info *sbi) in destroy_percpu_info() argument
1044 percpu_counter_destroy(&sbi->alloc_valid_block_count); in destroy_percpu_info()
1045 percpu_counter_destroy(&sbi->total_valid_inode_count); in destroy_percpu_info()
1048 static void destroy_device_list(struct f2fs_sb_info *sbi) in destroy_device_list() argument
1052 for (i = 0; i < sbi->s_ndevs; i++) { in destroy_device_list()
1058 kvfree(sbi->devs); in destroy_device_list()
1063 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_put_super() local
1070 mutex_lock(&sbi->umount_mutex); in f2fs_put_super()
1077 if ((is_sbi_flag_set(sbi, SBI_IS_DIRTY) || in f2fs_put_super()
1078 !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG))) { in f2fs_put_super()
1082 f2fs_write_checkpoint(sbi, &cpc); in f2fs_put_super()
1086 dropped = f2fs_issue_discard_timeout(sbi); in f2fs_put_super()
1088 if ((f2fs_hw_support_discard(sbi) || f2fs_hw_should_discard(sbi)) && in f2fs_put_super()
1089 !sbi->discard_blks && !dropped) { in f2fs_put_super()
1093 f2fs_write_checkpoint(sbi, &cpc); in f2fs_put_super()
1100 f2fs_release_ino_entry(sbi, true); in f2fs_put_super()
1102 f2fs_leave_shrinker(sbi); in f2fs_put_super()
1103 mutex_unlock(&sbi->umount_mutex); in f2fs_put_super()
1106 f2fs_flush_merged_writes(sbi); in f2fs_put_super()
1108 f2fs_wait_on_all_pages_writeback(sbi); in f2fs_put_super()
1110 f2fs_bug_on(sbi, sbi->fsync_node_num); in f2fs_put_super()
1112 iput(sbi->node_inode); in f2fs_put_super()
1113 sbi->node_inode = NULL; in f2fs_put_super()
1115 iput(sbi->meta_inode); in f2fs_put_super()
1116 sbi->meta_inode = NULL; in f2fs_put_super()
1122 f2fs_destroy_stats(sbi); in f2fs_put_super()
1125 f2fs_destroy_node_manager(sbi); in f2fs_put_super()
1126 f2fs_destroy_segment_manager(sbi); in f2fs_put_super()
1128 kvfree(sbi->ckpt); in f2fs_put_super()
1130 f2fs_unregister_sysfs(sbi); in f2fs_put_super()
1133 if (sbi->s_chksum_driver) in f2fs_put_super()
1134 crypto_free_shash(sbi->s_chksum_driver); in f2fs_put_super()
1135 kvfree(sbi->raw_super); in f2fs_put_super()
1137 destroy_device_list(sbi); in f2fs_put_super()
1138 mempool_destroy(sbi->write_io_dummy); in f2fs_put_super()
1141 kvfree(F2FS_OPTION(sbi).s_qf_names[i]); in f2fs_put_super()
1143 destroy_percpu_info(sbi); in f2fs_put_super()
1145 kvfree(sbi->write_io[i]); in f2fs_put_super()
1147 utf8_unload(sbi->s_encoding); in f2fs_put_super()
1149 kvfree(sbi); in f2fs_put_super()
1154 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_sync_fs() local
1157 if (unlikely(f2fs_cp_error(sbi))) in f2fs_sync_fs()
1159 if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) in f2fs_sync_fs()
1164 if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING))) in f2fs_sync_fs()
1170 cpc.reason = __get_cp_reason(sbi); in f2fs_sync_fs()
1172 mutex_lock(&sbi->gc_mutex); in f2fs_sync_fs()
1173 err = f2fs_write_checkpoint(sbi, &cpc); in f2fs_sync_fs()
1174 mutex_unlock(&sbi->gc_mutex); in f2fs_sync_fs()
1246 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_statfs() local
1251 total_count = le64_to_cpu(sbi->raw_super->block_count); in f2fs_statfs()
1252 user_block_count = sbi->user_block_count; in f2fs_statfs()
1253 start_count = le32_to_cpu(sbi->raw_super->segment0_blkaddr); in f2fs_statfs()
1255 buf->f_bsize = sbi->blocksize; in f2fs_statfs()
1258 buf->f_bfree = user_block_count - valid_user_blocks(sbi) - in f2fs_statfs()
1259 sbi->current_reserved_blocks; in f2fs_statfs()
1261 spin_lock(&sbi->stat_lock); in f2fs_statfs()
1262 if (unlikely(buf->f_bfree <= sbi->unusable_block_count)) in f2fs_statfs()
1265 buf->f_bfree -= sbi->unusable_block_count; in f2fs_statfs()
1266 spin_unlock(&sbi->stat_lock); in f2fs_statfs()
1268 if (buf->f_bfree > F2FS_OPTION(sbi).root_reserved_blocks) in f2fs_statfs()
1270 F2FS_OPTION(sbi).root_reserved_blocks; in f2fs_statfs()
1274 avail_node_count = sbi->total_node_count - F2FS_RESERVED_NODE_NUM; in f2fs_statfs()
1281 buf->f_ffree = min(avail_node_count - valid_node_count(sbi), in f2fs_statfs()
1302 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_show_quota_options() local
1304 if (F2FS_OPTION(sbi).s_jquota_fmt) { in f2fs_show_quota_options()
1307 switch (F2FS_OPTION(sbi).s_jquota_fmt) { in f2fs_show_quota_options()
1321 if (F2FS_OPTION(sbi).s_qf_names[USRQUOTA]) in f2fs_show_quota_options()
1323 F2FS_OPTION(sbi).s_qf_names[USRQUOTA]); in f2fs_show_quota_options()
1325 if (F2FS_OPTION(sbi).s_qf_names[GRPQUOTA]) in f2fs_show_quota_options()
1327 F2FS_OPTION(sbi).s_qf_names[GRPQUOTA]); in f2fs_show_quota_options()
1329 if (F2FS_OPTION(sbi).s_qf_names[PRJQUOTA]) in f2fs_show_quota_options()
1331 F2FS_OPTION(sbi).s_qf_names[PRJQUOTA]); in f2fs_show_quota_options()
1337 struct f2fs_sb_info *sbi = F2FS_SB(root->d_sb); in f2fs_show_options() local
1339 if (!f2fs_readonly(sbi->sb) && test_opt(sbi, BG_GC)) { in f2fs_show_options()
1340 if (test_opt(sbi, FORCE_FG_GC)) in f2fs_show_options()
1347 if (test_opt(sbi, DISABLE_ROLL_FORWARD)) in f2fs_show_options()
1349 if (test_opt(sbi, DISCARD)) in f2fs_show_options()
1353 if (test_opt(sbi, NOHEAP)) in f2fs_show_options()
1358 if (test_opt(sbi, XATTR_USER)) in f2fs_show_options()
1362 if (test_opt(sbi, INLINE_XATTR)) in f2fs_show_options()
1366 if (test_opt(sbi, INLINE_XATTR_SIZE)) in f2fs_show_options()
1368 F2FS_OPTION(sbi).inline_xattr_size); in f2fs_show_options()
1371 if (test_opt(sbi, POSIX_ACL)) in f2fs_show_options()
1376 if (test_opt(sbi, DISABLE_EXT_IDENTIFY)) in f2fs_show_options()
1378 if (test_opt(sbi, INLINE_DATA)) in f2fs_show_options()
1382 if (test_opt(sbi, INLINE_DENTRY)) in f2fs_show_options()
1386 if (!f2fs_readonly(sbi->sb) && test_opt(sbi, FLUSH_MERGE)) in f2fs_show_options()
1388 if (test_opt(sbi, NOBARRIER)) in f2fs_show_options()
1390 if (test_opt(sbi, FASTBOOT)) in f2fs_show_options()
1392 if (test_opt(sbi, EXTENT_CACHE)) in f2fs_show_options()
1396 if (test_opt(sbi, DATA_FLUSH)) in f2fs_show_options()
1400 if (test_opt(sbi, ADAPTIVE)) in f2fs_show_options()
1402 else if (test_opt(sbi, LFS)) in f2fs_show_options()
1404 seq_printf(seq, ",active_logs=%u", F2FS_OPTION(sbi).active_logs); in f2fs_show_options()
1405 if (test_opt(sbi, RESERVE_ROOT)) in f2fs_show_options()
1407 F2FS_OPTION(sbi).root_reserved_blocks, in f2fs_show_options()
1409 F2FS_OPTION(sbi).s_resuid), in f2fs_show_options()
1411 F2FS_OPTION(sbi).s_resgid)); in f2fs_show_options()
1412 if (F2FS_IO_SIZE_BITS(sbi)) in f2fs_show_options()
1414 F2FS_OPTION(sbi).write_io_size_bits); in f2fs_show_options()
1416 if (test_opt(sbi, FAULT_INJECTION)) { in f2fs_show_options()
1418 F2FS_OPTION(sbi).fault_info.inject_rate); in f2fs_show_options()
1420 F2FS_OPTION(sbi).fault_info.inject_type); in f2fs_show_options()
1424 if (test_opt(sbi, QUOTA)) in f2fs_show_options()
1426 if (test_opt(sbi, USRQUOTA)) in f2fs_show_options()
1428 if (test_opt(sbi, GRPQUOTA)) in f2fs_show_options()
1430 if (test_opt(sbi, PRJQUOTA)) in f2fs_show_options()
1433 f2fs_show_quota_options(seq, sbi->sb); in f2fs_show_options()
1434 if (F2FS_OPTION(sbi).whint_mode == WHINT_MODE_USER) in f2fs_show_options()
1436 else if (F2FS_OPTION(sbi).whint_mode == WHINT_MODE_FS) in f2fs_show_options()
1439 if (F2FS_OPTION(sbi).test_dummy_encryption) in f2fs_show_options()
1443 if (F2FS_OPTION(sbi).alloc_mode == ALLOC_MODE_DEFAULT) in f2fs_show_options()
1445 else if (F2FS_OPTION(sbi).alloc_mode == ALLOC_MODE_REUSE) in f2fs_show_options()
1448 if (test_opt(sbi, DISABLE_CHECKPOINT)) in f2fs_show_options()
1450 F2FS_OPTION(sbi).unusable_cap); in f2fs_show_options()
1451 if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_POSIX) in f2fs_show_options()
1453 else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT) in f2fs_show_options()
1455 else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_NOBARRIER) in f2fs_show_options()
1460 static void default_options(struct f2fs_sb_info *sbi) in default_options() argument
1463 F2FS_OPTION(sbi).active_logs = NR_CURSEG_TYPE; in default_options()
1464 F2FS_OPTION(sbi).inline_xattr_size = DEFAULT_INLINE_XATTR_ADDRS; in default_options()
1465 F2FS_OPTION(sbi).whint_mode = WHINT_MODE_OFF; in default_options()
1466 F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_DEFAULT; in default_options()
1467 F2FS_OPTION(sbi).fsync_mode = FSYNC_MODE_POSIX; in default_options()
1468 F2FS_OPTION(sbi).test_dummy_encryption = false; in default_options()
1469 F2FS_OPTION(sbi).s_resuid = make_kuid(&init_user_ns, F2FS_DEF_RESUID); in default_options()
1470 F2FS_OPTION(sbi).s_resgid = make_kgid(&init_user_ns, F2FS_DEF_RESGID); in default_options()
1472 set_opt(sbi, BG_GC); in default_options()
1473 set_opt(sbi, INLINE_XATTR); in default_options()
1474 set_opt(sbi, INLINE_DATA); in default_options()
1475 set_opt(sbi, INLINE_DENTRY); in default_options()
1476 set_opt(sbi, EXTENT_CACHE); in default_options()
1477 set_opt(sbi, NOHEAP); in default_options()
1478 clear_opt(sbi, DISABLE_CHECKPOINT); in default_options()
1479 F2FS_OPTION(sbi).unusable_cap = 0; in default_options()
1480 sbi->sb->s_flags |= SB_LAZYTIME; in default_options()
1481 set_opt(sbi, FLUSH_MERGE); in default_options()
1482 set_opt(sbi, DISCARD); in default_options()
1483 if (f2fs_sb_has_blkzoned(sbi)) in default_options()
1484 set_opt_mode(sbi, F2FS_MOUNT_LFS); in default_options()
1486 set_opt_mode(sbi, F2FS_MOUNT_ADAPTIVE); in default_options()
1489 set_opt(sbi, XATTR_USER); in default_options()
1492 set_opt(sbi, POSIX_ACL); in default_options()
1495 f2fs_build_fault_attr(sbi, 0, 0); in default_options()
1502 static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi) in f2fs_disable_checkpoint() argument
1504 unsigned int s_flags = sbi->sb->s_flags; in f2fs_disable_checkpoint()
1511 f2fs_err(sbi, "checkpoint=disable on readonly fs"); in f2fs_disable_checkpoint()
1514 sbi->sb->s_flags |= SB_ACTIVE; in f2fs_disable_checkpoint()
1516 f2fs_update_time(sbi, DISABLE_TIME); in f2fs_disable_checkpoint()
1518 while (!f2fs_time_over(sbi, DISABLE_TIME)) { in f2fs_disable_checkpoint()
1519 mutex_lock(&sbi->gc_mutex); in f2fs_disable_checkpoint()
1520 err = f2fs_gc(sbi, true, false, NULL_SEGNO); in f2fs_disable_checkpoint()
1529 ret = sync_filesystem(sbi->sb); in f2fs_disable_checkpoint()
1535 unusable = f2fs_get_unusable_blocks(sbi); in f2fs_disable_checkpoint()
1536 if (f2fs_disable_cp_again(sbi, unusable)) { in f2fs_disable_checkpoint()
1541 mutex_lock(&sbi->gc_mutex); in f2fs_disable_checkpoint()
1543 set_sbi_flag(sbi, SBI_CP_DISABLED); in f2fs_disable_checkpoint()
1544 err = f2fs_write_checkpoint(sbi, &cpc); in f2fs_disable_checkpoint()
1548 spin_lock(&sbi->stat_lock); in f2fs_disable_checkpoint()
1549 sbi->unusable_block_count = unusable; in f2fs_disable_checkpoint()
1550 spin_unlock(&sbi->stat_lock); in f2fs_disable_checkpoint()
1553 mutex_unlock(&sbi->gc_mutex); in f2fs_disable_checkpoint()
1555 sbi->sb->s_flags = s_flags; /* Restore MS_RDONLY status */ in f2fs_disable_checkpoint()
1559 static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi) in f2fs_enable_checkpoint() argument
1561 mutex_lock(&sbi->gc_mutex); in f2fs_enable_checkpoint()
1562 f2fs_dirty_to_prefree(sbi); in f2fs_enable_checkpoint()
1564 clear_sbi_flag(sbi, SBI_CP_DISABLED); in f2fs_enable_checkpoint()
1565 set_sbi_flag(sbi, SBI_IS_DIRTY); in f2fs_enable_checkpoint()
1566 mutex_unlock(&sbi->gc_mutex); in f2fs_enable_checkpoint()
1568 f2fs_sync_fs(sbi->sb, 1); in f2fs_enable_checkpoint()
1573 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_remount() local
1579 bool no_extent_cache = !test_opt(sbi, EXTENT_CACHE); in f2fs_remount()
1580 bool disable_checkpoint = test_opt(sbi, DISABLE_CHECKPOINT); in f2fs_remount()
1581 bool no_io_align = !F2FS_IO_ALIGNED(sbi); in f2fs_remount()
1591 org_mount_opt = sbi->mount_opt; in f2fs_remount()
1595 org_mount_opt.s_jquota_fmt = F2FS_OPTION(sbi).s_jquota_fmt; in f2fs_remount()
1597 if (F2FS_OPTION(sbi).s_qf_names[i]) { in f2fs_remount()
1599 kstrdup(F2FS_OPTION(sbi).s_qf_names[i], in f2fs_remount()
1613 if (!(*flags & SB_RDONLY) && is_sbi_flag_set(sbi, SBI_NEED_SB_WRITE)) { in f2fs_remount()
1614 err = f2fs_commit_super(sbi, false); in f2fs_remount()
1615 f2fs_info(sbi, "Try to recover all the superblocks, ret: %d", in f2fs_remount()
1618 clear_sbi_flag(sbi, SBI_NEED_SB_WRITE); in f2fs_remount()
1621 default_options(sbi); in f2fs_remount()
1628 disable_checkpoint != test_opt(sbi, DISABLE_CHECKPOINT); in f2fs_remount()
1647 } else if (f2fs_sb_has_quota_ino(sbi)) { in f2fs_remount()
1655 if (no_extent_cache == !!test_opt(sbi, EXTENT_CACHE)) { in f2fs_remount()
1657 f2fs_warn(sbi, "switch extent_cache option is not allowed"); in f2fs_remount()
1661 if (no_io_align == !!F2FS_IO_ALIGNED(sbi)) { in f2fs_remount()
1663 f2fs_warn(sbi, "switch io_bits option is not allowed"); in f2fs_remount()
1667 if ((*flags & SB_RDONLY) && test_opt(sbi, DISABLE_CHECKPOINT)) { in f2fs_remount()
1669 f2fs_warn(sbi, "disabling checkpoint not compatible with read-only"); in f2fs_remount()
1678 if ((*flags & SB_RDONLY) || !test_opt(sbi, BG_GC)) { in f2fs_remount()
1679 if (sbi->gc_thread) { in f2fs_remount()
1680 f2fs_stop_gc_thread(sbi); in f2fs_remount()
1683 } else if (!sbi->gc_thread) { in f2fs_remount()
1684 err = f2fs_start_gc_thread(sbi); in f2fs_remount()
1691 F2FS_OPTION(sbi).whint_mode != org_mount_opt.whint_mode) { in f2fs_remount()
1695 set_sbi_flag(sbi, SBI_IS_DIRTY); in f2fs_remount()
1696 set_sbi_flag(sbi, SBI_IS_CLOSE); in f2fs_remount()
1698 clear_sbi_flag(sbi, SBI_IS_CLOSE); in f2fs_remount()
1702 if (test_opt(sbi, DISABLE_CHECKPOINT)) { in f2fs_remount()
1703 err = f2fs_disable_checkpoint(sbi); in f2fs_remount()
1707 f2fs_enable_checkpoint(sbi); in f2fs_remount()
1715 if ((*flags & SB_RDONLY) || !test_opt(sbi, FLUSH_MERGE)) { in f2fs_remount()
1716 clear_opt(sbi, FLUSH_MERGE); in f2fs_remount()
1717 f2fs_destroy_flush_cmd_control(sbi, false); in f2fs_remount()
1719 err = f2fs_create_flush_cmd_control(sbi); in f2fs_remount()
1731 (test_opt(sbi, POSIX_ACL) ? SB_POSIXACL : 0); in f2fs_remount()
1733 limit_reserve_root(sbi); in f2fs_remount()
1738 if (f2fs_start_gc_thread(sbi)) in f2fs_remount()
1739 f2fs_warn(sbi, "background gc thread has stopped"); in f2fs_remount()
1741 f2fs_stop_gc_thread(sbi); in f2fs_remount()
1745 F2FS_OPTION(sbi).s_jquota_fmt = org_mount_opt.s_jquota_fmt; in f2fs_remount()
1747 kvfree(F2FS_OPTION(sbi).s_qf_names[i]); in f2fs_remount()
1748 F2FS_OPTION(sbi).s_qf_names[i] = org_mount_opt.s_qf_names[i]; in f2fs_remount()
1751 sbi->mount_opt = org_mount_opt; in f2fs_remount()
1875 static int f2fs_quota_on_mount(struct f2fs_sb_info *sbi, int type) in f2fs_quota_on_mount() argument
1877 if (is_set_ckpt_flags(sbi, CP_QUOTA_NEED_FSCK_FLAG)) { in f2fs_quota_on_mount()
1878 f2fs_err(sbi, "quota sysfile may be corrupted, skip loading it"); in f2fs_quota_on_mount()
1882 return dquot_quota_on_mount(sbi->sb, F2FS_OPTION(sbi).s_qf_names[type], in f2fs_quota_on_mount()
1883 F2FS_OPTION(sbi).s_jquota_fmt, type); in f2fs_quota_on_mount()
1886 int f2fs_enable_quota_files(struct f2fs_sb_info *sbi, bool rdonly) in f2fs_enable_quota_files() argument
1891 if (f2fs_sb_has_quota_ino(sbi) && rdonly) { in f2fs_enable_quota_files()
1892 err = f2fs_enable_quotas(sbi->sb); in f2fs_enable_quota_files()
1894 f2fs_err(sbi, "Cannot turn on quota_ino: %d", err); in f2fs_enable_quota_files()
1901 if (F2FS_OPTION(sbi).s_qf_names[i]) { in f2fs_enable_quota_files()
1902 err = f2fs_quota_on_mount(sbi, i); in f2fs_enable_quota_files()
1907 f2fs_err(sbi, "Cannot turn on quotas: %d on %d", in f2fs_enable_quota_files()
1942 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_enable_quotas() local
1946 test_opt(sbi, USRQUOTA), in f2fs_enable_quotas()
1947 test_opt(sbi, GRPQUOTA), in f2fs_enable_quotas()
1948 test_opt(sbi, PRJQUOTA), in f2fs_enable_quotas()
1952 f2fs_err(sbi, "quota file may be corrupted, skip loading it"); in f2fs_enable_quotas()
1965 f2fs_err(sbi, "Failed to enable quota tracking (type=%d, err=%d). Please run fsck to fix.", in f2fs_enable_quotas()
1980 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_quota_sync() local
1994 f2fs_lock_op(sbi); in f2fs_quota_sync()
1996 down_read(&sbi->quota_sem); in f2fs_quota_sync()
2020 if (is_journalled_quota(sbi)) in f2fs_quota_sync()
2034 up_read(&sbi->quota_sem); in f2fs_quota_sync()
2035 f2fs_unlock_op(sbi); in f2fs_quota_sync()
2098 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_quota_off() local
2108 if (is_journalled_quota(sbi)) in f2fs_quota_off()
2109 set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); in f2fs_quota_off()
2150 struct f2fs_sb_info *sbi = F2FS_SB(dquot->dq_sb); in f2fs_dquot_commit() local
2153 down_read(&sbi->quota_sem); in f2fs_dquot_commit()
2156 set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); in f2fs_dquot_commit()
2157 up_read(&sbi->quota_sem); in f2fs_dquot_commit()
2163 struct f2fs_sb_info *sbi = F2FS_SB(dquot->dq_sb); in f2fs_dquot_acquire() local
2166 down_read(&sbi->quota_sem); in f2fs_dquot_acquire()
2169 set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); in f2fs_dquot_acquire()
2170 up_read(&sbi->quota_sem); in f2fs_dquot_acquire()
2176 struct f2fs_sb_info *sbi = F2FS_SB(dquot->dq_sb); in f2fs_dquot_release() local
2179 down_read(&sbi->quota_sem); in f2fs_dquot_release()
2182 set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); in f2fs_dquot_release()
2183 up_read(&sbi->quota_sem); in f2fs_dquot_release()
2190 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_dquot_mark_dquot_dirty() local
2193 down_read(&sbi->quota_sem); in f2fs_dquot_mark_dquot_dirty()
2197 if (is_journalled_quota(sbi)) in f2fs_dquot_mark_dquot_dirty()
2198 set_sbi_flag(sbi, SBI_QUOTA_NEED_FLUSH); in f2fs_dquot_mark_dquot_dirty()
2200 up_read(&sbi->quota_sem); in f2fs_dquot_mark_dquot_dirty()
2206 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_dquot_commit_info() local
2209 down_read(&sbi->quota_sem); in f2fs_dquot_commit_info()
2212 set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); in f2fs_dquot_commit_info()
2213 up_read(&sbi->quota_sem); in f2fs_dquot_commit_info()
2289 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); in f2fs_set_context() local
2297 if (f2fs_sb_has_lost_found(sbi) && in f2fs_set_context()
2298 inode->i_ino == F2FS_ROOT_INO(sbi)) in f2fs_set_context()
2324 struct f2fs_sb_info *sbi = F2FS_SB(sb); in f2fs_nfs_get_inode() local
2327 if (f2fs_check_nid_range(sbi, ino)) in f2fs_nfs_get_inode()
2405 static inline bool sanity_check_area_boundary(struct f2fs_sb_info *sbi, in sanity_check_area_boundary() argument
2410 struct super_block *sb = sbi->sb; in sanity_check_area_boundary()
2430 f2fs_info(sbi, "Mismatch start address, segment0(%u) cp_blkaddr(%u)", in sanity_check_area_boundary()
2437 f2fs_info(sbi, "Wrong CP boundary, start(%u) end(%u) blocks(%u)", in sanity_check_area_boundary()
2445 f2fs_info(sbi, "Wrong SIT boundary, start(%u) end(%u) blocks(%u)", in sanity_check_area_boundary()
2453 f2fs_info(sbi, "Wrong NAT boundary, start(%u) end(%u) blocks(%u)", in sanity_check_area_boundary()
2461 f2fs_info(sbi, "Wrong SSA boundary, start(%u) end(%u) blocks(%u)", in sanity_check_area_boundary()
2468 f2fs_info(sbi, "Wrong MAIN_AREA boundary, start(%u) end(%u) block(%u)", in sanity_check_area_boundary()
2483 set_sbi_flag(sbi, SBI_NEED_SB_WRITE); in sanity_check_area_boundary()
2489 f2fs_info(sbi, "Fix alignment : %s, start(%u) end(%u) block(%u)", in sanity_check_area_boundary()
2500 static int sanity_check_raw_super(struct f2fs_sb_info *sbi, in sanity_check_raw_super() argument
2512 f2fs_info(sbi, "Magic Mismatch, valid(0x%x) - read(0x%x)", in sanity_check_raw_super()
2522 f2fs_info(sbi, "Invalid SB checksum offset: %zu", in sanity_check_raw_super()
2527 if (!f2fs_crc_valid(sbi, crc, raw_super, crc_offset)) { in sanity_check_raw_super()
2528 f2fs_info(sbi, "Invalid SB checksum value: %u", crc); in sanity_check_raw_super()
2535 f2fs_info(sbi, "Invalid page_cache_size (%lu), supports only 4KB", in sanity_check_raw_super()
2543 f2fs_info(sbi, "Invalid blocksize (%u), supports only 4KB", in sanity_check_raw_super()
2550 f2fs_info(sbi, "Invalid log blocks per segment (%u)", in sanity_check_raw_super()
2560 f2fs_info(sbi, "Invalid log sectorsize (%u)", in sanity_check_raw_super()
2567 f2fs_info(sbi, "Invalid log sectors per block(%u) log sectorsize(%u)", in sanity_check_raw_super()
2583 f2fs_info(sbi, "Invalid segment count (%u)", segment_count); in sanity_check_raw_super()
2590 f2fs_info(sbi, "Invalid segment/section count (%u, %u x %u)", in sanity_check_raw_super()
2596 f2fs_info(sbi, "Small segment_count (%u < %u * %u)", in sanity_check_raw_super()
2602 f2fs_info(sbi, "Wrong segment_count / block_count (%u > %llu)", in sanity_check_raw_super()
2608 f2fs_info(sbi, "Wrong secs_per_zone / total_sections (%u, %u)", in sanity_check_raw_super()
2616 f2fs_info(sbi, "Corrupted extension count (%u + %u > %u)", in sanity_check_raw_super()
2625 f2fs_info(sbi, "Insane cp_payload (%u > %u)", in sanity_check_raw_super()
2635 f2fs_info(sbi, "Invalid Fs Meta Ino: node(%u) meta(%u) root(%u)", in sanity_check_raw_super()
2643 if (sanity_check_area_boundary(sbi, bh)) in sanity_check_raw_super()
2649 int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi) in f2fs_sanity_check_ckpt() argument
2652 struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi); in f2fs_sanity_check_ckpt()
2653 struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); in f2fs_sanity_check_ckpt()
2682 f2fs_err(sbi, "Wrong layout: check mkfs.f2fs version"); in f2fs_sanity_check_ckpt()
2691 f2fs_err(sbi, "Wrong user_block_count: %u", in f2fs_sanity_check_ckpt()
2698 f2fs_err(sbi, "Wrong valid_user_blocks: %u, user_block_count: %u", in f2fs_sanity_check_ckpt()
2704 avail_node_count = sbi->total_node_count - F2FS_RESERVED_NODE_NUM; in f2fs_sanity_check_ckpt()
2706 f2fs_err(sbi, "Wrong valid_node_count: %u, avail_node_count: %u", in f2fs_sanity_check_ckpt()
2712 blocks_per_seg = sbi->blocks_per_seg; in f2fs_sanity_check_ckpt()
2721 f2fs_err(sbi, "Node segment (%u, %u) has the same segno: %u", in f2fs_sanity_check_ckpt()
2735 f2fs_err(sbi, "Data segment (%u, %u) has the same segno: %u", in f2fs_sanity_check_ckpt()
2746 f2fs_err(sbi, "Node segment (%u) and Data segment (%u) has the same segno: %u", in f2fs_sanity_check_ckpt()
2759 f2fs_err(sbi, "Wrong bitmap size: sit: %u, nat:%u", in f2fs_sanity_check_ckpt()
2764 cp_pack_start_sum = __start_sum_addr(sbi); in f2fs_sanity_check_ckpt()
2765 cp_payload = __cp_payload(sbi); in f2fs_sanity_check_ckpt()
2769 f2fs_err(sbi, "Wrong cp_pack_start_sum: %u", in f2fs_sanity_check_ckpt()
2776 f2fs_warn(sbi, "using deprecated layout of large_nat_bitmap, " in f2fs_sanity_check_ckpt()
2783 if (unlikely(f2fs_cp_error(sbi))) { in f2fs_sanity_check_ckpt()
2784 f2fs_err(sbi, "A bug case: need to run fsck"); in f2fs_sanity_check_ckpt()
2790 static void init_sb_info(struct f2fs_sb_info *sbi) in init_sb_info() argument
2792 struct f2fs_super_block *raw_super = sbi->raw_super; in init_sb_info()
2795 sbi->log_sectors_per_block = in init_sb_info()
2797 sbi->log_blocksize = le32_to_cpu(raw_super->log_blocksize); in init_sb_info()
2798 sbi->blocksize = 1 << sbi->log_blocksize; in init_sb_info()
2799 sbi->log_blocks_per_seg = le32_to_cpu(raw_super->log_blocks_per_seg); in init_sb_info()
2800 sbi->blocks_per_seg = 1 << sbi->log_blocks_per_seg; in init_sb_info()
2801 sbi->segs_per_sec = le32_to_cpu(raw_super->segs_per_sec); in init_sb_info()
2802 sbi->secs_per_zone = le32_to_cpu(raw_super->secs_per_zone); in init_sb_info()
2803 sbi->total_sections = le32_to_cpu(raw_super->section_count); in init_sb_info()
2804 sbi->total_node_count = in init_sb_info()
2806 * sbi->blocks_per_seg * NAT_ENTRY_PER_BLOCK; in init_sb_info()
2807 sbi->root_ino_num = le32_to_cpu(raw_super->root_ino); in init_sb_info()
2808 sbi->node_ino_num = le32_to_cpu(raw_super->node_ino); in init_sb_info()
2809 sbi->meta_ino_num = le32_to_cpu(raw_super->meta_ino); in init_sb_info()
2810 sbi->cur_victim_sec = NULL_SECNO; in init_sb_info()
2811 sbi->next_victim_seg[BG_GC] = NULL_SEGNO; in init_sb_info()
2812 sbi->next_victim_seg[FG_GC] = NULL_SEGNO; in init_sb_info()
2813 sbi->max_victim_search = DEF_MAX_VICTIM_SEARCH; in init_sb_info()
2814 sbi->migration_granularity = sbi->segs_per_sec; in init_sb_info()
2816 sbi->dir_level = DEF_DIR_LEVEL; in init_sb_info()
2817 sbi->interval_time[CP_TIME] = DEF_CP_INTERVAL; in init_sb_info()
2818 sbi->interval_time[REQ_TIME] = DEF_IDLE_INTERVAL; in init_sb_info()
2819 sbi->interval_time[DISCARD_TIME] = DEF_IDLE_INTERVAL; in init_sb_info()
2820 sbi->interval_time[GC_TIME] = DEF_IDLE_INTERVAL; in init_sb_info()
2821 sbi->interval_time[DISABLE_TIME] = DEF_DISABLE_INTERVAL; in init_sb_info()
2822 sbi->interval_time[UMOUNT_DISCARD_TIMEOUT] = in init_sb_info()
2824 clear_sbi_flag(sbi, SBI_NEED_FSCK); in init_sb_info()
2827 atomic_set(&sbi->nr_pages[i], 0); in init_sb_info()
2830 atomic_set(&sbi->wb_sync_req[i], 0); in init_sb_info()
2832 INIT_LIST_HEAD(&sbi->s_list); in init_sb_info()
2833 mutex_init(&sbi->umount_mutex); in init_sb_info()
2834 init_rwsem(&sbi->io_order_lock); in init_sb_info()
2835 spin_lock_init(&sbi->cp_lock); in init_sb_info()
2837 sbi->dirty_device = 0; in init_sb_info()
2838 spin_lock_init(&sbi->dev_lock); in init_sb_info()
2840 init_rwsem(&sbi->sb_lock); in init_sb_info()
2843 static int init_percpu_info(struct f2fs_sb_info *sbi) in init_percpu_info() argument
2847 err = percpu_counter_init(&sbi->alloc_valid_block_count, 0, GFP_KERNEL); in init_percpu_info()
2851 err = percpu_counter_init(&sbi->total_valid_inode_count, 0, in init_percpu_info()
2854 percpu_counter_destroy(&sbi->alloc_valid_block_count); in init_percpu_info()
2860 static int init_blkz_info(struct f2fs_sb_info *sbi, int devi) in init_blkz_info() argument
2870 if (!f2fs_sb_has_blkzoned(sbi)) in init_blkz_info()
2873 if (sbi->blocks_per_blkz && sbi->blocks_per_blkz != in init_blkz_info()
2876 sbi->blocks_per_blkz = SECTOR_TO_BLOCK(bdev_zone_sectors(bdev)); in init_blkz_info()
2877 if (sbi->log_blocks_per_blkz && sbi->log_blocks_per_blkz != in init_blkz_info()
2878 __ilog2_u32(sbi->blocks_per_blkz)) in init_blkz_info()
2880 sbi->log_blocks_per_blkz = __ilog2_u32(sbi->blocks_per_blkz); in init_blkz_info()
2882 sbi->log_blocks_per_blkz; in init_blkz_info()
2886 FDEV(devi).blkz_seq = f2fs_kzalloc(sbi, in init_blkz_info()
2895 zones = f2fs_kzalloc(sbi, in init_blkz_info()
2934 static int read_raw_super_block(struct f2fs_sb_info *sbi, in read_raw_super_block() argument
2938 struct super_block *sb = sbi->sb; in read_raw_super_block()
2951 f2fs_err(sbi, "Unable to read %dth superblock", in read_raw_super_block()
2958 err = sanity_check_raw_super(sbi, bh); in read_raw_super_block()
2960 f2fs_err(sbi, "Can't find valid F2FS filesystem in %dth superblock", in read_raw_super_block()
2988 int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover) in f2fs_commit_super() argument
2994 if ((recover && f2fs_readonly(sbi->sb)) || in f2fs_commit_super()
2995 bdev_read_only(sbi->sb->s_bdev)) { in f2fs_commit_super()
2996 set_sbi_flag(sbi, SBI_NEED_SB_WRITE); in f2fs_commit_super()
3001 if (!recover && f2fs_sb_has_sb_chksum(sbi)) { in f2fs_commit_super()
3002 crc = f2fs_crc32(sbi, F2FS_RAW_SUPER(sbi), in f2fs_commit_super()
3004 F2FS_RAW_SUPER(sbi)->crc = cpu_to_le32(crc); in f2fs_commit_super()
3008 bh = sb_bread(sbi->sb, sbi->valid_super_block ? 0 : 1); in f2fs_commit_super()
3011 err = __f2fs_commit_super(bh, F2FS_RAW_SUPER(sbi)); in f2fs_commit_super()
3019 bh = sb_bread(sbi->sb, sbi->valid_super_block); in f2fs_commit_super()
3022 err = __f2fs_commit_super(bh, F2FS_RAW_SUPER(sbi)); in f2fs_commit_super()
3027 static int f2fs_scan_devices(struct f2fs_sb_info *sbi) in f2fs_scan_devices() argument
3029 struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi); in f2fs_scan_devices()
3035 if (!bdev_is_zoned(sbi->sb->s_bdev)) in f2fs_scan_devices()
3044 sbi->devs = f2fs_kzalloc(sbi, in f2fs_scan_devices()
3048 if (!sbi->devs) in f2fs_scan_devices()
3059 blkdev_get_by_dev(sbi->sb->s_bdev->bd_dev, in f2fs_scan_devices()
3060 sbi->sb->s_mode, sbi->sb->s_type); in f2fs_scan_devices()
3070 sbi->log_blocks_per_seg) - 1 + in f2fs_scan_devices()
3076 sbi->log_blocks_per_seg) - 1; in f2fs_scan_devices()
3079 sbi->sb->s_mode, sbi->sb->s_type); in f2fs_scan_devices()
3085 sbi->s_ndevs = i + 1; in f2fs_scan_devices()
3089 !f2fs_sb_has_blkzoned(sbi)) { in f2fs_scan_devices()
3090 f2fs_err(sbi, "Zoned block device feature not enabled\n"); in f2fs_scan_devices()
3094 if (init_blkz_info(sbi, i)) { in f2fs_scan_devices()
3095 f2fs_err(sbi, "Failed to initialize F2FS blkzone information"); in f2fs_scan_devices()
3100 f2fs_info(sbi, "Mount Device [%2d]: %20s, %8u, %8x - %8x (zone: %s)", in f2fs_scan_devices()
3109 f2fs_info(sbi, "Mount Device [%2d]: %20s, %8u, %8x - %8x", in f2fs_scan_devices()
3114 f2fs_info(sbi, in f2fs_scan_devices()
3115 "IO Block Size: %8d KB", F2FS_IO_SIZE_KB(sbi)); in f2fs_scan_devices()
3119 static int f2fs_setup_casefold(struct f2fs_sb_info *sbi) in f2fs_setup_casefold() argument
3122 if (f2fs_sb_has_casefold(sbi) && !sbi->s_encoding) { in f2fs_setup_casefold()
3127 if (f2fs_sb_has_encrypt(sbi)) { in f2fs_setup_casefold()
3128 f2fs_err(sbi, in f2fs_setup_casefold()
3133 if (f2fs_sb_read_encoding(sbi->raw_super, &encoding_info, in f2fs_setup_casefold()
3135 f2fs_err(sbi, in f2fs_setup_casefold()
3142 f2fs_err(sbi, in f2fs_setup_casefold()
3149 f2fs_info(sbi, "Using encoding defined by superblock: " in f2fs_setup_casefold()
3153 sbi->s_encoding = encoding; in f2fs_setup_casefold()
3154 sbi->s_encoding_flags = encoding_flags; in f2fs_setup_casefold()
3155 sbi->sb->s_d_op = &f2fs_dentry_ops; in f2fs_setup_casefold()
3158 if (f2fs_sb_has_casefold(sbi)) { in f2fs_setup_casefold()
3159 f2fs_err(sbi, "Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE"); in f2fs_setup_casefold()
3166 static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi) in f2fs_tuning_parameters() argument
3168 struct f2fs_sm_info *sm_i = SM_I(sbi); in f2fs_tuning_parameters()
3172 F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_REUSE; in f2fs_tuning_parameters()
3177 sbi->readdir_ra = 1; in f2fs_tuning_parameters()
3182 struct f2fs_sb_info *sbi; in f2fs_fill_super() local
3199 sbi = kzalloc(sizeof(struct f2fs_sb_info), GFP_KERNEL); in f2fs_fill_super()
3200 if (!sbi) in f2fs_fill_super()
3203 sbi->sb = sb; in f2fs_fill_super()
3206 sbi->s_chksum_driver = crypto_alloc_shash("crc32", 0, 0); in f2fs_fill_super()
3207 if (IS_ERR(sbi->s_chksum_driver)) { in f2fs_fill_super()
3208 f2fs_err(sbi, "Cannot load crc32 driver."); in f2fs_fill_super()
3209 err = PTR_ERR(sbi->s_chksum_driver); in f2fs_fill_super()
3210 sbi->s_chksum_driver = NULL; in f2fs_fill_super()
3216 f2fs_err(sbi, "unable to set blocksize"); in f2fs_fill_super()
3220 err = read_raw_super_block(sbi, &raw_super, &valid_super_block, in f2fs_fill_super()
3225 sb->s_fs_info = sbi; in f2fs_fill_super()
3226 sbi->raw_super = raw_super; in f2fs_fill_super()
3229 if (f2fs_sb_has_inode_chksum(sbi)) in f2fs_fill_super()
3230 sbi->s_chksum_seed = f2fs_chksum(sbi, ~0, raw_super->uuid, in f2fs_fill_super()
3239 if (f2fs_sb_has_blkzoned(sbi)) { in f2fs_fill_super()
3240 f2fs_err(sbi, "Zoned block device support is not enabled"); in f2fs_fill_super()
3245 default_options(sbi); in f2fs_fill_super()
3257 sbi->max_file_blocks = max_file_blocks(); in f2fs_fill_super()
3258 sb->s_maxbytes = sbi->max_file_blocks << in f2fs_fill_super()
3262 err = f2fs_setup_casefold(sbi); in f2fs_fill_super()
3271 if (f2fs_sb_has_quota_ino(sbi)) { in f2fs_fill_super()
3273 if (f2fs_qf_ino(sbi->sb, i)) in f2fs_fill_super()
3274 sbi->nquota_files++; in f2fs_fill_super()
3291 (test_opt(sbi, POSIX_ACL) ? SB_POSIXACL : 0); in f2fs_fill_super()
3296 sbi->valid_super_block = valid_super_block; in f2fs_fill_super()
3297 mutex_init(&sbi->gc_mutex); in f2fs_fill_super()
3298 mutex_init(&sbi->writepages); in f2fs_fill_super()
3299 mutex_init(&sbi->cp_mutex); in f2fs_fill_super()
3300 mutex_init(&sbi->resize_mutex); in f2fs_fill_super()
3301 init_rwsem(&sbi->node_write); in f2fs_fill_super()
3302 init_rwsem(&sbi->node_change); in f2fs_fill_super()
3305 set_sbi_flag(sbi, SBI_POR_DOING); in f2fs_fill_super()
3306 spin_lock_init(&sbi->stat_lock); in f2fs_fill_super()
3309 spin_lock_init(&sbi->iostat_lock); in f2fs_fill_super()
3310 sbi->iostat_enable = false; in f2fs_fill_super()
3316 sbi->write_io[i] = in f2fs_fill_super()
3317 f2fs_kmalloc(sbi, in f2fs_fill_super()
3321 if (!sbi->write_io[i]) { in f2fs_fill_super()
3327 init_rwsem(&sbi->write_io[i][j].io_rwsem); in f2fs_fill_super()
3328 sbi->write_io[i][j].sbi = sbi; in f2fs_fill_super()
3329 sbi->write_io[i][j].bio = NULL; in f2fs_fill_super()
3330 spin_lock_init(&sbi->write_io[i][j].io_lock); in f2fs_fill_super()
3331 INIT_LIST_HEAD(&sbi->write_io[i][j].io_list); in f2fs_fill_super()
3335 init_rwsem(&sbi->cp_rwsem); in f2fs_fill_super()
3336 init_rwsem(&sbi->quota_sem); in f2fs_fill_super()
3337 init_waitqueue_head(&sbi->cp_wait); in f2fs_fill_super()
3338 init_sb_info(sbi); in f2fs_fill_super()
3340 err = init_percpu_info(sbi); in f2fs_fill_super()
3344 if (F2FS_IO_ALIGNED(sbi)) { in f2fs_fill_super()
3345 sbi->write_io_dummy = in f2fs_fill_super()
3346 mempool_create_page_pool(2 * (F2FS_IO_SIZE(sbi) - 1), 0); in f2fs_fill_super()
3347 if (!sbi->write_io_dummy) { in f2fs_fill_super()
3354 sbi->meta_inode = f2fs_iget(sb, F2FS_META_INO(sbi)); in f2fs_fill_super()
3355 if (IS_ERR(sbi->meta_inode)) { in f2fs_fill_super()
3356 f2fs_err(sbi, "Failed to read F2FS meta data inode"); in f2fs_fill_super()
3357 err = PTR_ERR(sbi->meta_inode); in f2fs_fill_super()
3361 err = f2fs_get_valid_checkpoint(sbi); in f2fs_fill_super()
3363 f2fs_err(sbi, "Failed to get valid F2FS checkpoint"); in f2fs_fill_super()
3367 if (__is_set_ckpt_flags(F2FS_CKPT(sbi), CP_QUOTA_NEED_FSCK_FLAG)) in f2fs_fill_super()
3368 set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); in f2fs_fill_super()
3369 if (__is_set_ckpt_flags(F2FS_CKPT(sbi), CP_DISABLED_QUICK_FLAG)) { in f2fs_fill_super()
3370 set_sbi_flag(sbi, SBI_CP_DISABLED_QUICK); in f2fs_fill_super()
3371 sbi->interval_time[DISABLE_TIME] = DEF_DISABLE_QUICK_INTERVAL; in f2fs_fill_super()
3374 if (__is_set_ckpt_flags(F2FS_CKPT(sbi), CP_FSCK_FLAG)) in f2fs_fill_super()
3375 set_sbi_flag(sbi, SBI_NEED_FSCK); in f2fs_fill_super()
3378 err = f2fs_scan_devices(sbi); in f2fs_fill_super()
3380 f2fs_err(sbi, "Failed to find devices"); in f2fs_fill_super()
3384 sbi->total_valid_node_count = in f2fs_fill_super()
3385 le32_to_cpu(sbi->ckpt->valid_node_count); in f2fs_fill_super()
3386 percpu_counter_set(&sbi->total_valid_inode_count, in f2fs_fill_super()
3387 le32_to_cpu(sbi->ckpt->valid_inode_count)); in f2fs_fill_super()
3388 sbi->user_block_count = le64_to_cpu(sbi->ckpt->user_block_count); in f2fs_fill_super()
3389 sbi->total_valid_block_count = in f2fs_fill_super()
3390 le64_to_cpu(sbi->ckpt->valid_block_count); in f2fs_fill_super()
3391 sbi->last_valid_block_count = sbi->total_valid_block_count; in f2fs_fill_super()
3392 sbi->reserved_blocks = 0; in f2fs_fill_super()
3393 sbi->current_reserved_blocks = 0; in f2fs_fill_super()
3394 limit_reserve_root(sbi); in f2fs_fill_super()
3397 INIT_LIST_HEAD(&sbi->inode_list[i]); in f2fs_fill_super()
3398 spin_lock_init(&sbi->inode_lock[i]); in f2fs_fill_super()
3400 mutex_init(&sbi->flush_lock); in f2fs_fill_super()
3402 f2fs_init_extent_cache_info(sbi); in f2fs_fill_super()
3404 f2fs_init_ino_entry_info(sbi); in f2fs_fill_super()
3406 f2fs_init_fsync_node_info(sbi); in f2fs_fill_super()
3409 err = f2fs_build_segment_manager(sbi); in f2fs_fill_super()
3411 f2fs_err(sbi, "Failed to initialize F2FS segment manager (%d)", in f2fs_fill_super()
3415 err = f2fs_build_node_manager(sbi); in f2fs_fill_super()
3417 f2fs_err(sbi, "Failed to initialize F2FS node manager (%d)", in f2fs_fill_super()
3424 sbi->sectors_written_start = in f2fs_fill_super()
3429 seg_i = CURSEG_I(sbi, CURSEG_HOT_NODE); in f2fs_fill_super()
3430 if (__exist_node_summaries(sbi)) in f2fs_fill_super()
3431 sbi->kbytes_written = in f2fs_fill_super()
3434 f2fs_build_gc_manager(sbi); in f2fs_fill_super()
3436 err = f2fs_build_stats(sbi); in f2fs_fill_super()
3441 sbi->node_inode = f2fs_iget(sb, F2FS_NODE_INO(sbi)); in f2fs_fill_super()
3442 if (IS_ERR(sbi->node_inode)) { in f2fs_fill_super()
3443 f2fs_err(sbi, "Failed to read node inode"); in f2fs_fill_super()
3444 err = PTR_ERR(sbi->node_inode); in f2fs_fill_super()
3449 root = f2fs_iget(sb, F2FS_ROOT_INO(sbi)); in f2fs_fill_super()
3451 f2fs_err(sbi, "Failed to read root inode"); in f2fs_fill_super()
3468 err = f2fs_register_sysfs(sbi); in f2fs_fill_super()
3474 if (f2fs_sb_has_quota_ino(sbi) && !f2fs_readonly(sb)) { in f2fs_fill_super()
3477 f2fs_err(sbi, "Cannot turn on quotas: error %d", err); in f2fs_fill_super()
3481 err = f2fs_recover_orphan_inodes(sbi); in f2fs_fill_super()
3485 if (unlikely(is_set_ckpt_flags(sbi, CP_DISABLED_FLAG))) in f2fs_fill_super()
3489 if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) { in f2fs_fill_super()
3494 if (f2fs_hw_is_readonly(sbi)) { in f2fs_fill_super()
3495 if (!is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) { in f2fs_fill_super()
3497 f2fs_err(sbi, "Need to recover fsync data, but write access unavailable"); in f2fs_fill_super()
3500 f2fs_info(sbi, "write access unavailable, skipping recovery"); in f2fs_fill_super()
3505 set_sbi_flag(sbi, SBI_NEED_FSCK); in f2fs_fill_super()
3510 err = f2fs_recover_fsync_data(sbi, false); in f2fs_fill_super()
3515 f2fs_err(sbi, "Cannot recover all fsync data errno=%d", in f2fs_fill_super()
3520 err = f2fs_recover_fsync_data(sbi, true); in f2fs_fill_super()
3524 f2fs_err(sbi, "Need to recover fsync data"); in f2fs_fill_super()
3530 clear_sbi_flag(sbi, SBI_POR_DOING); in f2fs_fill_super()
3532 if (test_opt(sbi, DISABLE_CHECKPOINT)) { in f2fs_fill_super()
3533 err = f2fs_disable_checkpoint(sbi); in f2fs_fill_super()
3536 } else if (is_set_ckpt_flags(sbi, CP_DISABLED_FLAG)) { in f2fs_fill_super()
3537 f2fs_enable_checkpoint(sbi); in f2fs_fill_super()
3544 if (test_opt(sbi, BG_GC) && !f2fs_readonly(sb)) { in f2fs_fill_super()
3546 err = f2fs_start_gc_thread(sbi); in f2fs_fill_super()
3554 err = f2fs_commit_super(sbi, true); in f2fs_fill_super()
3555 f2fs_info(sbi, "Try to recover %dth superblock, ret: %d", in f2fs_fill_super()
3556 sbi->valid_super_block ? 1 : 2, err); in f2fs_fill_super()
3559 f2fs_join_shrinker(sbi); in f2fs_fill_super()
3561 f2fs_tuning_parameters(sbi); in f2fs_fill_super()
3563 f2fs_notice(sbi, "Mounted with checkpoint version = %llx", in f2fs_fill_super()
3564 cur_cp_version(F2FS_CKPT(sbi))); in f2fs_fill_super()
3565 f2fs_update_time(sbi, CP_TIME); in f2fs_fill_super()
3566 f2fs_update_time(sbi, REQ_TIME); in f2fs_fill_super()
3567 clear_sbi_flag(sbi, SBI_CP_DISABLED_QUICK); in f2fs_fill_super()
3572 sync_filesystem(sbi->sb); in f2fs_fill_super()
3578 if (f2fs_sb_has_quota_ino(sbi) && !f2fs_readonly(sb)) in f2fs_fill_super()
3579 f2fs_quota_off_umount(sbi->sb); in f2fs_fill_super()
3587 truncate_inode_pages_final(META_MAPPING(sbi)); in f2fs_fill_super()
3590 f2fs_unregister_sysfs(sbi); in f2fs_fill_super()
3595 f2fs_release_ino_entry(sbi, true); in f2fs_fill_super()
3596 truncate_inode_pages_final(NODE_MAPPING(sbi)); in f2fs_fill_super()
3597 iput(sbi->node_inode); in f2fs_fill_super()
3598 sbi->node_inode = NULL; in f2fs_fill_super()
3600 f2fs_destroy_stats(sbi); in f2fs_fill_super()
3602 f2fs_destroy_node_manager(sbi); in f2fs_fill_super()
3604 f2fs_destroy_segment_manager(sbi); in f2fs_fill_super()
3606 destroy_device_list(sbi); in f2fs_fill_super()
3607 kvfree(sbi->ckpt); in f2fs_fill_super()
3609 make_bad_inode(sbi->meta_inode); in f2fs_fill_super()
3610 iput(sbi->meta_inode); in f2fs_fill_super()
3611 sbi->meta_inode = NULL; in f2fs_fill_super()
3613 mempool_destroy(sbi->write_io_dummy); in f2fs_fill_super()
3615 destroy_percpu_info(sbi); in f2fs_fill_super()
3618 kvfree(sbi->write_io[i]); in f2fs_fill_super()
3621 utf8_unload(sbi->s_encoding); in f2fs_fill_super()
3626 kvfree(F2FS_OPTION(sbi).s_qf_names[i]); in f2fs_fill_super()
3632 if (sbi->s_chksum_driver) in f2fs_fill_super()
3633 crypto_free_shash(sbi->s_chksum_driver); in f2fs_fill_super()
3634 kvfree(sbi); in f2fs_fill_super()
3654 struct f2fs_sb_info *sbi = F2FS_SB(sb); in kill_f2fs_super() local
3656 set_sbi_flag(sbi, SBI_IS_CLOSE); in kill_f2fs_super()
3657 f2fs_stop_gc_thread(sbi); in kill_f2fs_super()
3658 f2fs_stop_discard_thread(sbi); in kill_f2fs_super()
3660 if (is_sbi_flag_set(sbi, SBI_IS_DIRTY) || in kill_f2fs_super()
3661 !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) { in kill_f2fs_super()
3665 f2fs_write_checkpoint(sbi, &cpc); in kill_f2fs_super()
3668 if (is_sbi_flag_set(sbi, SBI_IS_RECOVERED) && f2fs_readonly(sb)) in kill_f2fs_super()