From patchwork Fri Jul 8 22:36:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 9221859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7929B6089D for ; Fri, 8 Jul 2016 22:40:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69BFF285F0 for ; Fri, 8 Jul 2016 22:40:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E6C6285F2; Fri, 8 Jul 2016 22:40:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 053B3285F0 for ; Fri, 8 Jul 2016 22:40:32 +0000 (UTC) Received: from localhost ([::1]:48090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLeRj-0005ft-7Z for patchwork-qemu-devel@patchwork.kernel.org; Fri, 08 Jul 2016 18:40:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLeNb-0002cs-Vo for qemu-devel@nongnu.org; Fri, 08 Jul 2016 18:36:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLeNZ-0006eS-SK for qemu-devel@nongnu.org; Fri, 08 Jul 2016 18:36:14 -0400 Received: from resqmta-po-02v.sys.comcast.net ([2001:558:fe16:19:96:114:154:161]:58589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLeNZ-0006e2-LQ for qemu-devel@nongnu.org; Fri, 08 Jul 2016 18:36:13 -0400 Received: from resomta-po-17v.sys.comcast.net ([96.114.154.241]) by resqmta-po-02v.sys.comcast.net with SMTP id LeNBbdsxhBAXOLeNZbtu8e; Fri, 08 Jul 2016 22:36:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1468017373; bh=MyU9AnuPIHT6GI9LXwTgwXm2pfT061febSCoFWOptjQ=; h=Received:Received:From:To:Subject:Date:Message-Id; b=DqZD4+tH5p5GDqYiYJ6UWMAguMqc2VfAm1x5NcRCRbKBPsaymaFcXmchmcON364ra Loee2IBEB0xFcsijOVLB7hiSMrCUCD9804zl88hbNuBny4zofOb37K8LhP3xfRMIac 407Wuhwq/YMw4V8cnQWR7CU2tVG3BoDoxRNllcZRm1dZ6GbvV877jS95k0p3oQH8A9 lRdBRbm0Krv3r2AKnvM73bGIecoHHGSlrgjQFVUG2uKN4P3osISLh05iWydeYhPh0y vjUq3gSxsJKggkUvKoW5ceOOuDkqURANodNiF6M7osxP4KG54pYSIRxNT2Ld+PVnl6 gyAhNMlofsRnQ== Received: from red.redhat.com ([24.10.254.122]) by comcast with SMTP id LeNQbet4p7kaYLeNYbeddK; Fri, 08 Jul 2016 22:36:13 +0000 From: Eric Blake To: qemu-devel@nongnu.org Date: Fri, 8 Jul 2016 16:36:04 -0600 Message-Id: <1468017364-25980-7-git-send-email-eblake@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1468017364-25980-1-git-send-email-eblake@redhat.com> References: <1468017364-25980-1-git-send-email-eblake@redhat.com> X-CMAE-Envelope: MS4wfKnuVRWixVoX5j+i6WHna7CgraU7TbFzAzjng0GLMNVwVgGolyXDy4FWmWthvi1vF4o13XnyVHZH7L1NnnGu3q2RPDTzNET0hbvC+uVWvc94CEI0O5N8 tg0rUdHuUp/Z6nJ56KGYsY9sEboltzrbETUfWw1GMLbUGf8e7GT/ZK96A38eoSpZCr5WQExoN1oNGeMq6Cgek+5Zt9PVjZa3Q4I8CExUYN5uNviFfySatowB FxBhuvDT87OHAwxoGv58uBpYg2eG7gDMqU5K4E1Ms5XDR7gYZ+RsSqUxBaGxcQ2ZzGp24ZU63e4ZlohHZSBbP1cdCYqZxwlVwkiGiD3i9wltpfTz32xvgOFB 4gfZqOKX7zXbqQi6CBU8HdbCEWKxfQ== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:558:fe16:19:96:114:154:161 Subject: [Qemu-devel] [PATCH v2 6/6] iscsi: Rely on block layer to break up large requests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, famz@redhat.com, qemu-block@nongnu.org, Peter Lieven , Max Reitz , Ronnie Sahlberg , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- block/iscsi.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index 9e62c3a..16d7d7d 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -473,11 +473,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); @@ -651,11 +648,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 (iscsilun->lbprz && nb_sectors >= ISCSI_CHECKALLOC_THRES &&