Deleted Added
full compact
subr_blist.c (109623) subr_blist.c (111119)
1
2/*
3 * BLIST.C - Bitmap allocator/deallocator, using a radix tree with hinting
4 *
5 * (c)Copyright 1998, Matthew Dillon. Terms for use and redistribution
6 * are covered by the BSD Copyright as found in /usr/src/COPYRIGHT.
7 *
8 * This module implements a general bitmap allocator/deallocator. The

--- 46 unchanged lines hidden (view full) ---

55 * large' if you try. This is an area that could use improvement. The
56 * radix is large enough that this restriction does not effect the swap
57 * system, though. Currently only the allocation code is effected by
58 * this algorithmic unfeature. The freeing code can handle arbitrary
59 * ranges.
60 *
61 * This code can be compiled stand-alone for debugging.
62 *
1
2/*
3 * BLIST.C - Bitmap allocator/deallocator, using a radix tree with hinting
4 *
5 * (c)Copyright 1998, Matthew Dillon. Terms for use and redistribution
6 * are covered by the BSD Copyright as found in /usr/src/COPYRIGHT.
7 *
8 * This module implements a general bitmap allocator/deallocator. The

--- 46 unchanged lines hidden (view full) ---

55 * large' if you try. This is an area that could use improvement. The
56 * radix is large enough that this restriction does not effect the swap
57 * system, though. Currently only the allocation code is effected by
58 * this algorithmic unfeature. The freeing code can handle arbitrary
59 * ranges.
60 *
61 * This code can be compiled stand-alone for debugging.
62 *
63 * $FreeBSD: head/sys/kern/subr_blist.c 109623 2003-01-21 08:56:16Z alfred $
63 * $FreeBSD: head/sys/kern/subr_blist.c 111119 2003-02-19 05:47:46Z imp $
64 */
65
66#ifdef _KERNEL
67
68#include <sys/param.h>
69#include <sys/systm.h>
70#include <sys/lock.h>
71#include <sys/kernel.h>

--- 80 unchanged lines hidden (view full) ---

152 */
153 radix = BLIST_BMAP_RADIX;
154
155 while (radix < blocks) {
156 radix *= BLIST_META_RADIX;
157 skip = (skip + 1) * BLIST_META_RADIX;
158 }
159
64 */
65
66#ifdef _KERNEL
67
68#include <sys/param.h>
69#include <sys/systm.h>
70#include <sys/lock.h>
71#include <sys/kernel.h>

--- 80 unchanged lines hidden (view full) ---

152 */
153 radix = BLIST_BMAP_RADIX;
154
155 while (radix < blocks) {
156 radix *= BLIST_META_RADIX;
157 skip = (skip + 1) * BLIST_META_RADIX;
158 }
159
160 bl = malloc(sizeof(struct blist), M_SWAP, M_ZERO);
160 bl = malloc(sizeof(struct blist), M_SWAP, M_WAITOK | M_ZERO);
161
162 bl->bl_blocks = blocks;
163 bl->bl_radix = radix;
164 bl->bl_skip = skip;
165 bl->bl_rootblks = 1 +
166 blst_radix_init(NULL, bl->bl_radix, bl->bl_skip, blocks);
161
162 bl->bl_blocks = blocks;
163 bl->bl_radix = radix;
164 bl->bl_skip = skip;
165 bl->bl_rootblks = 1 +
166 blst_radix_init(NULL, bl->bl_radix, bl->bl_skip, blocks);
167 bl->bl_root = malloc(sizeof(blmeta_t) * bl->bl_rootblks, M_SWAP, 0);
167 bl->bl_root = malloc(sizeof(blmeta_t) * bl->bl_rootblks, M_SWAP, M_WAITOK);
168
169#if defined(BLIST_DEBUG)
170 printf(
171 "BLIST representing %lld blocks (%lld MB of swap)"
172 ", requiring %lldK of ram\n",
173 (long long)bl->bl_blocks,
174 (long long)bl->bl_blocks * 4 / 1024,
175 (long long)(bl->bl_rootblks * sizeof(blmeta_t) + 1023) / 1024

--- 905 unchanged lines hidden ---
168
169#if defined(BLIST_DEBUG)
170 printf(
171 "BLIST representing %lld blocks (%lld MB of swap)"
172 ", requiring %lldK of ram\n",
173 (long long)bl->bl_blocks,
174 (long long)bl->bl_blocks * 4 / 1024,
175 (long long)(bl->bl_rootblks * sizeof(blmeta_t) + 1023) / 1024

--- 905 unchanged lines hidden ---