mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-23 10:10:00 +00:00
defrag.f2fs: fix not to allocate current segment
This patch fixes allocating wrong segment which has zero data but is registered as a current segment. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
b008605e99
commit
552d6a8f4b
@ -1383,11 +1383,11 @@ int find_next_free_block(struct f2fs_sb_info *sbi, u64 *to, int left, int type)
|
||||
|
||||
se = get_seg_entry(sbi, segno);
|
||||
|
||||
if (se->valid_blocks == sbi->blocks_per_seg)
|
||||
if (se->valid_blocks == sbi->blocks_per_seg ||
|
||||
IS_CUR_SEGNO(sbi, segno, type))
|
||||
goto next;
|
||||
|
||||
if (se->valid_blocks == 0 && !(segno % sbi->segs_per_sec) &&
|
||||
!IS_CUR_SEGNO(sbi, segno, type)) {
|
||||
if (se->valid_blocks == 0 && !(segno % sbi->segs_per_sec)) {
|
||||
struct seg_entry *se2;
|
||||
int i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user