From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vqr1j-0007EN-67 for qemu-devel@nongnu.org; Wed, 11 Dec 2013 16:09:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vqr1b-0000ga-9X for qemu-devel@nongnu.org; Wed, 11 Dec 2013 16:09:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vqr1b-0000gU-1n for qemu-devel@nongnu.org; Wed, 11 Dec 2013 16:08:55 -0500 From: Kevin Wolf Date: Wed, 11 Dec 2013 22:08:12 +0100 Message-Id: <1386796109-15264-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1386796109-15264-1-git-send-email-kwolf@redhat.com> References: <1386796109-15264-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 05/22] 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, pl@kamp.de, 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 length 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 8eae359..62c5a75 100644 --- a/block.c +++ b/block.c @@ -4561,6 +4561,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