Am 24.10.2011 09:53, schrieb Paolo Bonzini: > On 10/24/2011 09:37 AM, Kevin Wolf wrote: >>> Why? cache=unsafe is explicitly allowing to s/data/manure/ on >>> crash. >> >> It's surely expected on a host crash, but is it for a qemu crash? >> cache=unsafe was introduced to avoid fsync() costs, which it still >> does after this patch. > > I think it's not about "why is it there", but rather about "what is it > useful for". My interpretation of it is "I do not need the image > anymore unless the command exits cleanly": VM installations, qemu-img > conversions, BDRV_O_SNAPSHOT (doesn't do it yet, but it could). Even > SIGINT and SIGTERM would be excluded from this definition, but they cost > nothing so it's nice to include them.
I think another common interpretation is: "I don't run this VM in production but for development. I want the VM to go faster and I can recreate the image in the unlikely event that power fails during my work. But it certainly would be nasty." >>> If you do this for raw-posix, you need to do it for all protocols. >> >> rbd could use it, too, right. Any other protocol I missed? > > NBD could, but it doesn't support flush yet. > > In general, even if it were useful to implement this, I'm not sure this > is the best way to implement it. For example you could simply clear > BDRV_O_NO_FLUSH in qcow2_open. That could work, too. On the other hand I don't like block drivers to modify their flags. For example, would query-block still provide the correct cache mode then? But I think that starting to make exceptions for single block drivers isn't a good idea anyway. If we want bdrv_flush() to write out all metadata internal to qemu, I think the approach with checking the flag in drivers calling things like fsync() is better. The common thing is to do the flush. Kevin