cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-backend-Reorder-flush-pdiscard-function-defini.patch

902636
From 6cc456c4c1e6557fdc7e138e8ef8171b71609222 Mon Sep 17 00:00:00 2001
902636
From: Kevin Wolf <kwolf@redhat.com>
902636
Date: Wed, 8 Apr 2020 17:29:15 +0100
902636
Subject: [PATCH 4/6] block-backend: Reorder flush/pdiscard function
902636
 definitions
902636
902636
RH-Author: Kevin Wolf <kwolf@redhat.com>
902636
Message-id: <20200408172917.18712-5-kwolf@redhat.com>
902636
Patchwork-id: 94598
902636
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 4/6] block-backend: Reorder flush/pdiscard function definitions
902636
Bugzilla: 1817621
902636
RH-Acked-by: Eric Blake <eblake@redhat.com>
902636
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
902636
RH-Acked-by: Max Reitz <mreitz@redhat.com>
902636
902636
Move all variants of the flush/pdiscard functions to a single place and
902636
put the blk_co_*() version first because it is called by all other
902636
variants (and will become static in the next patch).
902636
902636
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
902636
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
902636
Reviewed-by: Max Reitz <mreitz@redhat.com>
902636
Message-Id: <20200407121259.21350-2-kwolf@redhat.com>
902636
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
902636
(cherry picked from commit 564806c529d4e0acad209b1e5b864a8886092f1f)
902636
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
902636
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
902636
---
902636
 block/block-backend.c | 92 +++++++++++++++++++++++++--------------------------
902636
 1 file changed, 46 insertions(+), 46 deletions(-)
902636
902636
diff --git a/block/block-backend.c b/block/block-backend.c
902636
index 8b8f2a8..17b2e87 100644
902636
--- a/block/block-backend.c
902636
+++ b/block/block-backend.c
902636
@@ -1488,38 +1488,6 @@ BlockAIOCB *blk_aio_pwritev(BlockBackend *blk, int64_t offset,
902636
                         blk_aio_write_entry, flags, cb, opaque);
902636
 }
902636
 
902636
-static void blk_aio_flush_entry(void *opaque)
902636
-{
902636
-    BlkAioEmAIOCB *acb = opaque;
902636
-    BlkRwCo *rwco = &acb->rwco;
902636
-
902636
-    rwco->ret = blk_co_flush(rwco->blk);
902636
-    blk_aio_complete(acb);
902636
-}
902636
-
902636
-BlockAIOCB *blk_aio_flush(BlockBackend *blk,
902636
-                          BlockCompletionFunc *cb, void *opaque)
902636
-{
902636
-    return blk_aio_prwv(blk, 0, 0, NULL, blk_aio_flush_entry, 0, cb, opaque);
902636
-}
902636
-
902636
-static void blk_aio_pdiscard_entry(void *opaque)
902636
-{
902636
-    BlkAioEmAIOCB *acb = opaque;
902636
-    BlkRwCo *rwco = &acb->rwco;
902636
-
902636
-    rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, acb->bytes);
902636
-    blk_aio_complete(acb);
902636
-}
902636
-
902636
-BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk,
902636
-                             int64_t offset, int bytes,
902636
-                             BlockCompletionFunc *cb, void *opaque)
902636
-{
902636
-    return blk_aio_prwv(blk, offset, bytes, NULL, blk_aio_pdiscard_entry, 0,
902636
-                        cb, opaque);
902636
-}
902636
-
902636
 void blk_aio_cancel(BlockAIOCB *acb)
902636
 {
902636
     bdrv_aio_cancel(acb);
902636
@@ -1586,6 +1554,37 @@ int blk_co_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
902636
     return bdrv_co_pdiscard(blk->root, offset, bytes);
902636
 }
902636
 
902636
+static void blk_aio_pdiscard_entry(void *opaque)
902636
+{
902636
+    BlkAioEmAIOCB *acb = opaque;
902636
+    BlkRwCo *rwco = &acb->rwco;
902636
+
902636
+    rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, acb->bytes);
902636
+    blk_aio_complete(acb);
902636
+}
902636
+
902636
+BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk,
902636
+                             int64_t offset, int bytes,
902636
+                             BlockCompletionFunc *cb, void *opaque)
902636
+{
902636
+    return blk_aio_prwv(blk, offset, bytes, NULL, blk_aio_pdiscard_entry, 0,
902636
+                        cb, opaque);
902636
+}
902636
+
902636
+static void blk_pdiscard_entry(void *opaque)
902636
+{
902636
+    BlkRwCo *rwco = opaque;
902636
+    QEMUIOVector *qiov = rwco->iobuf;
902636
+
902636
+    rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, qiov->size);
902636
+    aio_wait_kick();
902636
+}
902636
+
902636
+int blk_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
902636
+{
902636
+    return blk_prw(blk, offset, NULL, bytes, blk_pdiscard_entry, 0);
902636
+}
902636
+
902636
 int blk_co_flush(BlockBackend *blk)
902636
 {
902636
     blk_wait_while_drained(blk);
902636
@@ -1597,6 +1596,21 @@ int blk_co_flush(BlockBackend *blk)
902636
     return bdrv_co_flush(blk_bs(blk));
902636
 }
902636
 
902636
+static void blk_aio_flush_entry(void *opaque)
902636
+{
902636
+    BlkAioEmAIOCB *acb = opaque;
902636
+    BlkRwCo *rwco = &acb->rwco;
902636
+
902636
+    rwco->ret = blk_co_flush(rwco->blk);
902636
+    blk_aio_complete(acb);
902636
+}
902636
+
902636
+BlockAIOCB *blk_aio_flush(BlockBackend *blk,
902636
+                          BlockCompletionFunc *cb, void *opaque)
902636
+{
902636
+    return blk_aio_prwv(blk, 0, 0, NULL, blk_aio_flush_entry, 0, cb, opaque);
902636
+}
902636
+
902636
 static void blk_flush_entry(void *opaque)
902636
 {
902636
     BlkRwCo *rwco = opaque;
902636
@@ -2083,20 +2097,6 @@ int blk_truncate(BlockBackend *blk, int64_t offset, bool exact,
902636
     return bdrv_truncate(blk->root, offset, exact, prealloc, errp);
902636
 }
902636
 
902636
-static void blk_pdiscard_entry(void *opaque)
902636
-{
902636
-    BlkRwCo *rwco = opaque;
902636
-    QEMUIOVector *qiov = rwco->iobuf;
902636
-
902636
-    rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, qiov->size);
902636
-    aio_wait_kick();
902636
-}
902636
-
902636
-int blk_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
902636
-{
902636
-    return blk_prw(blk, offset, NULL, bytes, blk_pdiscard_entry, 0);
902636
-}
902636
-
902636
 int blk_save_vmstate(BlockBackend *blk, const uint8_t *buf,
902636
                      int64_t pos, int size)
902636
 {
902636
-- 
902636
1.8.3.1
902636