提交 d6bf279e 编写于 作者: L Luiz Capitulino

block: iostatus: Drop BDRV_IOS_INVAL

A future commit will convert bdrv_info() to the QAPI and it won't
provide IOS_INVAL.

Luckily all we have to do is to add a new 'iostatus_enabled'
member to BlockDriverState and use it instead.
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 de0b36b6
...@@ -3139,6 +3139,7 @@ int bdrv_in_use(BlockDriverState *bs) ...@@ -3139,6 +3139,7 @@ int bdrv_in_use(BlockDriverState *bs)
void bdrv_iostatus_enable(BlockDriverState *bs) void bdrv_iostatus_enable(BlockDriverState *bs)
{ {
bs->iostatus_enabled = true;
bs->iostatus = BDRV_IOS_OK; bs->iostatus = BDRV_IOS_OK;
} }
...@@ -3146,7 +3147,7 @@ void bdrv_iostatus_enable(BlockDriverState *bs) ...@@ -3146,7 +3147,7 @@ void bdrv_iostatus_enable(BlockDriverState *bs)
* enables it _and_ the VM is configured to stop on errors */ * enables it _and_ the VM is configured to stop on errors */
bool bdrv_iostatus_is_enabled(const BlockDriverState *bs) bool bdrv_iostatus_is_enabled(const BlockDriverState *bs)
{ {
return (bs->iostatus != BDRV_IOS_INVAL && return (bs->iostatus_enabled &&
(bs->on_write_error == BLOCK_ERR_STOP_ENOSPC || (bs->on_write_error == BLOCK_ERR_STOP_ENOSPC ||
bs->on_write_error == BLOCK_ERR_STOP_ANY || bs->on_write_error == BLOCK_ERR_STOP_ANY ||
bs->on_read_error == BLOCK_ERR_STOP_ANY)); bs->on_read_error == BLOCK_ERR_STOP_ANY));
...@@ -3154,7 +3155,7 @@ bool bdrv_iostatus_is_enabled(const BlockDriverState *bs) ...@@ -3154,7 +3155,7 @@ bool bdrv_iostatus_is_enabled(const BlockDriverState *bs)
void bdrv_iostatus_disable(BlockDriverState *bs) void bdrv_iostatus_disable(BlockDriverState *bs)
{ {
bs->iostatus = BDRV_IOS_INVAL; bs->iostatus_enabled = false;
} }
void bdrv_iostatus_reset(BlockDriverState *bs) void bdrv_iostatus_reset(BlockDriverState *bs)
......
...@@ -78,8 +78,7 @@ typedef enum { ...@@ -78,8 +78,7 @@ typedef enum {
} BlockMonEventAction; } BlockMonEventAction;
typedef enum { typedef enum {
BDRV_IOS_INVAL, BDRV_IOS_OK, BDRV_IOS_FAILED, BDRV_IOS_ENOSPC, BDRV_IOS_OK, BDRV_IOS_FAILED, BDRV_IOS_ENOSPC, BDRV_IOS_MAX
BDRV_IOS_MAX
} BlockIOStatus; } BlockIOStatus;
void bdrv_iostatus_enable(BlockDriverState *bs); void bdrv_iostatus_enable(BlockDriverState *bs);
......
...@@ -202,6 +202,7 @@ struct BlockDriverState { ...@@ -202,6 +202,7 @@ struct BlockDriverState {
drivers. They are not used by the block driver */ drivers. They are not used by the block driver */
int cyls, heads, secs, translation; int cyls, heads, secs, translation;
BlockErrorAction on_read_error, on_write_error; BlockErrorAction on_read_error, on_write_error;
bool iostatus_enabled;
BlockIOStatus iostatus; BlockIOStatus iostatus;
char device_name[32]; char device_name[32];
unsigned long *dirty_bitmap; unsigned long *dirty_bitmap;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册