From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsXsX-0001Sa-NW for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:20:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsXsV-0004RY-J8 for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:20:09 -0400 From: Paolo Bonzini Date: Fri, 7 Oct 2016 18:19:50 +0200 Message-Id: <1475857193-28735-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 0/3] block: new bdrv_drain implementation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, kwolf@redhat.com, famz@redhat.com, qemu-block@nongnu.org Another tiny bit from the multiqueue series. This takes care of reimplementing bdrv_drain to process each BDS in the tree in order. A side effect is to separate draining of data writes from draining of metadata writes, which allows us to reinstate QED's .bdrv_drain implementation. A couple words on the role of this in the multiqueue world. This series is half of what's needed to remove RFifoLock and contention callbacks. In order to do so, aio_poll will only run in the I/O thread; when the main QEMU thread wants to drain a BlockDriverState it will rely on the I/O thread to do the work. in_flight then provides a quick way to detect whether to wake up a thread sitting in bdrv_drain. Compared to previous attempts, the main change is that some tracking has to be done at the BlockBackend level, because throttling has been moved there. This series requires: - "replication: interrupt failover if the main device is closed" - "blockjob: introduce .drain callback for jobs" The next (already written) steps are: - "aio: convert from RFifoLock to QemuRecMutex" - "aio: push aio_context_acquire/release down to dispatching" - "aio: explicitly acquire aiocontext in all callbacks" - "coroutine-lock: make it thread-safe" - "block: make BlockDriverState fields thread-safe" In total these are about 60 patches. I plan to merge the first into 2.8 as a bugfix. Further (planned) steps are: - blockjob: do not protect with AioContext lock This is just using a QemuMutex to protect BlockJob fields - block drivers: make them thread-safe This ensures everything is protected by the CoMutex or, for AIO-based drivers, by a QemuMutex. - block: remove bdrv_set_aio_context Paolo Fam Zheng (1): qed: Implement .bdrv_drain Paolo Bonzini (2): block: add BDS field to count in-flight requests block: change drain to look only at one child at a time block/block-backend.c | 17 ++++++- block/io.c | 127 ++++++++++++++++++++++++++++++++-------------- block/qed.c | 16 +++++- include/block/block_int.h | 10 ++-- 4 files changed, 124 insertions(+), 46 deletions(-) -- 2.7.4