qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] block: use the request length for iov alignment


From: Keith Busch
Subject: [PATCH] block: use the request length for iov alignment
Date: Thu, 8 Sep 2022 09:45:26 -0700

From: Keith Busch <kbusch@kernel.org>

An iov length needs to be aligned to the logical block size, which may
be larger than the memory alignment.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 block/io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/io.c b/block/io.c
index 0a8cbefe86..296d4b49a7 100644
--- a/block/io.c
+++ b/block/io.c
@@ -3243,13 +3243,14 @@ bool bdrv_qiov_is_aligned(BlockDriverState *bs, 
QEMUIOVector *qiov)
 {
     int i;
     size_t alignment = bdrv_min_mem_align(bs);
+    size_t len = bs->bl.request_alignment;
     IO_CODE();
 
     for (i = 0; i < qiov->niov; i++) {
         if ((uintptr_t) qiov->iov[i].iov_base % alignment) {
             return false;
         }
-        if (qiov->iov[i].iov_len % alignment) {
+        if (qiov->iov[i].iov_len % len) {
             return false;
         }
     }
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]