@@ -251,7 +251,11 @@ static void raw_probe_alignment(BlockDriverState *bs, Error **errp)
251
251
& dg .Geometry .BytesPerSector ,
252
252
& freeClusters , & totalClusters );
253
253
bs -> bl .request_alignment = dg .Geometry .BytesPerSector ;
254
+ return ;
254
255
}
256
+
257
+ /* XXX Does Windows support AIO on less than 512-byte alignment? */
258
+ bs -> bl .request_alignment = 512 ;
255
259
}
256
260
257
261
static void raw_parse_flags (int flags , bool use_aio , int * access_flags ,
@@ -410,32 +414,32 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
410
414
return ret ;
411
415
}
412
416
413
- static BlockAIOCB * raw_aio_readv (BlockDriverState * bs ,
414
- int64_t sector_num , QEMUIOVector * qiov , int nb_sectors ,
415
- BlockCompletionFunc * cb , void * opaque )
417
+ static BlockAIOCB * raw_aio_preadv (BlockDriverState * bs ,
418
+ uint64_t offset , uint64_t bytes ,
419
+ QEMUIOVector * qiov , int flags ,
420
+ BlockCompletionFunc * cb , void * opaque )
416
421
{
417
422
BDRVRawState * s = bs -> opaque ;
418
423
if (s -> aio ) {
419
- return win32_aio_submit (bs , s -> aio , s -> hfile , sector_num , qiov ,
420
- nb_sectors , cb , opaque , QEMU_AIO_READ );
424
+ return win32_aio_submit (bs , s -> aio , s -> hfile , offset , bytes , qiov ,
425
+ cb , opaque , QEMU_AIO_READ );
421
426
} else {
422
- return paio_submit (bs , s -> hfile , sector_num << BDRV_SECTOR_BITS , qiov ,
423
- nb_sectors << BDRV_SECTOR_BITS ,
427
+ return paio_submit (bs , s -> hfile , offset , qiov , bytes ,
424
428
cb , opaque , QEMU_AIO_READ );
425
429
}
426
430
}
427
431
428
- static BlockAIOCB * raw_aio_writev (BlockDriverState * bs ,
429
- int64_t sector_num , QEMUIOVector * qiov , int nb_sectors ,
430
- BlockCompletionFunc * cb , void * opaque )
432
+ static BlockAIOCB * raw_aio_pwritev (BlockDriverState * bs ,
433
+ uint64_t offset , uint64_t bytes ,
434
+ QEMUIOVector * qiov , int flags ,
435
+ BlockCompletionFunc * cb , void * opaque )
431
436
{
432
437
BDRVRawState * s = bs -> opaque ;
433
438
if (s -> aio ) {
434
- return win32_aio_submit (bs , s -> aio , s -> hfile , sector_num , qiov ,
435
- nb_sectors , cb , opaque , QEMU_AIO_WRITE );
439
+ return win32_aio_submit (bs , s -> aio , s -> hfile , offset , bytes , qiov ,
440
+ cb , opaque , QEMU_AIO_WRITE );
436
441
} else {
437
- return paio_submit (bs , s -> hfile , sector_num << BDRV_SECTOR_BITS , qiov ,
438
- nb_sectors << BDRV_SECTOR_BITS ,
442
+ return paio_submit (bs , s -> hfile , offset , qiov , bytes ,
439
443
cb , opaque , QEMU_AIO_WRITE );
440
444
}
441
445
}
@@ -632,8 +636,8 @@ BlockDriver bdrv_file = {
632
636
.bdrv_co_create_opts = raw_co_create_opts ,
633
637
.bdrv_has_zero_init = bdrv_has_zero_init_1 ,
634
638
635
- .bdrv_aio_readv = raw_aio_readv ,
636
- .bdrv_aio_writev = raw_aio_writev ,
639
+ .bdrv_aio_preadv = raw_aio_preadv ,
640
+ .bdrv_aio_pwritev = raw_aio_pwritev ,
637
641
.bdrv_aio_flush = raw_aio_flush ,
638
642
639
643
.bdrv_truncate = raw_truncate ,
@@ -708,6 +712,12 @@ static void hdev_parse_filename(const char *filename, QDict *options,
708
712
bdrv_parse_filename_strip_prefix (filename , "host_device:" , options );
709
713
}
710
714
715
+ static void hdev_refresh_limits (BlockDriverState * bs , Error * * errp )
716
+ {
717
+ /* XXX Does Windows support AIO on less than 512-byte alignment? */
718
+ bs -> bl .request_alignment = 512 ;
719
+ }
720
+
711
721
static int hdev_open (BlockDriverState * bs , QDict * options , int flags ,
712
722
Error * * errp )
713
723
{
@@ -793,9 +803,10 @@ static BlockDriver bdrv_host_device = {
793
803
.bdrv_probe_device = hdev_probe_device ,
794
804
.bdrv_file_open = hdev_open ,
795
805
.bdrv_close = raw_close ,
806
+ .bdrv_refresh_limits = hdev_refresh_limits ,
796
807
797
- .bdrv_aio_readv = raw_aio_readv ,
798
- .bdrv_aio_writev = raw_aio_writev ,
808
+ .bdrv_aio_preadv = raw_aio_preadv ,
809
+ .bdrv_aio_pwritev = raw_aio_pwritev ,
799
810
.bdrv_aio_flush = raw_aio_flush ,
800
811
801
812
.bdrv_detach_aio_context = raw_detach_aio_context ,
0 commit comments