|
@@ -792,6 +792,7 @@ struct f2fs_sb_info {
|
|
|
|
|
|
/* for checkpoint */
|
|
|
struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */
|
|
|
+ int cur_cp_pack; /* remain current cp pack */
|
|
|
spinlock_t cp_lock; /* for flag in ckpt */
|
|
|
struct inode *meta_inode; /* cache meta blocks */
|
|
|
struct mutex cp_mutex; /* checkpoint procedure lock */
|
|
@@ -1352,22 +1353,27 @@ static inline void *__bitmap_ptr(struct f2fs_sb_info *sbi, int flag)
|
|
|
|
|
|
static inline block_t __start_cp_addr(struct f2fs_sb_info *sbi)
|
|
|
{
|
|
|
- block_t start_addr;
|
|
|
- struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
|
|
|
- unsigned long long ckpt_version = cur_cp_version(ckpt);
|
|
|
-
|
|
|
- start_addr = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr);
|
|
|
+ block_t start_addr = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr);
|
|
|
|
|
|
- /*
|
|
|
- * odd numbered checkpoint should at cp segment 0
|
|
|
- * and even segment must be at cp segment 1
|
|
|
- */
|
|
|
- if (!(ckpt_version & 1))
|
|
|
+ if (sbi->cur_cp_pack == 2)
|
|
|
start_addr += sbi->blocks_per_seg;
|
|
|
+ return start_addr;
|
|
|
+}
|
|
|
|
|
|
+static inline block_t __start_cp_next_addr(struct f2fs_sb_info *sbi)
|
|
|
+{
|
|
|
+ block_t start_addr = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr);
|
|
|
+
|
|
|
+ if (sbi->cur_cp_pack == 1)
|
|
|
+ start_addr += sbi->blocks_per_seg;
|
|
|
return start_addr;
|
|
|
}
|
|
|
|
|
|
+static inline void __set_cp_next_pack(struct f2fs_sb_info *sbi)
|
|
|
+{
|
|
|
+ sbi->cur_cp_pack = (sbi->cur_cp_pack == 1) ? 2 : 1;
|
|
|
+}
|
|
|
+
|
|
|
static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi)
|
|
|
{
|
|
|
return le32_to_cpu(F2FS_CKPT(sbi)->cp_pack_start_sum);
|