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

block: Don't call bdrv_eject() if the tray state didn't change

It's not needed. Besides we can then assume that bdrv_eject() is
only called when there's a tray state change, which is useful to
the DEVICE_TRAY_MOVED event (going to be added in a future
commit).
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
Acked-by: NKevin Wolf <kwolf@redhat.com>
上级 f36f3949
......@@ -883,8 +883,11 @@ static void cmd_start_stop_unit(IDEState *s, uint8_t* buf)
ide_atapi_cmd_error(s, sense, ASC_MEDIA_REMOVAL_PREVENTED);
return;
}
bdrv_eject(s->bs, !start);
s->tray_open = !start;
if (s->tray_open != !start) {
bdrv_eject(s->bs, !start);
s->tray_open = !start;
}
}
ide_atapi_cmd_ok(s);
......
......@@ -1050,8 +1050,11 @@ static int scsi_disk_emulate_start_stop(SCSIDiskReq *r)
: SENSE_CODE(NOT_READY_REMOVAL_PREVENTED));
return -1;
}
bdrv_eject(s->qdev.conf.bs, !start);
s->tray_open = !start;
if (s->tray_open != !start) {
bdrv_eject(s->qdev.conf.bs, !start);
s->tray_open = !start;
}
}
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册