diff options
author | mdf <mdf@FreeBSD.org> | 2011-05-13 18:48:00 +0000 |
---|---|---|
committer | mdf <mdf@FreeBSD.org> | 2011-05-13 18:48:00 +0000 |
commit | 9465c340011c0f0d939dc79a97cb31b7b974f015 (patch) | |
tree | be49b4c2fcfd4fd77e11fc14e3d844673d1cfd02 /sys/dev/md/md.c | |
parent | baa502d6548e4f26bbe2d8e57c66d908110704a1 (diff) | |
download | FreeBSD-src-9465c340011c0f0d939dc79a97cb31b7b974f015.zip FreeBSD-src-9465c340011c0f0d939dc79a97cb31b7b974f015.tar.gz |
Usa a globally visible region of zeros for both /dev/zero and the md
device. There are likely other kernel uses of "blob of zeros" than can
be converted.
Reviewed by: alc
MFC after: 1 week
Diffstat (limited to 'sys/dev/md/md.c')
-rw-r--r-- | sys/dev/md/md.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 79bf19c..71d0365 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -205,9 +205,6 @@ struct md_s { vm_object_t object; }; -/* Used for BIO_DELETE on MD_VNODE */ -static u_char zero[PAGE_SIZE]; - static struct indir * new_indir(u_int shift) { @@ -560,7 +557,8 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) * that the two cases end up having very little in common. */ if (bp->bio_cmd == BIO_DELETE) { - zerosize = sizeof(zero) - (sizeof(zero) % sc->sectorsize); + zerosize = ZERO_REGION_SIZE - + (ZERO_REGION_SIZE % sc->sectorsize); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_offset = (vm_ooffset_t)bp->bio_offset; @@ -573,7 +571,7 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = 0; while (auio.uio_offset < end) { - aiov.iov_base = zero; + aiov.iov_base = __DECONST(void *, zero_region); aiov.iov_len = end - auio.uio_offset; if (aiov.iov_len > zerosize) aiov.iov_len = zerosize; |