unsigned int secno, last_victim;
        unsigned int last_segment;
        unsigned int nsearched = 0;
+       int ret = 0;
 
        mutex_lock(&dirty_i->seglist_lock);
        last_segment = MAIN_SECS(sbi) * sbi->segs_per_sec;
        p.min_cost = get_max_cost(sbi, &p);
 
        if (*result != NULL_SEGNO) {
-               if (get_valid_blocks(sbi, *result, false) &&
-                       !sec_usage_check(sbi, GET_SEC_FROM_SEG(sbi, *result)))
+               if (!get_valid_blocks(sbi, *result, false)) {
+                       ret = -ENODATA;
+                       goto out;
+               }
+
+               if (sec_usage_check(sbi, GET_SEC_FROM_SEG(sbi, *result)))
+                       ret = -EBUSY;
+               else
                        p.min_segno = *result;
                goto out;
        }
 
+       ret = -ENODATA;
        if (p.max_search == 0)
                goto out;
 
                        else
                                set_bit(secno, dirty_i->victim_secmap);
                }
+               ret = 0;
 
        }
 out:
                                prefree_segments(sbi), free_segments(sbi));
        mutex_unlock(&dirty_i->seglist_lock);
 
-       return (p.min_segno == NULL_SEGNO) ? 0 : 1;
+       return ret;
 }
 
 static const struct victim_selection default_v_ops = {
                ret = -EINVAL;
                goto stop;
        }
-       if (!__get_victim(sbi, &segno, gc_type)) {
-               ret = -ENODATA;
+       ret = __get_victim(sbi, &segno, gc_type);
+       if (ret)
                goto stop;
-       }
 
        seg_freed = do_garbage_collect(sbi, segno, &gc_list, gc_type);
        if (gc_type == FG_GC && seg_freed == sbi->segs_per_sec)
 
        bool reversed = false;
 
        /* f2fs_need_SSR() already forces to do this */
-       if (v_ops->get_victim(sbi, &segno, BG_GC, type, SSR)) {
+       if (!v_ops->get_victim(sbi, &segno, BG_GC, type, SSR)) {
                curseg->next_segno = segno;
                return 1;
        }
        for (; cnt-- > 0; reversed ? i-- : i++) {
                if (i == type)
                        continue;
-               if (v_ops->get_victim(sbi, &segno, BG_GC, i, SSR)) {
+               if (!v_ops->get_victim(sbi, &segno, BG_GC, i, SSR)) {
                        curseg->next_segno = segno;
                        return 1;
                }