Am 10.07.2018 um 08:31 hat Fam Zheng geschrieben: > Reuse the new bdrv_co_write_req_prepare/finish helpers. The variation > here is that discard requests don't affect bs->wr_highest_offset, and it > cannot extend the image. > > Signed-off-by: Fam Zheng <f...@redhat.com> > --- > block/io.c | 32 ++++++++++++++++++++++---------- > 1 file changed, 22 insertions(+), 10 deletions(-) > > diff --git a/block/io.c b/block/io.c > index 10a475302a..cc426bab2e 100644 > --- a/block/io.c > +++ b/block/io.c > @@ -1601,15 +1601,31 @@ bdrv_co_write_req_finish(BdrvChild *child, int64_t > offset, uint64_t bytes, > > atomic_inc(&bs->write_gen); > > - stat64_max(&bs->wr_highest_offset, offset + bytes); > - > + /* Discard cannot extend the image, but in error handling cases, such as > + * when reverting a qcow2 cluster allocation, the discarded range can > pass > + * the end of image file, so we cannot assert about BDRV_TRACKED_DISCARD > + * here. Instead, just skip it, since semantically a discard request > + * beyond EOF cannot expand the image anyway. > + * */
Oh, yet another style for the end of a multiline comment. :-) I'll fix this while applying. Kevin