super.c (d440c52d3151a28358f4c2d52d8583a0aa54ab83) | super.c (4354994f097d068a894aa1a0860da54571df3582) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * fs/f2fs/super.c 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8#include <linux/module.h> --- 122 unchanged lines hidden (view full) --- 131 Opt_offprjjquota, 132 Opt_jqfmt_vfsold, 133 Opt_jqfmt_vfsv0, 134 Opt_jqfmt_vfsv1, 135 Opt_whint, 136 Opt_alloc, 137 Opt_fsync, 138 Opt_test_dummy_encryption, | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * fs/f2fs/super.c 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8#include <linux/module.h> --- 122 unchanged lines hidden (view full) --- 131 Opt_offprjjquota, 132 Opt_jqfmt_vfsold, 133 Opt_jqfmt_vfsv0, 134 Opt_jqfmt_vfsv1, 135 Opt_whint, 136 Opt_alloc, 137 Opt_fsync, 138 Opt_test_dummy_encryption, |
139 Opt_checkpoint, |
|
139 Opt_err, 140}; 141 142static match_table_t f2fs_tokens = { 143 {Opt_gc_background, "background_gc=%s"}, 144 {Opt_disable_roll_forward, "disable_roll_forward"}, 145 {Opt_norecovery, "norecovery"}, 146 {Opt_discard, "discard"}, --- 42 unchanged lines hidden (view full) --- 189 {Opt_offprjjquota, "prjjquota="}, 190 {Opt_jqfmt_vfsold, "jqfmt=vfsold"}, 191 {Opt_jqfmt_vfsv0, "jqfmt=vfsv0"}, 192 {Opt_jqfmt_vfsv1, "jqfmt=vfsv1"}, 193 {Opt_whint, "whint_mode=%s"}, 194 {Opt_alloc, "alloc_mode=%s"}, 195 {Opt_fsync, "fsync_mode=%s"}, 196 {Opt_test_dummy_encryption, "test_dummy_encryption"}, | 140 Opt_err, 141}; 142 143static match_table_t f2fs_tokens = { 144 {Opt_gc_background, "background_gc=%s"}, 145 {Opt_disable_roll_forward, "disable_roll_forward"}, 146 {Opt_norecovery, "norecovery"}, 147 {Opt_discard, "discard"}, --- 42 unchanged lines hidden (view full) --- 190 {Opt_offprjjquota, "prjjquota="}, 191 {Opt_jqfmt_vfsold, "jqfmt=vfsold"}, 192 {Opt_jqfmt_vfsv0, "jqfmt=vfsv0"}, 193 {Opt_jqfmt_vfsv1, "jqfmt=vfsv1"}, 194 {Opt_whint, "whint_mode=%s"}, 195 {Opt_alloc, "alloc_mode=%s"}, 196 {Opt_fsync, "fsync_mode=%s"}, 197 {Opt_test_dummy_encryption, "test_dummy_encryption"}, |
198 {Opt_checkpoint, "checkpoint=%s"}, |
|
197 {Opt_err, NULL}, 198}; 199 200void f2fs_msg(struct super_block *sb, const char *level, const char *fmt, ...) 201{ 202 struct va_format vaf; 203 va_list args; 204 --- 559 unchanged lines hidden (view full) --- 764 F2FS_OPTION(sbi).test_dummy_encryption = true; 765 f2fs_msg(sb, KERN_INFO, 766 "Test dummy encryption mode enabled"); 767#else 768 f2fs_msg(sb, KERN_INFO, 769 "Test dummy encryption mount option ignored"); 770#endif 771 break; | 199 {Opt_err, NULL}, 200}; 201 202void f2fs_msg(struct super_block *sb, const char *level, const char *fmt, ...) 203{ 204 struct va_format vaf; 205 va_list args; 206 --- 559 unchanged lines hidden (view full) --- 766 F2FS_OPTION(sbi).test_dummy_encryption = true; 767 f2fs_msg(sb, KERN_INFO, 768 "Test dummy encryption mode enabled"); 769#else 770 f2fs_msg(sb, KERN_INFO, 771 "Test dummy encryption mount option ignored"); 772#endif 773 break; |
774 case Opt_checkpoint: 775 name = match_strdup(&args[0]); 776 if (!name) 777 return -ENOMEM; 778 779 if (strlen(name) == 6 && 780 !strncmp(name, "enable", 6)) { 781 clear_opt(sbi, DISABLE_CHECKPOINT); 782 } else if (strlen(name) == 7 && 783 !strncmp(name, "disable", 7)) { 784 set_opt(sbi, DISABLE_CHECKPOINT); 785 } else { 786 kfree(name); 787 return -EINVAL; 788 } 789 kfree(name); 790 break; |
|
772 default: 773 f2fs_msg(sb, KERN_ERR, 774 "Unrecognized mount option \"%s\" or missing value", 775 p); 776 return -EINVAL; 777 } 778 } 779#ifdef CONFIG_QUOTA --- 42 unchanged lines hidden (view full) --- 822 DEF_INLINE_RESERVED_SIZE - 823 DEF_MIN_INLINE_SIZE) { 824 f2fs_msg(sb, KERN_ERR, 825 "inline xattr size is out of range"); 826 return -EINVAL; 827 } 828 } 829 | 791 default: 792 f2fs_msg(sb, KERN_ERR, 793 "Unrecognized mount option \"%s\" or missing value", 794 p); 795 return -EINVAL; 796 } 797 } 798#ifdef CONFIG_QUOTA --- 42 unchanged lines hidden (view full) --- 841 DEF_INLINE_RESERVED_SIZE - 842 DEF_MIN_INLINE_SIZE) { 843 f2fs_msg(sb, KERN_ERR, 844 "inline xattr size is out of range"); 845 return -EINVAL; 846 } 847 } 848 |
849 if (test_opt(sbi, DISABLE_CHECKPOINT) && test_opt(sbi, LFS)) { 850 f2fs_msg(sb, KERN_ERR, 851 "LFS not compatible with checkpoint=disable\n"); 852 return -EINVAL; 853 } 854 |
|
830 /* Not pass down write hints if the number of active logs is lesser 831 * than NR_CURSEG_TYPE. 832 */ 833 if (F2FS_OPTION(sbi).active_logs != NR_CURSEG_TYPE) 834 F2FS_OPTION(sbi).whint_mode = WHINT_MODE_OFF; 835 return 0; 836} 837 --- 171 unchanged lines hidden (view full) --- 1009 /* prevent remaining shrinker jobs */ 1010 mutex_lock(&sbi->umount_mutex); 1011 1012 /* 1013 * We don't need to do checkpoint when superblock is clean. 1014 * But, the previous checkpoint was not done by umount, it needs to do 1015 * clean checkpoint again. 1016 */ | 855 /* Not pass down write hints if the number of active logs is lesser 856 * than NR_CURSEG_TYPE. 857 */ 858 if (F2FS_OPTION(sbi).active_logs != NR_CURSEG_TYPE) 859 F2FS_OPTION(sbi).whint_mode = WHINT_MODE_OFF; 860 return 0; 861} 862 --- 171 unchanged lines hidden (view full) --- 1034 /* prevent remaining shrinker jobs */ 1035 mutex_lock(&sbi->umount_mutex); 1036 1037 /* 1038 * We don't need to do checkpoint when superblock is clean. 1039 * But, the previous checkpoint was not done by umount, it needs to do 1040 * clean checkpoint again. 1041 */ |
1017 if (is_sbi_flag_set(sbi, SBI_IS_DIRTY) || 1018 !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) { | 1042 if ((is_sbi_flag_set(sbi, SBI_IS_DIRTY) || 1043 !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG))) { |
1019 struct cp_control cpc = { 1020 .reason = CP_UMOUNT, 1021 }; 1022 f2fs_write_checkpoint(sbi, &cpc); 1023 } 1024 1025 /* be sure to wait for any on-going discard commands */ 1026 dropped = f2fs_wait_discard_bios(sbi); --- 55 unchanged lines hidden (view full) --- 1082 1083int f2fs_sync_fs(struct super_block *sb, int sync) 1084{ 1085 struct f2fs_sb_info *sbi = F2FS_SB(sb); 1086 int err = 0; 1087 1088 if (unlikely(f2fs_cp_error(sbi))) 1089 return 0; | 1044 struct cp_control cpc = { 1045 .reason = CP_UMOUNT, 1046 }; 1047 f2fs_write_checkpoint(sbi, &cpc); 1048 } 1049 1050 /* be sure to wait for any on-going discard commands */ 1051 dropped = f2fs_wait_discard_bios(sbi); --- 55 unchanged lines hidden (view full) --- 1107 1108int f2fs_sync_fs(struct super_block *sb, int sync) 1109{ 1110 struct f2fs_sb_info *sbi = F2FS_SB(sb); 1111 int err = 0; 1112 1113 if (unlikely(f2fs_cp_error(sbi))) 1114 return 0; |
1115 if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) 1116 return 0; |
|
1090 1091 trace_f2fs_sync_fs(sb, sync); 1092 1093 if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING))) 1094 return -EAGAIN; 1095 1096 if (sync) { 1097 struct cp_control cpc; --- 83 unchanged lines hidden (view full) --- 1181 user_block_count = sbi->user_block_count; 1182 start_count = le32_to_cpu(sbi->raw_super->segment0_blkaddr); 1183 buf->f_type = F2FS_SUPER_MAGIC; 1184 buf->f_bsize = sbi->blocksize; 1185 1186 buf->f_blocks = total_count - start_count; 1187 buf->f_bfree = user_block_count - valid_user_blocks(sbi) - 1188 sbi->current_reserved_blocks; | 1117 1118 trace_f2fs_sync_fs(sb, sync); 1119 1120 if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING))) 1121 return -EAGAIN; 1122 1123 if (sync) { 1124 struct cp_control cpc; --- 83 unchanged lines hidden (view full) --- 1208 user_block_count = sbi->user_block_count; 1209 start_count = le32_to_cpu(sbi->raw_super->segment0_blkaddr); 1210 buf->f_type = F2FS_SUPER_MAGIC; 1211 buf->f_bsize = sbi->blocksize; 1212 1213 buf->f_blocks = total_count - start_count; 1214 buf->f_bfree = user_block_count - valid_user_blocks(sbi) - 1215 sbi->current_reserved_blocks; |
1216 if (unlikely(buf->f_bfree <= sbi->unusable_block_count)) 1217 buf->f_bfree = 0; 1218 else 1219 buf->f_bfree -= sbi->unusable_block_count; 1220 |
|
1189 if (buf->f_bfree > F2FS_OPTION(sbi).root_reserved_blocks) 1190 buf->f_bavail = buf->f_bfree - 1191 F2FS_OPTION(sbi).root_reserved_blocks; 1192 else 1193 buf->f_bavail = 0; 1194 1195 avail_node_count = sbi->total_node_count - sbi->nquota_files - 1196 F2FS_RESERVED_NODE_NUM; --- 163 unchanged lines hidden (view full) --- 1360 seq_puts(seq, ",test_dummy_encryption"); 1361#endif 1362 1363 if (F2FS_OPTION(sbi).alloc_mode == ALLOC_MODE_DEFAULT) 1364 seq_printf(seq, ",alloc_mode=%s", "default"); 1365 else if (F2FS_OPTION(sbi).alloc_mode == ALLOC_MODE_REUSE) 1366 seq_printf(seq, ",alloc_mode=%s", "reuse"); 1367 | 1221 if (buf->f_bfree > F2FS_OPTION(sbi).root_reserved_blocks) 1222 buf->f_bavail = buf->f_bfree - 1223 F2FS_OPTION(sbi).root_reserved_blocks; 1224 else 1225 buf->f_bavail = 0; 1226 1227 avail_node_count = sbi->total_node_count - sbi->nquota_files - 1228 F2FS_RESERVED_NODE_NUM; --- 163 unchanged lines hidden (view full) --- 1392 seq_puts(seq, ",test_dummy_encryption"); 1393#endif 1394 1395 if (F2FS_OPTION(sbi).alloc_mode == ALLOC_MODE_DEFAULT) 1396 seq_printf(seq, ",alloc_mode=%s", "default"); 1397 else if (F2FS_OPTION(sbi).alloc_mode == ALLOC_MODE_REUSE) 1398 seq_printf(seq, ",alloc_mode=%s", "reuse"); 1399 |
1400 if (test_opt(sbi, DISABLE_CHECKPOINT)) 1401 seq_puts(seq, ",checkpoint=disable"); 1402 |
|
1368 if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_POSIX) 1369 seq_printf(seq, ",fsync_mode=%s", "posix"); 1370 else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT) 1371 seq_printf(seq, ",fsync_mode=%s", "strict"); 1372 else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_NOBARRIER) 1373 seq_printf(seq, ",fsync_mode=%s", "nobarrier"); 1374 return 0; 1375} --- 11 unchanged lines hidden (view full) --- 1387 F2FS_OPTION(sbi).s_resgid = make_kgid(&init_user_ns, F2FS_DEF_RESGID); 1388 1389 set_opt(sbi, BG_GC); 1390 set_opt(sbi, INLINE_XATTR); 1391 set_opt(sbi, INLINE_DATA); 1392 set_opt(sbi, INLINE_DENTRY); 1393 set_opt(sbi, EXTENT_CACHE); 1394 set_opt(sbi, NOHEAP); | 1403 if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_POSIX) 1404 seq_printf(seq, ",fsync_mode=%s", "posix"); 1405 else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT) 1406 seq_printf(seq, ",fsync_mode=%s", "strict"); 1407 else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_NOBARRIER) 1408 seq_printf(seq, ",fsync_mode=%s", "nobarrier"); 1409 return 0; 1410} --- 11 unchanged lines hidden (view full) --- 1422 F2FS_OPTION(sbi).s_resgid = make_kgid(&init_user_ns, F2FS_DEF_RESGID); 1423 1424 set_opt(sbi, BG_GC); 1425 set_opt(sbi, INLINE_XATTR); 1426 set_opt(sbi, INLINE_DATA); 1427 set_opt(sbi, INLINE_DENTRY); 1428 set_opt(sbi, EXTENT_CACHE); 1429 set_opt(sbi, NOHEAP); |
1430 clear_opt(sbi, DISABLE_CHECKPOINT); |
|
1395 sbi->sb->s_flags |= SB_LAZYTIME; 1396 set_opt(sbi, FLUSH_MERGE); 1397 set_opt(sbi, DISCARD); 1398 if (f2fs_sb_has_blkzoned(sbi->sb)) 1399 set_opt_mode(sbi, F2FS_MOUNT_LFS); 1400 else 1401 set_opt_mode(sbi, F2FS_MOUNT_ADAPTIVE); 1402 --- 5 unchanged lines hidden (view full) --- 1408#endif 1409 1410 f2fs_build_fault_attr(sbi, 0, 0); 1411} 1412 1413#ifdef CONFIG_QUOTA 1414static int f2fs_enable_quotas(struct super_block *sb); 1415#endif | 1431 sbi->sb->s_flags |= SB_LAZYTIME; 1432 set_opt(sbi, FLUSH_MERGE); 1433 set_opt(sbi, DISCARD); 1434 if (f2fs_sb_has_blkzoned(sbi->sb)) 1435 set_opt_mode(sbi, F2FS_MOUNT_LFS); 1436 else 1437 set_opt_mode(sbi, F2FS_MOUNT_ADAPTIVE); 1438 --- 5 unchanged lines hidden (view full) --- 1444#endif 1445 1446 f2fs_build_fault_attr(sbi, 0, 0); 1447} 1448 1449#ifdef CONFIG_QUOTA 1450static int f2fs_enable_quotas(struct super_block *sb); 1451#endif |
1452 1453static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi) 1454{ 1455 struct cp_control cpc; 1456 int err; 1457 1458 sbi->sb->s_flags |= SB_ACTIVE; 1459 1460 mutex_lock(&sbi->gc_mutex); 1461 f2fs_update_time(sbi, DISABLE_TIME); 1462 1463 while (!f2fs_time_over(sbi, DISABLE_TIME)) { 1464 err = f2fs_gc(sbi, true, false, NULL_SEGNO); 1465 if (err == -ENODATA) 1466 break; 1467 if (err && err != -EAGAIN) { 1468 mutex_unlock(&sbi->gc_mutex); 1469 return err; 1470 } 1471 } 1472 mutex_unlock(&sbi->gc_mutex); 1473 1474 err = sync_filesystem(sbi->sb); 1475 if (err) 1476 return err; 1477 1478 if (f2fs_disable_cp_again(sbi)) 1479 return -EAGAIN; 1480 1481 mutex_lock(&sbi->gc_mutex); 1482 cpc.reason = CP_PAUSE; 1483 set_sbi_flag(sbi, SBI_CP_DISABLED); 1484 f2fs_write_checkpoint(sbi, &cpc); 1485 1486 sbi->unusable_block_count = 0; 1487 mutex_unlock(&sbi->gc_mutex); 1488 return 0; 1489} 1490 1491static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi) 1492{ 1493 mutex_lock(&sbi->gc_mutex); 1494 f2fs_dirty_to_prefree(sbi); 1495 1496 clear_sbi_flag(sbi, SBI_CP_DISABLED); 1497 set_sbi_flag(sbi, SBI_IS_DIRTY); 1498 mutex_unlock(&sbi->gc_mutex); 1499 1500 f2fs_sync_fs(sbi->sb, 1); 1501} 1502 |
|
1416static int f2fs_remount(struct super_block *sb, int *flags, char *data) 1417{ 1418 struct f2fs_sb_info *sbi = F2FS_SB(sb); 1419 struct f2fs_mount_info org_mount_opt; 1420 unsigned long old_sb_flags; 1421 int err; 1422 bool need_restart_gc = false; 1423 bool need_stop_gc = false; 1424 bool no_extent_cache = !test_opt(sbi, EXTENT_CACHE); | 1503static int f2fs_remount(struct super_block *sb, int *flags, char *data) 1504{ 1505 struct f2fs_sb_info *sbi = F2FS_SB(sb); 1506 struct f2fs_mount_info org_mount_opt; 1507 unsigned long old_sb_flags; 1508 int err; 1509 bool need_restart_gc = false; 1510 bool need_stop_gc = false; 1511 bool no_extent_cache = !test_opt(sbi, EXTENT_CACHE); |
1512 bool disable_checkpoint = test_opt(sbi, DISABLE_CHECKPOINT); 1513 bool checkpoint_changed; |
|
1425#ifdef CONFIG_QUOTA 1426 int i, j; 1427#endif 1428 1429 /* 1430 * Save the old mount options in case we 1431 * need to restore them. 1432 */ --- 28 unchanged lines hidden (view full) --- 1461 } 1462 1463 default_options(sbi); 1464 1465 /* parse mount options */ 1466 err = parse_options(sb, data); 1467 if (err) 1468 goto restore_opts; | 1514#ifdef CONFIG_QUOTA 1515 int i, j; 1516#endif 1517 1518 /* 1519 * Save the old mount options in case we 1520 * need to restore them. 1521 */ --- 28 unchanged lines hidden (view full) --- 1550 } 1551 1552 default_options(sbi); 1553 1554 /* parse mount options */ 1555 err = parse_options(sb, data); 1556 if (err) 1557 goto restore_opts; |
1558 checkpoint_changed = 1559 disable_checkpoint != test_opt(sbi, DISABLE_CHECKPOINT); |
|
1469 1470 /* 1471 * Previous and new state of filesystem is RO, 1472 * so skip checking GC and FLUSH_MERGE conditions. 1473 */ 1474 if (f2fs_readonly(sb) && (*flags & SB_RDONLY)) 1475 goto skip; 1476 1477#ifdef CONFIG_QUOTA 1478 if (!f2fs_readonly(sb) && (*flags & SB_RDONLY)) { 1479 err = dquot_suspend(sb, -1); 1480 if (err < 0) 1481 goto restore_opts; | 1560 1561 /* 1562 * Previous and new state of filesystem is RO, 1563 * so skip checking GC and FLUSH_MERGE conditions. 1564 */ 1565 if (f2fs_readonly(sb) && (*flags & SB_RDONLY)) 1566 goto skip; 1567 1568#ifdef CONFIG_QUOTA 1569 if (!f2fs_readonly(sb) && (*flags & SB_RDONLY)) { 1570 err = dquot_suspend(sb, -1); 1571 if (err < 0) 1572 goto restore_opts; |
1482 } else if (f2fs_readonly(sb) && !(*flags & MS_RDONLY)) { | 1573 } else if (f2fs_readonly(sb) && !(*flags & SB_RDONLY)) { |
1483 /* dquot_resume needs RW */ 1484 sb->s_flags &= ~SB_RDONLY; 1485 if (sb_any_quota_suspended(sb)) { 1486 dquot_resume(sb, -1); 1487 } else if (f2fs_sb_has_quota_ino(sb)) { 1488 err = f2fs_enable_quotas(sb); 1489 if (err) 1490 goto restore_opts; 1491 } 1492 } 1493#endif 1494 /* disallow enable/disable extent_cache dynamically */ 1495 if (no_extent_cache == !!test_opt(sbi, EXTENT_CACHE)) { 1496 err = -EINVAL; 1497 f2fs_msg(sbi->sb, KERN_WARNING, 1498 "switch extent_cache option is not allowed"); 1499 goto restore_opts; 1500 } 1501 | 1574 /* dquot_resume needs RW */ 1575 sb->s_flags &= ~SB_RDONLY; 1576 if (sb_any_quota_suspended(sb)) { 1577 dquot_resume(sb, -1); 1578 } else if (f2fs_sb_has_quota_ino(sb)) { 1579 err = f2fs_enable_quotas(sb); 1580 if (err) 1581 goto restore_opts; 1582 } 1583 } 1584#endif 1585 /* disallow enable/disable extent_cache dynamically */ 1586 if (no_extent_cache == !!test_opt(sbi, EXTENT_CACHE)) { 1587 err = -EINVAL; 1588 f2fs_msg(sbi->sb, KERN_WARNING, 1589 "switch extent_cache option is not allowed"); 1590 goto restore_opts; 1591 } 1592 |
1593 if ((*flags & SB_RDONLY) && test_opt(sbi, DISABLE_CHECKPOINT)) { 1594 err = -EINVAL; 1595 f2fs_msg(sbi->sb, KERN_WARNING, 1596 "disabling checkpoint not compatible with read-only"); 1597 goto restore_opts; 1598 } 1599 |
|
1502 /* 1503 * We stop the GC thread if FS is mounted as RO 1504 * or if background_gc = off is passed in mount 1505 * option. Also sync the filesystem. 1506 */ 1507 if ((*flags & SB_RDONLY) || !test_opt(sbi, BG_GC)) { 1508 if (sbi->gc_thread) { 1509 f2fs_stop_gc_thread(sbi); --- 12 unchanged lines hidden (view full) --- 1522 sync_inodes_sb(sb); 1523 1524 set_sbi_flag(sbi, SBI_IS_DIRTY); 1525 set_sbi_flag(sbi, SBI_IS_CLOSE); 1526 f2fs_sync_fs(sb, 1); 1527 clear_sbi_flag(sbi, SBI_IS_CLOSE); 1528 } 1529 | 1600 /* 1601 * We stop the GC thread if FS is mounted as RO 1602 * or if background_gc = off is passed in mount 1603 * option. Also sync the filesystem. 1604 */ 1605 if ((*flags & SB_RDONLY) || !test_opt(sbi, BG_GC)) { 1606 if (sbi->gc_thread) { 1607 f2fs_stop_gc_thread(sbi); --- 12 unchanged lines hidden (view full) --- 1620 sync_inodes_sb(sb); 1621 1622 set_sbi_flag(sbi, SBI_IS_DIRTY); 1623 set_sbi_flag(sbi, SBI_IS_CLOSE); 1624 f2fs_sync_fs(sb, 1); 1625 clear_sbi_flag(sbi, SBI_IS_CLOSE); 1626 } 1627 |
1628 if (checkpoint_changed) { 1629 if (test_opt(sbi, DISABLE_CHECKPOINT)) { 1630 err = f2fs_disable_checkpoint(sbi); 1631 if (err) 1632 goto restore_gc; 1633 } else { 1634 f2fs_enable_checkpoint(sbi); 1635 } 1636 } 1637 |
|
1530 /* 1531 * We stop issue flush thread if FS is mounted as RO 1532 * or if flush_merge is not passed in mount option. 1533 */ 1534 if ((*flags & SB_RDONLY) || !test_opt(sbi, FLUSH_MERGE)) { 1535 clear_opt(sbi, FLUSH_MERGE); 1536 f2fs_destroy_flush_cmd_control(sbi, false); 1537 } else { --- 942 unchanged lines hidden (view full) --- 2480 sbi->cur_victim_sec = NULL_SECNO; 2481 sbi->max_victim_search = DEF_MAX_VICTIM_SEARCH; 2482 2483 sbi->dir_level = DEF_DIR_LEVEL; 2484 sbi->interval_time[CP_TIME] = DEF_CP_INTERVAL; 2485 sbi->interval_time[REQ_TIME] = DEF_IDLE_INTERVAL; 2486 sbi->interval_time[DISCARD_TIME] = DEF_IDLE_INTERVAL; 2487 sbi->interval_time[GC_TIME] = DEF_IDLE_INTERVAL; | 1638 /* 1639 * We stop issue flush thread if FS is mounted as RO 1640 * or if flush_merge is not passed in mount option. 1641 */ 1642 if ((*flags & SB_RDONLY) || !test_opt(sbi, FLUSH_MERGE)) { 1643 clear_opt(sbi, FLUSH_MERGE); 1644 f2fs_destroy_flush_cmd_control(sbi, false); 1645 } else { --- 942 unchanged lines hidden (view full) --- 2588 sbi->cur_victim_sec = NULL_SECNO; 2589 sbi->max_victim_search = DEF_MAX_VICTIM_SEARCH; 2590 2591 sbi->dir_level = DEF_DIR_LEVEL; 2592 sbi->interval_time[CP_TIME] = DEF_CP_INTERVAL; 2593 sbi->interval_time[REQ_TIME] = DEF_IDLE_INTERVAL; 2594 sbi->interval_time[DISCARD_TIME] = DEF_IDLE_INTERVAL; 2595 sbi->interval_time[GC_TIME] = DEF_IDLE_INTERVAL; |
2596 sbi->interval_time[DISABLE_TIME] = DEF_DISABLE_INTERVAL; |
|
2488 clear_sbi_flag(sbi, SBI_NEED_FSCK); 2489 2490 for (i = 0; i < NR_COUNT_TYPE; i++) 2491 atomic_set(&sbi->nr_pages[i], 0); 2492 2493 for (i = 0; i < META; i++) 2494 atomic_set(&sbi->wb_sync_req[i], 0); 2495 --- 592 unchanged lines hidden (view full) --- 3088 } 3089 } 3090#endif 3091 /* if there are nt orphan nodes free them */ 3092 err = f2fs_recover_orphan_inodes(sbi); 3093 if (err) 3094 goto free_meta; 3095 | 2597 clear_sbi_flag(sbi, SBI_NEED_FSCK); 2598 2599 for (i = 0; i < NR_COUNT_TYPE; i++) 2600 atomic_set(&sbi->nr_pages[i], 0); 2601 2602 for (i = 0; i < META; i++) 2603 atomic_set(&sbi->wb_sync_req[i], 0); 2604 --- 592 unchanged lines hidden (view full) --- 3197 } 3198 } 3199#endif 3200 /* if there are nt orphan nodes free them */ 3201 err = f2fs_recover_orphan_inodes(sbi); 3202 if (err) 3203 goto free_meta; 3204 |
3205 if (unlikely(is_set_ckpt_flags(sbi, CP_DISABLED_FLAG))) 3206 goto skip_recovery; 3207 |
|
3096 /* recover fsynced data */ 3097 if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) { 3098 /* 3099 * mount should be failed, when device has readonly mode, and 3100 * previous checkpoint was not done by clean system shutdown. 3101 */ 3102 if (bdev_read_only(sb->s_bdev) && 3103 !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) { --- 23 unchanged lines hidden (view full) --- 3127 "Need to recover fsync data"); 3128 goto free_meta; 3129 } 3130 } 3131skip_recovery: 3132 /* f2fs_recover_fsync_data() cleared this already */ 3133 clear_sbi_flag(sbi, SBI_POR_DOING); 3134 | 3208 /* recover fsynced data */ 3209 if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) { 3210 /* 3211 * mount should be failed, when device has readonly mode, and 3212 * previous checkpoint was not done by clean system shutdown. 3213 */ 3214 if (bdev_read_only(sb->s_bdev) && 3215 !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) { --- 23 unchanged lines hidden (view full) --- 3239 "Need to recover fsync data"); 3240 goto free_meta; 3241 } 3242 } 3243skip_recovery: 3244 /* f2fs_recover_fsync_data() cleared this already */ 3245 clear_sbi_flag(sbi, SBI_POR_DOING); 3246 |
3247 if (test_opt(sbi, DISABLE_CHECKPOINT)) { 3248 err = f2fs_disable_checkpoint(sbi); 3249 if (err) 3250 goto free_meta; 3251 } else if (is_set_ckpt_flags(sbi, CP_DISABLED_FLAG)) { 3252 f2fs_enable_checkpoint(sbi); 3253 } 3254 |
|
3135 /* 3136 * If filesystem is not mounted as read-only then 3137 * do start the gc_thread. 3138 */ 3139 if (test_opt(sbi, BG_GC) && !f2fs_readonly(sb)) { 3140 /* After POR, we can run background GC thread.*/ 3141 err = f2fs_start_gc_thread(sbi); 3142 if (err) --- 233 unchanged lines hidden --- | 3255 /* 3256 * If filesystem is not mounted as read-only then 3257 * do start the gc_thread. 3258 */ 3259 if (test_opt(sbi, BG_GC) && !f2fs_readonly(sb)) { 3260 /* After POR, we can run background GC thread.*/ 3261 err = f2fs_start_gc_thread(sbi); 3262 if (err) --- 233 unchanged lines hidden --- |