f2fs: introduce a new flag to indicate trun off nat bits temporary
PATCH 1/1 f2fs: introduce a new flag to indicate trun off nat bits temporary
SBI_NEED_FSCK is used for *real* data corruption on-line, then it can be a condition to end up issuing discard from background/umount/fstrim to prevent further data losing. This patch split in-memory SBI_NEED_FSCK to SBI_LOSE_NAT_BIT and SBI_NEED_FSCK, in order to report data corruption more accurately.
Signed-off-by Yunlei He <[email protected]>
--- fs/f2fs/checkpoint.c | 3 ++- fs/f2fs/f2fs.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
fs/f2fs/checkpoint.c +2 -1
@@ -1162,7 +1162,8 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)else __clear_ckpt_flags (ckpt,CP_ORPHAN_PRESENT_FLAG ); -if (is_sbi_flag_set (sbi,SBI_NEED_FSCK )) +if (is_sbi_flag_set (sbi,SBI_NEED_FSCK ) || +is_sbi_flag_set (sbi,SBI_LOSE_NAT_BITS ))__set_ckpt_flags (ckpt,CP_FSCK_FLAG );/* set this flag to activate crc|cp_ver for recovery */
fs/f2fs/f2fs.h +2 -1
@@ -1055,6 +1055,7 @@ enum {SBI_POR_DOING ,/* recovery is doing or not */ SBI_NEED_SB_WRITE ,/* need to recover superblock */ SBI_NEED_CP ,/* need to checkpoint */ + SBI_LOSE_NAT_BITS, /* nat bits is lost */ }; enum {
@@ -1517,7 +1518,7 @@ static inline void disable_nat_bits(struct f2fs_sb_info *sbi, bool lock) {unsigned long flags; -set_sbi_flag (sbi,SBI_NEED_FSCK ); +set_sbi_flag (sbi,SBI_LOSE_NAT_BITS );if (lock)spin_lock_irqsave (&sbi->cp_lock, flags);
Signature · 6 lines
1.9.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot