aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-12-15 18:13:08 -0800
committerSteve Kondik <steve@cyngn.com>2016-08-24 11:43:29 -0700
commit3a2fc419c7c80c5bd6376a2deb1d1f6e145bc705 (patch)
treebe5b2003ca81dc687d46028b6c16e19a6c87b499
parent94a04b1832c455810bc547f9993fd66200ee1c30 (diff)
downloadandroid_external_f2fs-tools-3a2fc419c7c80c5bd6376a2deb1d1f6e145bc705.tar.gz
android_external_f2fs-tools-3a2fc419c7c80c5bd6376a2deb1d1f6e145bc705.tar.bz2
android_external_f2fs-tools-3a2fc419c7c80c5bd6376a2deb1d1f6e145bc705.zip
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. Change-Id: I863301e1243038420d877b7d7a74160b80810ecb Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fsck/mount.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fsck/mount.c b/fsck/mount.c
index d34c704..8418dcc 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -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;