summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2022-03-03 20:43:40 +0100
committerHanna Reitz <hreitz@redhat.com>2022-03-07 09:33:30 +0100
commit84b1e80f67f74a9d505802343458d4ebe8bdb3e4 (patch)
treeaa4b15a666d7a4a9b8b615a40763c1132c1d030d
parentd088e6a48aa437b2bf706a5f6cc4967f0eceba64 (diff)
downloadfocaccia-qemu-84b1e80f67f74a9d505802343458d4ebe8bdb3e4.tar.gz
focaccia-qemu-84b1e80f67f74a9d505802343458d4ebe8bdb3e4.zip
block/reqlist: reqlist_find_conflict(): use ranges_overlap()
Let's reuse convenient helper.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220303194349.2304213-8-vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
-rw-r--r--block/reqlist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/reqlist.c b/block/reqlist.c
index 5e320ba649..09fecbd48c 100644
--- a/block/reqlist.c
+++ b/block/reqlist.c
@@ -13,6 +13,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/range.h"
 
 #include "block/reqlist.h"
 
@@ -35,7 +36,7 @@ BlockReq *reqlist_find_conflict(BlockReqList *reqs, int64_t offset,
     BlockReq *r;
 
     QLIST_FOREACH(r, reqs, list) {
-        if (offset + bytes > r->offset && offset < r->offset + r->bytes) {
+        if (ranges_overlap(offset, bytes, r->offset, r->bytes)) {
             return r;
         }
     }