]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virfile: safezero: fall back to writing block by block if mmap fails
authorOskari Saarenmaa <os@ohmu.fi>
Wed, 2 Oct 2013 07:31:09 +0000 (10:31 +0300)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 4 Oct 2013 06:22:36 +0000 (08:22 +0200)
commit7dc1d4ab8923fa9623d34acd83d6fa39b95a7e88
tree7ae9286eb68fcc3587a0ddcce2b19c279ca6d9bc
parent68cc45b6f94db4495ff81f5521d87e5e323b60bb
virfile: safezero: fall back to writing block by block if mmap fails

mmap can fail on 32-bit systems if we're trying to zero out a lot of data.
Fall back to using block-by-block writing in that case.  While we could map
smaller blocks it's unlikely that this code is used a lot and its easier to
just fall back to one of the existing methods.

Also modified the block-by-block zeroing to not allocate a megabyte of
zeroes if we're writing less than that.

Signed-off-by: Oskari Saarenmaa <os@ohmu.fi>
src/util/virfile.c