checkpoint.c (bab475c5414e8d1fa182fd17ae966864e9c85741) | checkpoint.c (4354994f097d068a894aa1a0860da54571df3582) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * fs/f2fs/checkpoint.c 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8#include <linux/fs.h> --- 1196 unchanged lines hidden (view full) --- 1205 if (orphan_num) 1206 __set_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG); 1207 else 1208 __clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG); 1209 1210 if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) 1211 __set_ckpt_flags(ckpt, CP_FSCK_FLAG); 1212 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * fs/f2fs/checkpoint.c 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8#include <linux/fs.h> --- 1196 unchanged lines hidden (view full) --- 1205 if (orphan_num) 1206 __set_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG); 1207 else 1208 __clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG); 1209 1210 if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) 1211 __set_ckpt_flags(ckpt, CP_FSCK_FLAG); 1212 |
1213 if (is_sbi_flag_set(sbi, SBI_CP_DISABLED)) 1214 __set_ckpt_flags(ckpt, CP_DISABLED_FLAG); 1215 else 1216 __clear_ckpt_flags(ckpt, CP_DISABLED_FLAG); 1217 |
|
1213 /* set this flag to activate crc|cp_ver for recovery */ 1214 __set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG); 1215 __clear_ckpt_flags(ckpt, CP_NOCRC_RECOVERY_FLAG); 1216 1217 spin_unlock_irqrestore(&sbi->cp_lock, flags); 1218} 1219 1220static void commit_checkpoint(struct f2fs_sb_info *sbi, --- 191 unchanged lines hidden (view full) --- 1412 MAIN_BLKADDR(sbi), MAX_BLKADDR(sbi) - 1); 1413 1414 f2fs_release_ino_entry(sbi, false); 1415 1416 f2fs_reset_fsync_node_info(sbi); 1417 1418 clear_sbi_flag(sbi, SBI_IS_DIRTY); 1419 clear_sbi_flag(sbi, SBI_NEED_CP); | 1218 /* set this flag to activate crc|cp_ver for recovery */ 1219 __set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG); 1220 __clear_ckpt_flags(ckpt, CP_NOCRC_RECOVERY_FLAG); 1221 1222 spin_unlock_irqrestore(&sbi->cp_lock, flags); 1223} 1224 1225static void commit_checkpoint(struct f2fs_sb_info *sbi, --- 191 unchanged lines hidden (view full) --- 1417 MAIN_BLKADDR(sbi), MAX_BLKADDR(sbi) - 1); 1418 1419 f2fs_release_ino_entry(sbi, false); 1420 1421 f2fs_reset_fsync_node_info(sbi); 1422 1423 clear_sbi_flag(sbi, SBI_IS_DIRTY); 1424 clear_sbi_flag(sbi, SBI_NEED_CP); |
1425 sbi->unusable_block_count = 0; |
|
1420 __set_cp_next_pack(sbi); 1421 1422 /* 1423 * redirty superblock if metadata like node page or inode cache is 1424 * updated during writing checkpoint. 1425 */ 1426 if (get_pages(sbi, F2FS_DIRTY_NODES) || 1427 get_pages(sbi, F2FS_DIRTY_IMETA)) --- 8 unchanged lines hidden (view full) --- 1436 * We guarantee that this checkpoint procedure will not fail. 1437 */ 1438int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) 1439{ 1440 struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); 1441 unsigned long long ckpt_ver; 1442 int err = 0; 1443 | 1426 __set_cp_next_pack(sbi); 1427 1428 /* 1429 * redirty superblock if metadata like node page or inode cache is 1430 * updated during writing checkpoint. 1431 */ 1432 if (get_pages(sbi, F2FS_DIRTY_NODES) || 1433 get_pages(sbi, F2FS_DIRTY_IMETA)) --- 8 unchanged lines hidden (view full) --- 1442 * We guarantee that this checkpoint procedure will not fail. 1443 */ 1444int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) 1445{ 1446 struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); 1447 unsigned long long ckpt_ver; 1448 int err = 0; 1449 |
1450 if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) { 1451 if (cpc->reason != CP_PAUSE) 1452 return 0; 1453 f2fs_msg(sbi->sb, KERN_WARNING, 1454 "Start checkpoint disabled!"); 1455 } |
|
1444 mutex_lock(&sbi->cp_mutex); 1445 1446 if (!is_sbi_flag_set(sbi, SBI_IS_DIRTY) && 1447 ((cpc->reason & CP_FASTBOOT) || (cpc->reason & CP_SYNC) || 1448 ((cpc->reason & CP_DISCARD) && !sbi->discard_blks))) 1449 goto out; 1450 if (unlikely(f2fs_cp_error(sbi))) { 1451 err = -EIO; --- 109 unchanged lines hidden --- | 1456 mutex_lock(&sbi->cp_mutex); 1457 1458 if (!is_sbi_flag_set(sbi, SBI_IS_DIRTY) && 1459 ((cpc->reason & CP_FASTBOOT) || (cpc->reason & CP_SYNC) || 1460 ((cpc->reason & CP_DISCARD) && !sbi->discard_blks))) 1461 goto out; 1462 if (unlikely(f2fs_cp_error(sbi))) { 1463 err = -EIO; --- 109 unchanged lines hidden --- |