Skip to content

Commit 05d3273

Browse files
author
Jaegeuk Kim
committed
f2fs: clean up unnecessary indentation
No functional change. Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 061cf3a commit 05d3273

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
@@ -429,15 +429,14 @@ static inline void __set_free(struct f2fs_sb_info *sbi, unsigned int segno)
429429
unsigned int secno = GET_SEC_FROM_SEG(sbi, segno);
430430
unsigned int start_segno = GET_SEG_FROM_SEC(sbi, secno);
431431
unsigned int next;
432-
unsigned int usable_segs = f2fs_usable_segs_in_sec(sbi);
433432

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

438437
next = find_next_bit(free_i->free_segmap,
439438
start_segno + SEGS_PER_SEC(sbi), start_segno);
440-
if (next >= start_segno + usable_segs) {
439+
if (next >= start_segno + f2fs_usable_segs_in_sec(sbi)) {
441440
clear_bit(secno, free_i->free_secmap);
442441
free_i->free_sections++;
443442
}
@@ -463,22 +462,31 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi,
463462
unsigned int secno = GET_SEC_FROM_SEG(sbi, segno);
464463
unsigned int start_segno = GET_SEG_FROM_SEC(sbi, secno);
465464
unsigned int next;
466-
unsigned int usable_segs = f2fs_usable_segs_in_sec(sbi);
465+
bool ret;
467466

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

0 commit comments

Comments
 (0)