mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git
synced 2024-11-27 19:53:34 +08:00
f2fs-tools: fix end block addres when finding free block
This patch fixes wrong end_blkaddr condition for free block allocation. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
b467030078
commit
bfa0743771
@ -1547,16 +1547,18 @@ void flush_sit_entries(struct f2fs_sb_info *sbi)
|
||||
|
||||
int find_next_free_block(struct f2fs_sb_info *sbi, u64 *to, int left, int type)
|
||||
{
|
||||
struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi);
|
||||
struct seg_entry *se;
|
||||
u32 segno;
|
||||
u64 offset;
|
||||
int not_enough = 0;
|
||||
u64 end_blkaddr = (get_sb(segment_count_main) <<
|
||||
get_sb(log_blocks_per_seg)) + get_sb(main_blkaddr);
|
||||
|
||||
if (get_free_segments(sbi) <= SM_I(sbi)->reserved_segments + 1)
|
||||
not_enough = 1;
|
||||
|
||||
while (*to >= SM_I(sbi)->main_blkaddr &&
|
||||
*to < F2FS_RAW_SUPER(sbi)->block_count) {
|
||||
while (*to >= SM_I(sbi)->main_blkaddr && *to < end_blkaddr) {
|
||||
segno = GET_SEGNO(sbi, *to);
|
||||
offset = OFFSET_IN_SEG(sbi, *to);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user