thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 3015984eb6778214d381cf7de32d8ab81e277728 Mon Sep 17 00:00:00 2001
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Date: Thu, 5 Dec 2013 13:01:46 +0100
9ae3a8
Subject: [PATCH 07/37] block: Detect unaligned length in bdrv_qiov_is_aligned()
9ae3a8
9ae3a8
Message-id: <1392117622-28812-8-git-send-email-kwolf@redhat.com>
9ae3a8
Patchwork-id: 57172
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 07/37] block: Detect unaligned length in bdrv_qiov_is_aligned()
9ae3a8
Bugzilla: 748906
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
9ae3a8
For an O_DIRECT request to succeed, it's not only necessary that all
9ae3a8
base addresses in the qiov are aligned, but also that each length in it
9ae3a8
is aligned.
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
9ae3a8
Reviewed-by: Max Reitz <mreitz@redhat.com>
9ae3a8
(cherry picked from commit 1ff735bdc417945bc6df1857861b127644b3f461)
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
---
9ae3a8
 block.c | 3 +++
9ae3a8
 1 file changed, 3 insertions(+)
9ae3a8
---
9ae3a8
 block.c |    3 +++
9ae3a8
 1 files changed, 3 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/block.c b/block.c
9ae3a8
index f62acbd..6c98ff7 100644
9ae3a8
--- a/block.c
9ae3a8
+++ b/block.c
9ae3a8
@@ -4743,6 +4743,9 @@ bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
9ae3a8
         if ((uintptr_t) qiov->iov[i].iov_base % bs->buffer_alignment) {
9ae3a8
             return false;
9ae3a8
         }
9ae3a8
+        if (qiov->iov[i].iov_len % bs->buffer_alignment) {
9ae3a8
+            return false;
9ae3a8
+        }
9ae3a8
     }
9ae3a8
 
9ae3a8
     return true;
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8