diff --git a/sys/kern/subr_blist.c b/sys/kern/subr_blist.c index 7b2fe3d98f9..164101083c6 100644 --- a/sys/kern/subr_blist.c +++ b/sys/kern/subr_blist.c @@ -769,6 +769,8 @@ blst_meta_fill( int next_skip = ((u_int)skip / BLIST_META_RADIX); int nblks = 0; + if (count > radix) + panic("blist_meta_fill: allocation too large"); if (count == radix || scan->u.bmu_avail == 0) { /* * ALL-ALLOCATED special case @@ -800,9 +802,6 @@ blst_meta_fill( radix /= BLIST_META_RADIX; } - if (count > radix) - panic("blist_meta_fill: allocation too large"); - i = (allocBlk - blk) / radix; blk += i * radix; i = i * next_skip + 1; diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index ad9ec18ed59..f47e8c7fdbb 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2271,7 +2271,7 @@ sys_swapoff(struct thread *td, struct swapoff_args *uap) static int swapoff_one(struct swdevt *sp, struct ucred *cred) { - u_long nblks, dvbase; + u_long nblks; #ifdef MAC int error; #endif @@ -2300,14 +2300,7 @@ swapoff_one(struct swdevt *sp, struct ucred *cred) */ mtx_lock(&sw_dev_mtx); sp->sw_flags |= SW_CLOSING; - for (dvbase = 0; dvbase < nblks; dvbase += BLIST_BMAP_RADIX) { - /* - * blist_fill() cannot allocate more than BLIST_BMAP_RADIX - * blocks per call. - */ - swap_pager_avail -= blist_fill(sp->sw_blist, - dvbase, ulmin(nblks - dvbase, BLIST_BMAP_RADIX)); - } + swap_pager_avail -= blist_fill(sp->sw_blist, 0, nblks); swap_total -= (vm_ooffset_t)nblks * PAGE_SIZE; mtx_unlock(&sw_dev_mtx);