unsigned int secno = GET_SEC_FROM_SEG(sbi, segno);
        unsigned int start_segno = GET_SEG_FROM_SEC(sbi, secno);
        unsigned int next;
-       unsigned int usable_segs = f2fs_usable_segs_in_sec(sbi);
 
        spin_lock(&free_i->segmap_lock);
        clear_bit(segno, free_i->free_segmap);
 
        next = find_next_bit(free_i->free_segmap,
                        start_segno + SEGS_PER_SEC(sbi), start_segno);
-       if (next >= start_segno + usable_segs) {
+       if (next >= start_segno + f2fs_usable_segs_in_sec(sbi)) {
                clear_bit(secno, free_i->free_secmap);
                free_i->free_sections++;
        }
        unsigned int secno = GET_SEC_FROM_SEG(sbi, segno);
        unsigned int start_segno = GET_SEG_FROM_SEC(sbi, secno);
        unsigned int next;
-       unsigned int usable_segs = f2fs_usable_segs_in_sec(sbi);
+       bool ret;
 
        spin_lock(&free_i->segmap_lock);
-       if (test_and_clear_bit(segno, free_i->free_segmap)) {
-               free_i->free_segments++;
-
-               if (!inmem && IS_CURSEC(sbi, secno))
-                       goto skip_free;
-               next = find_next_bit(free_i->free_segmap,
-                               start_segno + SEGS_PER_SEC(sbi), start_segno);
-               if (next >= start_segno + usable_segs) {
-                       if (test_and_clear_bit(secno, free_i->free_secmap))
-                               free_i->free_sections++;
-               }
-       }
-skip_free:
+       ret = test_and_clear_bit(segno, free_i->free_segmap);
+       if (!ret)
+               goto unlock_out;
+
+       free_i->free_segments++;
+
+       if (!inmem && IS_CURSEC(sbi, secno))
+               goto unlock_out;
+
+       /* check large section */
+       next = find_next_bit(free_i->free_segmap,
+                            start_segno + SEGS_PER_SEC(sbi), start_segno);
+       if (next < start_segno + f2fs_usable_segs_in_sec(sbi))
+               goto unlock_out;
+
+       ret = test_and_clear_bit(secno, free_i->free_secmap);
+       if (!ret)
+               goto unlock_out;
+
+       free_i->free_sections++;
+
+unlock_out:
        spin_unlock(&free_i->segmap_lock);
 }