linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs-tools: calculate cp_ver correctly
@ 2017-03-02  3:39 Chao Yu
  0 siblings, 0 replies; only message in thread
From: Chao Yu @ 2017-03-02  3:39 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, chao, Chao Yu

It needs to check CP_CRC_RECOVERY_FLAG during cp_ver calculation.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 include/f2fs_fs.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 057adf39f6a9..a92011b83ff5 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -1089,10 +1089,13 @@ static inline __le64 get_cp_crc(struct f2fs_checkpoint *cp)
 {
 	u_int64_t cp_ver = get_cp(checkpoint_ver);
 	size_t crc_offset = get_cp(checksum_offset);
+	unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags);
+
 	u_int32_t crc = le32_to_cpu(*(__le32 *)((unsigned char *)cp +
 							crc_offset));
 
-	cp_ver |= ((u_int64_t)crc << 32);
+	if (ckpt_flags & CP_CRC_RECOVERY_FLAG)
+		cp_ver |= ((u_int64_t)crc << 32);
 	return cpu_to_le64(cp_ver);
 }
 
-- 
2.8.2.295.g3f1c1d0

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

only message in thread, other threads:[~2017-03-02  3:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-02  3:39 [PATCH] f2fs-tools: calculate cp_ver correctly Chao Yu

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