Commit 6bd01f14 authored by Eric Blake's avatar Eric Blake Committed by Stefan Hajnoczi
Browse files

iscsi: Rely on block layer to break up large requests



Now that the block layer honors max_request, we don't need to
bother with an EINVAL on overlarge requests, but can instead
assert that requests are well-behaved.

Signed-off-by: default avatarEric Blake <eblake@redhat.com>
Reviewed-by: default avatarFam Zheng <famz@redhat.com>
Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Message-id: 1468607524-19021-7-git-send-email-eblake@redhat.com
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent 1e2a77a8
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -586,11 +586,8 @@ iscsi_co_writev_flags(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
        return -EINVAL;
    }

    if (bs->bl.max_transfer &&
        nb_sectors << BDRV_SECTOR_BITS > bs->bl.max_transfer) {
        error_report("iSCSI Error: Write of %d sectors exceeds max_xfer_len "
                     "of %" PRIu32 " bytes", nb_sectors, bs->bl.max_transfer);
        return -EINVAL;
    if (bs->bl.max_transfer) {
        assert(nb_sectors << BDRV_SECTOR_BITS <= bs->bl.max_transfer);
    }

    lba = sector_qemu2lun(sector_num, iscsilun);
@@ -754,11 +751,8 @@ static int coroutine_fn iscsi_co_readv(BlockDriverState *bs,
        return -EINVAL;
    }

    if (bs->bl.max_transfer &&
        nb_sectors << BDRV_SECTOR_BITS > bs->bl.max_transfer) {
        error_report("iSCSI Error: Read of %d sectors exceeds max_xfer_len "
                     "of %" PRIu32 " bytes", nb_sectors, bs->bl.max_transfer);
        return -EINVAL;
    if (bs->bl.max_transfer) {
        assert(nb_sectors << BDRV_SECTOR_BITS <= bs->bl.max_transfer);
    }

    /* if cache.direct is off and we have a valid entry in our allocation map