From patchwork Mon Jan 14 15:26:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 211809 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C689B2C00A0 for ; Tue, 15 Jan 2013 02:36:32 +1100 (EST) Received: from localhost ([::1]:57606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TulxL-0005zZ-Rk for incoming@patchwork.ozlabs.org; Mon, 14 Jan 2013 10:28:11 -0500 Received: from eggs.gnu.org ([208.118.235.92]:32948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TulwY-00049l-7t for qemu-devel@nongnu.org; Mon, 14 Jan 2013 10:27:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TulwS-0002nQ-B5 for qemu-devel@nongnu.org; Mon, 14 Jan 2013 10:27:22 -0500 Received: from mail-qc0-f181.google.com ([209.85.216.181]:42051) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TulwS-0002nK-43 for qemu-devel@nongnu.org; Mon, 14 Jan 2013 10:27:16 -0500 Received: by mail-qc0-f181.google.com with SMTP id x40so2594974qcp.12 for ; Mon, 14 Jan 2013 07:27:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=CtFw+iUfZb2U3mgM0eO/1uMcInvGHyWoaA9ceNN8yjg=; b=JA9YNNb0hISUrhG4lxemIBQD2QF6AGl2RxaAk6EdsTYUGQjVY+k46lRb0mWF5blUNp mM2LJ/5TDLRkujo1TyQQydlnMrU+VXmzVO/d3Fidt917cH2WDjPOUBpiQ4gVA9guhkMH j422IhSHGwA1WCWazSLdScUIKBPGzyVzCrNjpF/ZVZVK8esUiLYtBi3hgVzvgfh8A3DN tzsOP9AI6ES2vb7Vn0ez2Z2Ub50L+WwQUy6NXSrQ3MY7QO5hZWiBrk/wTHYX5QFYNFHI r6OPZgIjcc1T9WdK3rvMOMLSNe4EKBZiNk5zCWnDjn0Nl3NctvPsZGD+QsAlSP/kSOun Uv2w== X-Received: by 10.224.196.196 with SMTP id eh4mr45925095qab.68.1358177235782; Mon, 14 Jan 2013 07:27:15 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-179-137.ip50.fastwebnet.it. [93.34.179.137]) by mx.google.com with ESMTPS id t2sm6157728qav.1.2013.01.14.07.27.13 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 14 Jan 2013 07:27:15 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2013 16:26:56 +0100 Message-Id: <1358177218-16802-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1358177218-16802-1-git-send-email-pbonzini@redhat.com> References: <1358177218-16802-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.216.181 Cc: kwolf@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH 5/7] ide: fix TRIM with empty range entry X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org ATA-ACS-3 says "If the two byte range length is zero, then the LBA Range Entry shall be discarded as padding." iovecs are used as if they are linearized, so it is incorrect to discard the rest of this iovec. Signed-off-by: Paolo Bonzini --- hw/ide/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index 6f1938a..cb77dfc 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -374,7 +374,7 @@ BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs, uint16_t count = entry >> 48; if (count == 0) { - break; + continue; } ret = bdrv_discard(bs, sector, count);