aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.h
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2016-09-20 11:04:18 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2016-09-30 17:34:20 -0700
commitaaec2b1d18792a5f27b69ff37f34f43f89f5aa3b (patch)
treed21e6ad4e210ad826580c03a55cb97230543c280 /fs/f2fs/node.h
parentf2fs: fix to avoid race condition when updating sbi flag (diff)
downloadlinux-dev-aaec2b1d18792a5f27b69ff37f34f43f89f5aa3b.tar.xz
linux-dev-aaec2b1d18792a5f27b69ff37f34f43f89f5aa3b.zip
f2fs: introduce cp_lock to protect updating of ckpt_flags
This patch introduces spinlock to protect updating process of ckpt_flags field in struct f2fs_checkpoint, it avoids incorrectly updating in race condition. Signed-off-by: Chao Yu <yuchao0@huawei.com> [Jaegeuk Kim: add __is_set_ckpt_flags likewise __set_ckpt_flags] Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.h')
-rw-r--r--fs/f2fs/node.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index e8ca64a70de0..868bec65e51c 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -293,7 +293,7 @@ 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)) {
+ 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);
@@ -308,7 +308,7 @@ 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)) {
+ 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);