diff options
-rw-r--r-- | fs/f2fs/checkpoint.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 6a81b73add06..f3ebfb5a8431 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c | |||
@@ -95,8 +95,9 @@ static inline block_t get_max_meta_blks(struct f2fs_sb_info *sbi, int type) | |||
95 | case META_SIT: | 95 | case META_SIT: |
96 | return SIT_BLK_CNT(sbi); | 96 | return SIT_BLK_CNT(sbi); |
97 | case META_SSA: | 97 | case META_SSA: |
98 | return MAIN_BLKADDR(sbi); | ||
98 | case META_CP: | 99 | case META_CP: |
99 | return 0; | 100 | return SM_I(sbi)->sit_info->sit_base_addr; |
100 | case META_POR: | 101 | case META_POR: |
101 | return MAX_BLKADDR(sbi); | 102 | return MAX_BLKADDR(sbi); |
102 | default: | 103 | default: |
@@ -141,11 +142,23 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type | |||
141 | prev_blk_addr = blk_addr; | 142 | prev_blk_addr = blk_addr; |
142 | break; | 143 | break; |
143 | case META_SSA: | 144 | case META_SSA: |
145 | if (unlikely(blkno >= max_blks)) | ||
146 | goto out; | ||
147 | if (unlikely(blkno < SM_I(sbi)->ssa_blkaddr)) | ||
148 | goto out; | ||
149 | blk_addr = blkno; | ||
150 | break; | ||
144 | case META_CP: | 151 | case META_CP: |
152 | if (unlikely(blkno >= max_blks)) | ||
153 | goto out; | ||
154 | if (unlikely(blkno < __start_cp_addr(sbi))) | ||
155 | goto out; | ||
156 | blk_addr = blkno; | ||
157 | break; | ||
145 | case META_POR: | 158 | case META_POR: |
146 | if (unlikely(blkno >= max_blks)) | 159 | if (unlikely(blkno >= max_blks)) |
147 | goto out; | 160 | goto out; |
148 | if (unlikely(blkno < SEG0_BLKADDR(sbi))) | 161 | if (unlikely(blkno < MAIN_BLKADDR(sbi))) |
149 | goto out; | 162 | goto out; |
150 | blk_addr = blkno; | 163 | blk_addr = blkno; |
151 | break; | 164 | break; |