From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Kevin Wolf 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> Subject: [Qemu-devel] [RFC PATCH 02/19] block: Detect unaligned length in bdrv_qiov_is_aligned() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, armbru@redhat.com, stefanha@redhat.com 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; -- 1.8.1.4