On 31.01.20 18:44, Eric Blake wrote: > Based-on: <20200124103458.1525982-2-david.edmond...@oracle.com> > ([PATCH v2 1/2] qemu-img: Add --target-is-zero to convert) > > I'm working on adding an NBD extension that reports whether an image > is already all zero when the client first connects. I initially > thought I could write the NBD code to just call bdrv_has_zero_init(), > but that turned out to be a bad assumption that instead resulted in > this patch series. The NBD patch will come later (and cross-posted to > the NBD protocol, libnbd, nbdkit, and qemu, as it will affect all four > repositories).
We had a discussion about this on IRC, and as far as I remember I wasn’t quite sold on the “why”. So, again, I wonder why this is needed. I mean, it does make intuitive sense to want to know whether an image is fully zero, but if I continue thinking about it I don’t know any case where we would need to figure it out and where we could accept “We don’t know” as an answer. So I’m looking for use cases, but this cover letter doesn’t mention any. (And from a quick glance I don’t see this series using the flag, actually.) (We have a use case with convert -n to freshly created image files, but my position on this on IRC was that we want the --target-is-zero flag for that anyway: Auto-detection may always break, our preferred default behavior may always change, so if you want convert -n not to touch the target image except to write non-zero data from the source, we need a --target-is-zero flag and users need to use it. Well, management layers, because I don’t think users would use convert -n anyway. And with --target-is-zero and users effectively having to use it, I don’t think that’s a good example of a use case.) I suppose there is the point of blockdev-create + blockdev-mirror: This has exactly the same problem as convert -n. But again, if you really want blockdev-mirror not just to force-zero the image, you probably need to tell it so explicitly (i.e., with a --target-is-zero flag for blockdev-mirror). (Well, I suppose we could save us a target-is-zero for mirror if we took this series and had a filter driver that force-reports BDRV_ZERO_OPEN. But, well, please no.) But maybe I’m just an idiot and there is no reason not to take this series and make blockdev-create + blockdev-mirror do the sensible thing by default in most cases. *shrug* Max
signature.asc
Description: OpenPGP digital signature