From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPuFk-0002qJ-7f for qemu-devel@nongnu.org; Wed, 20 Jul 2016 12:21:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPuFi-0004Zc-AR for qemu-devel@nongnu.org; Wed, 20 Jul 2016 12:21:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPuFi-0004ZY-4w for qemu-devel@nongnu.org; Wed, 20 Jul 2016 12:21:42 -0400 From: Stefan Hajnoczi Date: Wed, 20 Jul 2016 17:21:03 +0100 Message-Id: <1469031682-21863-7-git-send-email-stefanha@redhat.com> In-Reply-To: <1469031682-21863-1-git-send-email-stefanha@redhat.com> References: <1469031682-21863-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL v2 06/25] iscsi: Rely on block layer to break up large requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric Blake , Stefan Hajnoczi From: Eric Blake 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: Eric Blake Reviewed-by: Fam Zheng Reviewed-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-id: 1468607524-19021-7-git-send-email-eblake@redhat.com Signed-off-by: Stefan Hajnoczi --- block/iscsi.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index 129c3af..5602abd 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -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 -- 2.7.4