* invalidated soon after by user update or deletion.
                 * So, I'd like to wait some time to collect dirty segments.
                 */
-               if (sbi->gc_mode == GC_URGENT_HIGH) {
-                       spin_lock(&sbi->gc_urgent_high_lock);
-                       if (sbi->gc_urgent_high_remaining) {
-                               sbi->gc_urgent_high_remaining--;
-                               if (!sbi->gc_urgent_high_remaining)
-                                       sbi->gc_mode = GC_NORMAL;
-                       }
-                       spin_unlock(&sbi->gc_urgent_high_lock);
-               }
-
                if (sbi->gc_mode == GC_URGENT_HIGH ||
                                sbi->gc_mode == GC_URGENT_MID) {
                        wait_ms = gc_th->urgent_sleep_time;
                /* balancing f2fs's metadata periodically */
                f2fs_balance_fs_bg(sbi, true);
 next:
+               if (sbi->gc_mode == GC_URGENT_HIGH) {
+                       spin_lock(&sbi->gc_urgent_high_lock);
+                       if (sbi->gc_urgent_high_remaining) {
+                               sbi->gc_urgent_high_remaining--;
+                               if (!sbi->gc_urgent_high_remaining)
+                                       sbi->gc_mode = GC_NORMAL;
+                       }
+                       spin_unlock(&sbi->gc_urgent_high_lock);
+               }
                sb_end_write(sbi->sb);
 
        } while (!kthread_should_stop());