From patchwork Tue Jun 21 03:19:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 9189217 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 16AA960756 for ; Tue, 21 Jun 2016 03:20:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 080C227F89 for ; Tue, 21 Jun 2016 03:20:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF9FB27F8F; Tue, 21 Jun 2016 03:20:01 +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 7B53927F89 for ; Tue, 21 Jun 2016 03:20:01 +0000 (UTC) Received: from localhost ([::1]:47718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFCEK-0001i5-0v for patchwork-qemu-devel@patchwork.kernel.org; Mon, 20 Jun 2016 23:20:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFCE1-0001ho-Pi for qemu-devel@nongnu.org; Mon, 20 Jun 2016 23:19:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFCDv-0000Ko-Qd for qemu-devel@nongnu.org; Mon, 20 Jun 2016 23:19:40 -0400 Received: from resqmta-po-11v.sys.comcast.net ([2001:558:fe16:19:96:114:154:170]:41825 helo=resqmta-ch2-11v.sys.comcast.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFCDv-0000Kg-Kk for qemu-devel@nongnu.org; Mon, 20 Jun 2016 23:19:35 -0400 Received: from resomta-po-20v.sys.comcast.net ([96.114.154.244]) by resqmta-po-11v.sys.comcast.net with SMTP id FCDbbnNa6mNqqFCDubL4Wd; Tue, 21 Jun 2016 03:19:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1466479174; bh=xPkRdpYjxbo+Zc/ULZCj1YwlwpUAsbSE0EpDVUSPmaE=; h=Received:Received:From:To:Subject:Date:Message-Id; b=Jip/sAi1M5dXmkXdYIlfWzNJBMQuE0cOR8XMRHjZ6c48+4NxGnMoMkxN7K7O33DAz 1teCMHM38MDjtcyWXd3RDSESwS8A1OjCALH7bk/E40cSjMbBZ0hSTJAWZ8FguiawAB Om2HrSKYfZlPmPXLkDS1I4XE7KpO/qr7KVlCpJpKsVmXu7eY0ODBvfd2NS+KIF4cTY 9BBNTciwKqDoXaGrWFZRTAP0FZ5JXQyY++SIq9miepyqV9AD6tBNPH5375DOCpSC2D GQTqmHeOhd5hoc8SOoCIK7ZAWe3+ydavQAcLnzq2N9nKNF0NukSQZGoSF4AUjhHohh UP1a/QwF620ZA== Received: from red.redhat.com ([24.10.254.122]) by resomta-po-20v.sys.comcast.net with comcast id 9FKX1t00B2fD5rL01FKZLa; Tue, 21 Jun 2016 03:19:34 +0000 From: Eric Blake To: qemu-devel@nongnu.org Date: Mon, 20 Jun 2016 21:19:29 -0600 Message-Id: <1466479169-26893-1-git-send-email-eblake@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466465969-25315-1-git-send-email-eblake@redhat.com> References: <1466465969-25315-1-git-send-email-eblake@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:558:fe16:19:96:114:154:170 Subject: [Qemu-devel] [PATCH 6/5] 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, 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 --- block/iscsi.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index 16d7522..0f027ce 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 &&