From patchwork Fri Dec 6 17:22:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 298121 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2004C2C00A8 for ; Sat, 7 Dec 2013 04:24:06 +1100 (EST) Received: from localhost ([::1]:60574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Voz8F-0001NK-Bp for incoming@patchwork.ozlabs.org; Fri, 06 Dec 2013 12:24:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Voz7a-0001DH-Oz for qemu-devel@nongnu.org; Fri, 06 Dec 2013 12:23:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Voz7U-0001mr-Pp for qemu-devel@nongnu.org; Fri, 06 Dec 2013 12:23:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22914) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Voz7U-0001mn-Ht for qemu-devel@nongnu.org; Fri, 06 Dec 2013 12:23:16 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rB6HNFNx015321 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 6 Dec 2013 12:23:16 -0500 Received: from dhcp-200-207.str.redhat.com (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rB6HNAU5012982; Fri, 6 Dec 2013 12:23:14 -0500 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Fri, 6 Dec 2013 18:22:43 +0100 Message-Id: <1386350580-5666-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1386350580-5666-1-git-send-email-kwolf@redhat.com> References: <1386350580-5666-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, pbonzini@redhat.com, armbru@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [RFC PATCH 02/19] block: Detect unaligned length in bdrv_qiov_is_aligned() 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 For an O_DIRECT request to succeed, it's not only necessary that all base addresses in the qiov are aligned, but also that each lengh in it is aligned. Signed-off-by: Kevin Wolf --- block.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block.c b/block.c index 382ea71..613201b 100644 --- a/block.c +++ b/block.c @@ -4349,6 +4349,9 @@ bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov) if ((uintptr_t) qiov->iov[i].iov_base % bs->buffer_alignment) { return false; } + if (qiov->iov[i].iov_len % bs->buffer_alignment) { + return false; + } } return true;