diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-04-19 15:26:53 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-04-19 15:26:53 +0000 |
commit | 43dfa343205f93e307354f2eb9bb65eee19711ed (patch) | |
tree | b9bc3b266acef6eed57c4345a94802633e9968cb /sys | |
parent | 9781289811c33accd41427618263b031a443438a (diff) |
Add a new EX_FILLED flag to make extent_create() create an extent map that
has all space allocated such that we can make holes in it using extent_free().
ok miod@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/subr_extent.c | 14 | ||||
-rw-r--r-- | sys/sys/extent.h | 21 |
2 files changed, 24 insertions, 11 deletions
diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c index 8053c1c9583..c309a1a123a 100644 --- a/sys/kern/subr_extent.c +++ b/sys/kern/subr_extent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_extent.c,v 1.36 2009/04/10 20:57:04 kettenis Exp $ */ +/* $OpenBSD: subr_extent.c,v 1.37 2009/04/19 15:26:52 kettenis Exp $ */ /* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */ /*- @@ -228,6 +228,18 @@ extent_create(char *name, u_long start, u_long end, int mtype, caddr_t storage, if (flags & EX_NOCOALESCE) ex->ex_flags |= EXF_NOCOALESCE; + if (flags & EX_FILLED) { + rp = extent_alloc_region_descriptor(ex, flags); + if (rp == NULL) { + if (!fixed_extent) + free(ex, mtype); + return (NULL); + } + rp->er_start = start; + rp->er_end = end; + LIST_INSERT_HEAD(&ex->ex_regions, rp, er_link); + } + #if defined(DIAGNOSTIC) || defined(DDB) extent_register(ex); #endif diff --git a/sys/sys/extent.h b/sys/sys/extent.h index 5bacde20e01..98e2f45c78e 100644 --- a/sys/sys/extent.h +++ b/sys/sys/extent.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extent.h,v 1.11 2009/04/19 11:04:11 kettenis Exp $ */ +/* $OpenBSD: extent.h,v 1.12 2009/04/19 15:26:52 kettenis Exp $ */ /* $NetBSD: extent.h,v 1.6 1997/10/09 07:43:05 jtc Exp $ */ /*- @@ -74,15 +74,16 @@ struct extent_fixed { #define EXF_BITS "\20\4FLWANTED\3WANTED\2NOCOALESCE\1FIXED" /* misc. flags passed to extent functions */ -#define EX_NOWAIT 0x00 /* not safe to sleep */ -#define EX_WAITOK 0x01 /* safe to sleep */ -#define EX_FAST 0x02 /* take first fit in extent_alloc() */ -#define EX_CATCH 0x04 /* catch signals while sleeping */ -#define EX_NOCOALESCE 0x08 /* create a non-coalescing extent */ -#define EX_MALLOCOK 0x10 /* safe to call malloc() */ -#define EX_WAITSPACE 0x20 /* wait for space to become free */ -#define EX_BOUNDZERO 0x40 /* boundary lines start at 0 */ -#define EX_CONFLICTOK 0x80 /* allow conflicts */ +#define EX_NOWAIT 0x0000 /* not safe to sleep */ +#define EX_WAITOK 0x0001 /* safe to sleep */ +#define EX_FAST 0x0002 /* take first fit in extent_alloc() */ +#define EX_CATCH 0x0004 /* catch signals while sleeping */ +#define EX_NOCOALESCE 0x0008 /* create a non-coalescing extent */ +#define EX_MALLOCOK 0x0010 /* safe to call malloc() */ +#define EX_WAITSPACE 0x0020 /* wait for space to become free */ +#define EX_BOUNDZERO 0x0040 /* boundary lines start at 0 */ +#define EX_CONFLICTOK 0x0080 /* allow conflicts */ +#define EX_FILLED 0x0100 /* create a filled extent */ /* * Special place holders for "alignment" and "boundary" arguments, |