On Mon, Feb 26, 2018 at 06:03:13PM +0100, Max Reitz wrote: > There are filesystems (among which is tmpfs) that have a hard time > reporting allocation status. That is definitely a bug in them. > > However, there is no good reason why qemu-img convert should query the > allocation status in the first place. It does zero detection by itself > anyway, so we can detect unallocated areas ourselves. > > Furthermore, if a filesystem driver has any sense, reading unallocated > data should take just as much time as lseek(SEEK_DATA) + memset(). So > the only overhead we introduce by dropping the manual lseek() call is a > memset() in the driver and a buffer_is_zero() in qemu-img, both of which > should be relatively quick.
This makes sense. Which file systems did you test this patch on? XFS, ext4, and tmpfs would be a good minimal test set to prove the patch. Perhaps with two input files: 1. A file that is mostly filled with data. 2. A file that is only sparsely populated with data. The time taken should be comparable with the time before this patch.
signature.asc
Description: PGP signature