mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
block: use bdrv_is_sg() helper instead of raw bs->sg reading
I believe that if the helper exists, it must be used always for reading of the value. It breaks expectations in the other case. Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Kevin Wolf <kwolf@redhat.com> CC: Hanna Reitz <hreitz@redhat.com> CC: Stefan Hajnoczi <stefanha@redhat.com> CC: Fam Zheng <fam@euphon.net> CC: Ronnie Sahlberg <ronniesahlberg@gmail.com> CC: Paolo Bonzini <pbonzini@redhat.com> CC: Peter Lieven <pl@kamp.de> CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Message-Id: <20220817083736.40981-2-den@openvz.org> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
62a6c300f1
commit
006e196244
3 changed files with 4 additions and 4 deletions
|
@ -463,7 +463,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
bs->sg = bs->file->bs->sg;
|
||||
bs->sg = bdrv_is_sg(bs->file->bs);
|
||||
bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED |
|
||||
(BDRV_REQ_FUA & bs->file->bs->supported_write_flags);
|
||||
bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
|
||||
|
@ -489,7 +489,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (bs->sg && (s->offset || s->has_size)) {
|
||||
if (bdrv_is_sg(bs) && (s->offset || s->has_size)) {
|
||||
error_setg(errp, "Cannot use offset/size with SCSI generic devices");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue