[libvirt] [PATCH] qemu: reduce file padding requirements
Eric Blake
eblake at redhat.com
Thu Jun 10 11:54:28 UTC 2010
On 06/10/2010 05:20 AM, Daniel P. Berrange wrote:
>> difference is that >file truncates; for block devices, truncation is a
>> no-op, but for regular files, this wipes out any pre-existing contents
>> (such as the header we are skipping over) - is that an issue? If so,
>> then we should use <>file instead of >file, to open a read-write fd
>> without forcing truncation (even if we only use the fd for writing).
>
> Yes, we need to avoid truncation - the seek is there to skip over the
> metadata header, so we can't truncate that
Simple test on regular files:
$ perl -e 'print "1"x12' > sample1
$ perl -e 'print "2"x12' > sample2
$ cat sample1 | { dd bs=5 seek=1 if=/dev/null && dd bs=10; } 1<>sample2
0+0 records in
0+0 records out
0 bytes (0 B) copied, 7.054e-06 s, 0.0 kB/s
1+1 records in
1+1 records out
12 bytes (12 B) copied, 2.8006e-05 s, 428 kB/s
$ cat sample2
22222111111111111
I'll adjust the patch accordingly (again, since I'm on the road today,
I'm not in the easiest position to test actual migration to a block
device at the moment, so I'd appreciate someone else testing libvirt's
usage of this same paradigm).
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100610/cc216c28/attachment-0001.sig>
More information about the libvir-list
mailing list