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@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list