Commit c4c41a0a authored by Eric Farman's avatar Eric Farman Committed by Paolo Bonzini

block: get max_transfer limit for char (scsi-generic) devices

We can get the maximum number of bytes for a single I/O transfer
from the BLKSECTGET ioctl, but we only perform this for block
devices.  scsi-generic devices are represented as character devices,
and so do not issue this today.  Update this, so that virtio-scsi
devices using the scsi-generic interface can return the same data.
Signed-off-by: 's avatarEric Farman <>
Message-Id: <>
Reviewed-by: 's avatarFam Zheng <>
Signed-off-by: 's avatarPaolo Bonzini <>
parent 48265250
...@@ -674,7 +674,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp) ...@@ -674,7 +674,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
struct stat st; struct stat st;
if (!fstat(s->fd, &st)) { if (!fstat(s->fd, &st)) {
if (S_ISBLK(st.st_mode)) { if (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)) {
int ret = hdev_get_max_transfer_length(bs, s->fd); int ret = hdev_get_max_transfer_length(bs, s->fd);
if (ret > 0 && ret <= BDRV_REQUEST_MAX_BYTES) { if (ret > 0 && ret <= BDRV_REQUEST_MAX_BYTES) {
bs->bl.max_transfer = pow2floor(ret); bs->bl.max_transfer = pow2floor(ret);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment