linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: introduce a new flag to indicate trun off nat bits temporary
@ 2018-04-13  3:07 Yunlei He
  0 siblings, 0 replies; only message in thread
From: Yunlei He @ 2018-04-13  3:07 UTC (permalink / raw)
  To: jaegeuk, yuchao0, linux-f2fs-devel; +Cc: zhangdianfang

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 <heyunlei@huawei.com>
---
 fs/f2fs/checkpoint.c | 3 ++-
 fs/f2fs/f2fs.h       | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 2e23b95..96785ff 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -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 */
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index c1c3a1d..90940350 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -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);
-- 
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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-13  3:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-13  3:07 [PATCH] f2fs: introduce a new flag to indicate trun off nat bits temporary Yunlei He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).