linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: change the codes of checking CP_CRC_RECOVERY_FLAG to macro
@ 2017-02-24 10:06 Yunlong Song
  2017-02-24 10:29 ` Chao Yu
  2017-02-25  8:01 ` [PATCH v2] " Yunlong Song
  0 siblings, 2 replies; 10+ messages in thread
From: Yunlong Song @ 2017-02-24 10:06 UTC (permalink / raw)
  To: jaegeuk, cm224.lee, yuchao0, chao, sylinux, yunlong.song, miaoxie
  Cc: bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

No need to check the "if" condition each time, just change it to macro codes.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
 fs/f2fs/node.h    | 20 ++++++++++----------
 fs/f2fs/segment.c |  5 +++--
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index 3fc9c4b..3e5a58b 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -303,11 +303,11 @@ static inline void fill_node_footer_blkaddr(struct page *page, block_t blkaddr)
 	size_t crc_offset = le32_to_cpu(ckpt->checksum_offset);
 	__u64 cp_ver = le64_to_cpu(ckpt->checkpoint_ver);
 
-	if (__is_set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG)) {
-		__u64 crc = le32_to_cpu(*((__le32 *)
-				((unsigned char *)ckpt + crc_offset)));
-		cp_ver |= (crc << 32);
-	}
+#ifdef CP_CRC_RECOVERY_FLAG
+	__u64 crc = le32_to_cpu(*((__le32 *)
+			((unsigned char *)ckpt + crc_offset)));
+	cp_ver |= (crc << 32);
+#endif
 	rn->footer.cp_ver = cpu_to_le64(cp_ver);
 	rn->footer.next_blkaddr = cpu_to_le32(blkaddr);
 }
@@ -318,11 +318,11 @@ static inline bool is_recoverable_dnode(struct page *page)
 	size_t crc_offset = le32_to_cpu(ckpt->checksum_offset);
 	__u64 cp_ver = cur_cp_version(ckpt);
 
-	if (__is_set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG)) {
-		__u64 crc = le32_to_cpu(*((__le32 *)
-				((unsigned char *)ckpt + crc_offset)));
-		cp_ver |= (crc << 32);
-	}
+#ifdef CP_CRC_RECOVERY_FLAG
+	__u64 crc = le32_to_cpu(*((__le32 *)
+			((unsigned char *)ckpt + crc_offset)));
+	cp_ver |= (crc << 32);
+#endif
 	return cp_ver == cpver_of_node(page);
 }
 
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 9eb6d89..6c2e1ee 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1573,9 +1573,10 @@ static void allocate_segment_by_default(struct f2fs_sb_info *sbi,
 {
 	if (force)
 		new_curseg(sbi, type, true);
-	else if (!is_set_ckpt_flags(sbi, CP_CRC_RECOVERY_FLAG) &&
-					type == CURSEG_WARM_NODE)
+#ifndef CP_CRC_RECOVERY_FLAG
+	else if (type == CURSEG_WARM_NODE)
 		new_curseg(sbi, type, false);
+#endif
 	else if (need_SSR(sbi) && get_ssr_segment(sbi, type))
 		change_curseg(sbi, type, true);
 	else
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-02-25 18:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-24 10:06 [PATCH] f2fs: change the codes of checking CP_CRC_RECOVERY_FLAG to macro Yunlong Song
2017-02-24 10:29 ` Chao Yu
2017-02-24 11:11   ` Yunlong Song
2017-02-24 11:37     ` Chao Yu
2017-02-24 11:57       ` Yunlong Song
2017-02-24 18:12         ` Jaegeuk Kim
2017-02-25  0:54           ` Chao Yu
2017-02-25  8:10           ` Yunlong Song
2017-02-25  8:01 ` [PATCH v2] " Yunlong Song
2017-02-25 18:46   ` Jaegeuk Kim

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