On 08.09.2014 15:49, Paolo Bonzini wrote:
Il 08/09/2014 15:44, Benoît Canet ha scritto:
+ if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_transfer_length)
{
+ error_report("read of %d sectors at sector %ld exceeds device max"
+ " transfer length of %d sectors.", nb_sectors, sector_num,
+ bs->bl.max_transfer_length);
+ return -EINVAL;
+ }
+
return bdrv_co_do_preadv(bs, sector_num << BDRV_SECTOR_BITS,
nb_sectors << BDRV_SECTOR_BITS, qiov, flags);
}
@@ -3507,6 +3514,13 @@ static int coroutine_fn
bdrv_co_do_writev(BlockDriverState *bs,
return -EINVAL;
}
+ if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_transfer_length) {
+ error_report("write of %d sectors at sector %ld exceeds device max"
+ " transfer length of %d sectors.", nb_sectors, sector_num,
+ bs->bl.max_transfer_length);
+ return -EINVAL;
+ }
+
return bdrv_co_do_pwritev(bs, sector_num << BDRV_SECTOR_BITS,
nb_sectors << BDRV_SECTOR_BITS, qiov, flags);
}
--
1.7.9.5
Look like you are changing the coroutine version.
Some hardware like virtio-blk uses the AIO version of read and writes.
What would happen if all the block drivers down the chain are AIO enabled ?
The AIO version still goes through bdrv_co_do_readv/writev.
However, error_report is not something you can use for guest-accessible
error messages, unless you want your logs to fill up with error messages. :)
So you would not throw an error msg here?
Peter