summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_blist.c
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2008-05-05 19:48:54 +0000
committerkmacy <kmacy@FreeBSD.org>2008-05-05 19:48:54 +0000
commitafbf6fcd73e04b6510fe77e5897f4b00bc2951a0 (patch)
tree79b94998e8578f744173c66f743005fc070f6a5b /sys/kern/subr_blist.c
parent9dc66be7968f0fdd657867a3a0accae9a35121fb (diff)
downloadFreeBSD-src-afbf6fcd73e04b6510fe77e5897f4b00bc2951a0.zip
FreeBSD-src-afbf6fcd73e04b6510fe77e5897f4b00bc2951a0.tar.gz
add malloc flag to blist so that it can be used in ithread context
Reviewed by: alc, bsdimp
Diffstat (limited to 'sys/kern/subr_blist.c')
-rw-r--r--sys/kern/subr_blist.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/kern/subr_blist.c b/sys/kern/subr_blist.c
index 2c83499..3357646 100644
--- a/sys/kern/subr_blist.c
+++ b/sys/kern/subr_blist.c
@@ -152,14 +152,15 @@ static MALLOC_DEFINE(M_SWAP, "SWAP", "Swap space");
* blist_create() - create a blist capable of handling up to the specified
* number of blocks
*
- * blocks must be greater then 0
+ * blocks - must be greater then 0
+ * flags - malloc flags
*
* The smallest blist consists of a single leaf node capable of
* managing BLIST_BMAP_RADIX blocks.
*/
blist_t
-blist_create(daddr_t blocks)
+blist_create(daddr_t blocks, int flags)
{
blist_t bl;
int radix;
@@ -175,14 +176,14 @@ blist_create(daddr_t blocks)
skip = (skip + 1) * BLIST_META_RADIX;
}
- bl = malloc(sizeof(struct blist), M_SWAP, M_WAITOK | M_ZERO);
+ bl = malloc(sizeof(struct blist), M_SWAP, flags | M_ZERO);
bl->bl_blocks = blocks;
bl->bl_radix = radix;
bl->bl_skip = skip;
bl->bl_rootblks = 1 +
blst_radix_init(NULL, bl->bl_radix, bl->bl_skip, blocks);
- bl->bl_root = malloc(sizeof(blmeta_t) * bl->bl_rootblks, M_SWAP, M_WAITOK);
+ bl->bl_root = malloc(sizeof(blmeta_t) * bl->bl_rootblks, M_SWAP, flags);
#if defined(BLIST_DEBUG)
printf(
@@ -280,9 +281,9 @@ blist_fill(blist_t bl, daddr_t blkno, daddr_t count)
*/
void
-blist_resize(blist_t *pbl, daddr_t count, int freenew)
+blist_resize(blist_t *pbl, daddr_t count, int freenew, int flags)
{
- blist_t newbl = blist_create(count);
+ blist_t newbl = blist_create(count, flags);
blist_t save = *pbl;
*pbl = newbl;
@@ -1014,7 +1015,7 @@ main(int ac, char **av)
fprintf(stderr, "Bad option: %s\n", ptr - 2);
exit(1);
}
- bl = blist_create(size);
+ bl = blist_create(size, M_WAITOK);
blist_free(bl, 0, size);
for (;;) {
OpenPOWER on IntegriCloud