linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: no need to flush NAT bits if no enough space
@ 2018-02-05 14:30 Weichao Guo
  2018-02-05  6:29 ` guoweichao
  2018-02-05  7:42 ` Chao Yu
  0 siblings, 2 replies; 4+ messages in thread
From: Weichao Guo @ 2018-02-05 14:30 UTC (permalink / raw)
  To: jaegeuk, yuchao0; +Cc: heyunlei, linux-f2fs-devel

NAT bits are saved at spare space in CP pack. Flushed NAT bits
may be overwritten by the CP pack if there is no enough space
for NAT bits. And NAT bits will be obsolesced at next mount time
if crc|cp_ver not matched. So just skip to flush NAT bits in such
needless cases.

Signed-off-by: Weichao Guo <guoweichao@huawei.com>
---
 fs/f2fs/checkpoint.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 0eaafb8..bdc03c9 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -1248,7 +1248,9 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 	start_blk = __start_cp_next_addr(sbi);
 
 	/* write nat bits */
-	if (enabled_nat_bits(sbi, cpc)) {
+	if (enabled_nat_bits(sbi, cpc) &&
+			le32_to_cpu(ckpt->cp_pack_total_block_count) <=
+			sbi->blocks_per_seg - NM_I(sbi)->nat_bits_blocks) {
 		__u64 cp_ver = cur_cp_version(ckpt);
 		block_t blk;
 
-- 
2.10.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] 4+ messages in thread

end of thread, other threads:[~2018-02-05  7:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-05 14:30 [PATCH] f2fs: no need to flush NAT bits if no enough space Weichao Guo
2018-02-05  6:29 ` guoweichao
2018-02-05  7:42 ` Chao Yu
2018-02-05  7:49   ` guoweichao

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).