Skip to content

Commit 2fa8d12

Browse files
Jaegeuk Kimgregkh
authored andcommitted
f2fs: clean up unnecessary indentation
[ Upstream commit 05d3273 ] No functional change. Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0c57aa8 commit 2fa8d12

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

fs/f2fs/segment.h

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -431,15 +431,14 @@ static inline void __set_free(struct f2fs_sb_info *sbi, unsigned int segno)
431431
unsigned int secno = GET_SEC_FROM_SEG(sbi, segno);
432432
unsigned int start_segno = GET_SEG_FROM_SEC(sbi, secno);
433433
unsigned int next;
434-
unsigned int usable_segs = f2fs_usable_segs_in_sec(sbi);
435434

436435
spin_lock(&free_i->segmap_lock);
437436
clear_bit(segno, free_i->free_segmap);
438437
free_i->free_segments++;
439438

440439
next = find_next_bit(free_i->free_segmap,
441440
start_segno + SEGS_PER_SEC(sbi), start_segno);
442-
if (next >= start_segno + usable_segs) {
441+
if (next >= start_segno + f2fs_usable_segs_in_sec(sbi)) {
443442
clear_bit(secno, free_i->free_secmap);
444443
free_i->free_sections++;
445444
}
@@ -465,22 +464,31 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi,
465464
unsigned int secno = GET_SEC_FROM_SEG(sbi, segno);
466465
unsigned int start_segno = GET_SEG_FROM_SEC(sbi, secno);
467466
unsigned int next;
468-
unsigned int usable_segs = f2fs_usable_segs_in_sec(sbi);
467+
bool ret;
469468

470469
spin_lock(&free_i->segmap_lock);
471-
if (test_and_clear_bit(segno, free_i->free_segmap)) {
472-
free_i->free_segments++;
473-
474-
if (!inmem && IS_CURSEC(sbi, secno))
475-
goto skip_free;
476-
next = find_next_bit(free_i->free_segmap,
477-
start_segno + SEGS_PER_SEC(sbi), start_segno);
478-
if (next >= start_segno + usable_segs) {
479-
if (test_and_clear_bit(secno, free_i->free_secmap))
480-
free_i->free_sections++;
481-
}
482-
}
483-
skip_free:
470+
ret = test_and_clear_bit(segno, free_i->free_segmap);
471+
if (!ret)
472+
goto unlock_out;
473+
474+
free_i->free_segments++;
475+
476+
if (!inmem && IS_CURSEC(sbi, secno))
477+
goto unlock_out;
478+
479+
/* check large section */
480+
next = find_next_bit(free_i->free_segmap,
481+
start_segno + SEGS_PER_SEC(sbi), start_segno);
482+
if (next < start_segno + f2fs_usable_segs_in_sec(sbi))
483+
goto unlock_out;
484+
485+
ret = test_and_clear_bit(secno, free_i->free_secmap);
486+
if (!ret)
487+
goto unlock_out;
488+
489+
free_i->free_sections++;
490+
491+
unlock_out:
484492
spin_unlock(&free_i->segmap_lock);
485493
}
486494

0 commit comments

Comments
 (0)