| ubi_wl_get_peb#(; PNUM, WLARRAY, ERASEQ, APEBS; ERR) {let FOUND = ?, N = ? in {ubi_wl_get_free_min#(WLARRAY; N; FOUND); if ¬ FOUND then if ERASEQ ≠ [] then {PNUM := ERASEQ.head.pnum; ubi_erase_worker_helper#(PNUM; WLARRAY, APEBS; ERR); if ERR = ESUCCESS then {ERASEQ := ERASEQ.tail; if WLARRAY[PNUM].status ≠ free then ERR := ENOSPC} else ERR := ENOSPC} else ERR := ENOSPC else {ubi_wl_find_free_max_below#(N + WL_THRESHOLD, WLARRAY; PNUM); ERR := ESUCCESS}} } |