Pablo Greco e6a3ae
From 0e5a55b3556fdd23bbeeaca40a151e7062d42c1e Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: Kevin Wolf <kwolf@redhat.com>
Pablo Greco e6a3ae
Date: Wed, 14 Aug 2019 08:42:25 +0100
Pablo Greco e6a3ae
Subject: [PATCH 02/10] block-backend: Make blk_inc/dec_in_flight public
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: Kevin Wolf <kwolf@redhat.com>
Pablo Greco e6a3ae
Message-id: <20190814084229.6458-2-kwolf@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 89966
Pablo Greco e6a3ae
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 1/5] block-backend: Make blk_inc/dec_in_flight public
Pablo Greco e6a3ae
Bugzilla: 1716349
Pablo Greco e6a3ae
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Max Reitz <mreitz@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
For some users of BlockBackends, just increasing the in_flight counter
Pablo Greco e6a3ae
is easier than implementing separate handlers in BlockDevOps. Make the
Pablo Greco e6a3ae
helper functions for this public.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Pablo Greco e6a3ae
(cherry picked from commit c90e2a9cfd94bd02d92c53b97f04fd595001de7e)
Pablo Greco e6a3ae
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 block/block-backend.c          | 4 ++--
Pablo Greco e6a3ae
 include/sysemu/block-backend.h | 2 ++
Pablo Greco e6a3ae
 2 files changed, 4 insertions(+), 2 deletions(-)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/block/block-backend.c b/block/block-backend.c
Pablo Greco e6a3ae
index 0d623e4..e941520 100644
Pablo Greco e6a3ae
--- a/block/block-backend.c
Pablo Greco e6a3ae
+++ b/block/block-backend.c
Pablo Greco e6a3ae
@@ -1294,12 +1294,12 @@ int blk_make_zero(BlockBackend *blk, BdrvRequestFlags flags)
Pablo Greco e6a3ae
     return bdrv_make_zero(blk->root, flags);
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-static void blk_inc_in_flight(BlockBackend *blk)
Pablo Greco e6a3ae
+void blk_inc_in_flight(BlockBackend *blk)
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
     atomic_inc(&blk->in_flight);
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-static void blk_dec_in_flight(BlockBackend *blk)
Pablo Greco e6a3ae
+void blk_dec_in_flight(BlockBackend *blk)
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
     atomic_dec(&blk->in_flight);
Pablo Greco e6a3ae
     aio_wait_kick();
Pablo Greco e6a3ae
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
Pablo Greco e6a3ae
index 20f8bbb..815b6e5 100644
Pablo Greco e6a3ae
--- a/include/sysemu/block-backend.h
Pablo Greco e6a3ae
+++ b/include/sysemu/block-backend.h
Pablo Greco e6a3ae
@@ -157,6 +157,8 @@ int blk_co_pdiscard(BlockBackend *blk, int64_t offset, int bytes);
Pablo Greco e6a3ae
 int blk_co_flush(BlockBackend *blk);
Pablo Greco e6a3ae
 int blk_flush(BlockBackend *blk);
Pablo Greco e6a3ae
 int blk_commit_all(void);
Pablo Greco e6a3ae
+void blk_inc_in_flight(BlockBackend *blk);
Pablo Greco e6a3ae
+void blk_dec_in_flight(BlockBackend *blk);
Pablo Greco e6a3ae
 void blk_drain(BlockBackend *blk);
Pablo Greco e6a3ae
 void blk_drain_all(void);
Pablo Greco e6a3ae
 void blk_set_on_error(BlockBackend *blk, BlockdevOnError on_read_error,
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae