mirror of https://github.com/xqemu/xqemu.git
block: Pull up blk_read_unthrottled() implementation
Use blk_read(), so that it goes through blk_co_preadv() like all read requests from the BB to the BDS. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
a8823a3bfd
commit
5bd5119667
|
@ -789,12 +789,20 @@ int blk_read(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
|
||||||
int blk_read_unthrottled(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
|
int blk_read_unthrottled(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
|
||||||
int nb_sectors)
|
int nb_sectors)
|
||||||
{
|
{
|
||||||
int ret = blk_check_request(blk, sector_num, nb_sectors);
|
BlockDriverState *bs = blk_bs(blk);
|
||||||
|
bool enabled;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = blk_check_request(blk, sector_num, nb_sectors);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bdrv_read_unthrottled(blk_bs(blk), sector_num, buf, nb_sectors);
|
enabled = bs->io_limits_enabled;
|
||||||
|
bs->io_limits_enabled = false;
|
||||||
|
ret = blk_read(blk, sector_num, buf, nb_sectors);
|
||||||
|
bs->io_limits_enabled = enabled;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int blk_write(BlockBackend *blk, int64_t sector_num, const uint8_t *buf,
|
int blk_write(BlockBackend *blk, int64_t sector_num, const uint8_t *buf,
|
||||||
|
|
14
block/io.c
14
block/io.c
|
@ -615,20 +615,6 @@ int bdrv_read(BlockDriverState *bs, int64_t sector_num,
|
||||||
return bdrv_rw_co(bs, sector_num, buf, nb_sectors, false, 0);
|
return bdrv_rw_co(bs, sector_num, buf, nb_sectors, false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Just like bdrv_read(), but with I/O throttling temporarily disabled */
|
|
||||||
int bdrv_read_unthrottled(BlockDriverState *bs, int64_t sector_num,
|
|
||||||
uint8_t *buf, int nb_sectors)
|
|
||||||
{
|
|
||||||
bool enabled;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
enabled = bs->io_limits_enabled;
|
|
||||||
bs->io_limits_enabled = false;
|
|
||||||
ret = bdrv_read(bs, sector_num, buf, nb_sectors);
|
|
||||||
bs->io_limits_enabled = enabled;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return < 0 if error. Important errors are:
|
/* Return < 0 if error. Important errors are:
|
||||||
-EIO generic I/O error (may happen for all errors)
|
-EIO generic I/O error (may happen for all errors)
|
||||||
-ENOMEDIUM No media inserted.
|
-ENOMEDIUM No media inserted.
|
||||||
|
|
|
@ -229,8 +229,6 @@ void bdrv_reopen_commit(BDRVReopenState *reopen_state);
|
||||||
void bdrv_reopen_abort(BDRVReopenState *reopen_state);
|
void bdrv_reopen_abort(BDRVReopenState *reopen_state);
|
||||||
int bdrv_read(BlockDriverState *bs, int64_t sector_num,
|
int bdrv_read(BlockDriverState *bs, int64_t sector_num,
|
||||||
uint8_t *buf, int nb_sectors);
|
uint8_t *buf, int nb_sectors);
|
||||||
int bdrv_read_unthrottled(BlockDriverState *bs, int64_t sector_num,
|
|
||||||
uint8_t *buf, int nb_sectors);
|
|
||||||
int bdrv_write(BlockDriverState *bs, int64_t sector_num,
|
int bdrv_write(BlockDriverState *bs, int64_t sector_num,
|
||||||
const uint8_t *buf, int nb_sectors);
|
const uint8_t *buf, int nb_sectors);
|
||||||
int bdrv_write_zeroes(BlockDriverState *bs, int64_t sector_num,
|
int bdrv_write_zeroes(BlockDriverState *bs, int64_t sector_num,
|
||||||
|
|
Loading…
Reference in New Issue