On Thu, Jun 16, 2016 at 08:53:12PM -0600, Eric Blake wrote: > On 06/16/2016 04:10 AM, Stefan Hajnoczi wrote: > > > > > io_sectors currently only accounts for bytes written, not bytes read. > > > > Therefore, I think we need: > > > > /* Don't charge for efficient zero writes */ > > if (drv->bdrv_co_pwrite_zeroes) { > > io_sectors = 0; > > } > > That's not sufficient. NBD will have conditional support for write > zeroes, depending on whether the server supports it (that is, once my > patches for NBD_CMD_WRITE_ZEROES get out of a holding pattern on all the > other patches in the queue being flushed...). So NBD will have the > bdrv_co_pwrite_zeroes callback, but that doesn't mean it will always > work - if the server doesn't support it, calling bdrv_co_pwrite_zeroes > will fail with -ENOTSUP and fall back to less-efficient writes that need > to be accounted for.
Good point! Optimizations are tricky :-). Stefan
signature.asc
Description: PGP signature