Skip to contentSkip to conversation

defrag.f2fs: fix not to allocate current segment

PATCH New Jaegeuk Kim 1 participant 1 message Dec 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 fsck/mount.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fsck/mount.c +3 -3
index d34c704..8418dcc 100644
@@ -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;
 
Signature · 4 lines
2.5.4 (Apple Git-61)


------------------------------------------------------------------------------