cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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