All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl
@ 2016-10-20 13:46 Kevin Wolf
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 1/9] block: Use blk_co_flush() for all BB level flushes Kevin Wolf
                   ` (10 more replies)
  0 siblings, 11 replies; 23+ messages in thread
From: Kevin Wolf @ 2016-10-20 13:46 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, pbonzini, qemu-devel

Paolo, this is my attempt at implementing what you were asking for last Friday.
I converted blk_(co_)flush/pdiscard/ioctl so that all interfaces (coroutine,
AIO, sync) go through the same coroutine-based function already on the
BlockBackend level. Where it was reasonably easy, I also removed the
corresponding emulations from block/io.c IIUC, this should cover your immediate
needs.


Function to remove this series leaves for another day:

* bdrv_aio_flush (used by blkdebug, blkverify, qed)
* bdrv_flush (even more users)
* bdrv_pdiscard (used by qcow2)


BlockDriver callbacks to remove left for another day:

* bdrv_aio_pdiscard (implemented by raw-posix and rbd)
* bdrv_aio_ioctl (implemented by raw-posix and iscsi)

In both cases, raw-posix is trivial to covert, but iscsi and rbd feel rather
scary without a proper test setup.


Kevin Wolf (9):
  block: Use blk_co_flush() for all BB level flushes
  block: Use blk_co_pdiscard() for all BB level discard
  block: Remove bdrv_aio_pdiscard()
  block: Use blk_co_ioctl() for all BB level ioctls
  raw-posix: Don't use bdrv_ioctl()
  block: Remove bdrv_ioctl()
  block: Introduce .bdrv_co_ioctl() driver callback
  raw: Implement .bdrv_co_ioctl instead of .bdrv_aio_ioctl
  block: Remove bdrv_aio_ioctl()

 block/block-backend.c          |  94 ++++++++++++++++++++++++----------
 block/io.c                     | 111 ++++-------------------------------------
 block/raw-posix.c              |  16 ++++--
 block/raw_bsd.c                |   9 ++--
 block/trace-events             |   1 -
 include/block/block.h          |   8 +--
 include/block/block_int.h      |   2 +
 include/sysemu/block-backend.h |   1 +
 8 files changed, 98 insertions(+), 144 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 1/9] block: Use blk_co_flush() for all BB level flushes
  2016-10-20 13:46 [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Kevin Wolf
@ 2016-10-20 13:46 ` Kevin Wolf
  2016-10-20 16:13   ` Eric Blake
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 2/9] block: Use blk_co_pdiscard() for all BB level discard Kevin Wolf
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2016-10-20 13:46 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, pbonzini, qemu-devel

All read/write functions already have a single coroutine-based function
on the BlockBackend level through which all requests go (no matter what
API style the external caller used) and which passes the requests down
to the block node level.

This patch extends this mode of operation to flushes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/block-backend.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index 1a724a8..96bb634 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1099,14 +1099,19 @@ BlockAIOCB *blk_aio_pwritev(BlockBackend *blk, int64_t offset,
                         blk_aio_write_entry, flags, cb, opaque);
 }
 
+static void blk_aio_flush_entry(void *opaque)
+{
+    BlkAioEmAIOCB *acb = opaque;
+    BlkRwCo *rwco = &acb->rwco;
+
+    rwco->ret = blk_co_flush(rwco->blk);
+    blk_aio_complete(acb);
+}
+
 BlockAIOCB *blk_aio_flush(BlockBackend *blk,
                           BlockCompletionFunc *cb, void *opaque)
 {
-    if (!blk_is_available(blk)) {
-        return blk_abort_aio_request(blk, cb, opaque, -ENOMEDIUM);
-    }
-
-    return bdrv_aio_flush(blk_bs(blk), cb, opaque);
+    return blk_aio_prwv(blk, 0, 0, NULL, blk_aio_flush_entry, 0, cb, opaque);
 }
 
 BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk,
@@ -1169,13 +1174,15 @@ int blk_co_flush(BlockBackend *blk)
     return bdrv_co_flush(blk_bs(blk));
 }
 
-int blk_flush(BlockBackend *blk)
+static void blk_flush_entry(void *opaque)
 {
-    if (!blk_is_available(blk)) {
-        return -ENOMEDIUM;
-    }
+    BlkRwCo *rwco = opaque;
+    rwco->ret = blk_co_flush(rwco->blk);
+}
 
-    return bdrv_flush(blk_bs(blk));
+int blk_flush(BlockBackend *blk)
+{
+    return blk_prw(blk, 0, NULL, 0, blk_flush_entry, 0);
 }
 
 void blk_drain(BlockBackend *blk)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 2/9] block: Use blk_co_pdiscard() for all BB level discard
  2016-10-20 13:46 [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Kevin Wolf
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 1/9] block: Use blk_co_flush() for all BB level flushes Kevin Wolf
@ 2016-10-20 13:46 ` Kevin Wolf
  2016-10-20 16:18   ` Eric Blake
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 3/9] block: Remove bdrv_aio_pdiscard() Kevin Wolf
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2016-10-20 13:46 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, pbonzini, qemu-devel

All read/write functions already have a single coroutine-based function
on the BlockBackend level through which all requests go (no matter what
API style the external caller used) and which passes the requests down
to the block node level.

This patch extends this mode of operation to discards.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/block-backend.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index 96bb634..39336de 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1114,16 +1114,21 @@ BlockAIOCB *blk_aio_flush(BlockBackend *blk,
     return blk_aio_prwv(blk, 0, 0, NULL, blk_aio_flush_entry, 0, cb, opaque);
 }
 
+static void blk_aio_pdiscard_entry(void *opaque)
+{
+    BlkAioEmAIOCB *acb = opaque;
+    BlkRwCo *rwco = &acb->rwco;
+
+    rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, acb->bytes);
+    blk_aio_complete(acb);
+}
+
 BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk,
                              int64_t offset, int count,
                              BlockCompletionFunc *cb, void *opaque)
 {
-    int ret = blk_check_byte_request(blk, offset, count);
-    if (ret < 0) {
-        return blk_abort_aio_request(blk, cb, opaque, ret);
-    }
-
-    return bdrv_aio_pdiscard(blk_bs(blk), offset, count, cb, opaque);
+    return blk_aio_prwv(blk, offset, count, NULL, blk_aio_pdiscard_entry, 0,
+                        cb, opaque);
 }
 
 void blk_aio_cancel(BlockAIOCB *acb)
@@ -1562,14 +1567,15 @@ int blk_truncate(BlockBackend *blk, int64_t offset)
     return bdrv_truncate(blk_bs(blk), offset);
 }
 
-int blk_pdiscard(BlockBackend *blk, int64_t offset, int count)
+static void blk_pdiscard_entry(void *opaque)
 {
-    int ret = blk_check_byte_request(blk, offset, count);
-    if (ret < 0) {
-        return ret;
-    }
+    BlkRwCo *rwco = opaque;
+    rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, rwco->qiov->size);
+}
 
-    return bdrv_pdiscard(blk_bs(blk), offset, count);
+int blk_pdiscard(BlockBackend *blk, int64_t offset, int count)
+{
+    return blk_prw(blk, offset, NULL, count, blk_pdiscard_entry, 0);
 }
 
 int blk_save_vmstate(BlockBackend *blk, const uint8_t *buf,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 3/9] block: Remove bdrv_aio_pdiscard()
  2016-10-20 13:46 [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Kevin Wolf
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 1/9] block: Use blk_co_flush() for all BB level flushes Kevin Wolf
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 2/9] block: Use blk_co_pdiscard() for all BB level discard Kevin Wolf
@ 2016-10-20 13:46 ` Kevin Wolf
  2016-10-20 17:32   ` Eric Blake
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 4/9] block: Use blk_co_ioctl() for all BB level ioctls Kevin Wolf
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2016-10-20 13:46 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, pbonzini, qemu-devel

It is unused now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/io.c            | 29 -----------------------------
 block/trace-events    |  1 -
 include/block/block.h |  3 ---
 3 files changed, 33 deletions(-)

diff --git a/block/io.c b/block/io.c
index b136c89..ff93ba1 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2196,35 +2196,6 @@ BlockAIOCB *bdrv_aio_flush(BlockDriverState *bs,
     return &acb->common;
 }
 
-static void coroutine_fn bdrv_aio_pdiscard_co_entry(void *opaque)
-{
-    BlockAIOCBCoroutine *acb = opaque;
-    BlockDriverState *bs = acb->common.bs;
-
-    acb->req.error = bdrv_co_pdiscard(bs, acb->req.offset, acb->req.bytes);
-    bdrv_co_complete(acb);
-}
-
-BlockAIOCB *bdrv_aio_pdiscard(BlockDriverState *bs, int64_t offset, int count,
-                              BlockCompletionFunc *cb, void *opaque)
-{
-    Coroutine *co;
-    BlockAIOCBCoroutine *acb;
-
-    trace_bdrv_aio_pdiscard(bs, offset, count, opaque);
-
-    acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);
-    acb->need_bh = true;
-    acb->req.error = -EINPROGRESS;
-    acb->req.offset = offset;
-    acb->req.bytes = count;
-    co = qemu_coroutine_create(bdrv_aio_pdiscard_co_entry, acb);
-    qemu_coroutine_enter(co);
-
-    bdrv_co_maybe_schedule_bh(acb);
-    return &acb->common;
-}
-
 void *qemu_aio_get(const AIOCBInfo *aiocb_info, BlockDriverState *bs,
                    BlockCompletionFunc *cb, void *opaque)
 {
diff --git a/block/trace-events b/block/trace-events
index 05fa13c..aff8a96 100644
--- a/block/trace-events
+++ b/block/trace-events
@@ -9,7 +9,6 @@ blk_co_preadv(void *blk, void *bs, int64_t offset, unsigned int bytes, int flags
 blk_co_pwritev(void *blk, void *bs, int64_t offset, unsigned int bytes, int flags) "blk %p bs %p offset %"PRId64" bytes %u flags %x"
 
 # block/io.c
-bdrv_aio_pdiscard(void *bs, int64_t offset, int count, void *opaque) "bs %p offset %"PRId64" count %d opaque %p"
 bdrv_aio_flush(void *bs, void *opaque) "bs %p opaque %p"
 bdrv_aio_readv(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
 bdrv_aio_writev(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
diff --git a/include/block/block.h b/include/block/block.h
index 107c603..99a15a6 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -314,9 +314,6 @@ BlockAIOCB *bdrv_aio_writev(BdrvChild *child, int64_t sector_num,
                             BlockCompletionFunc *cb, void *opaque);
 BlockAIOCB *bdrv_aio_flush(BlockDriverState *bs,
                            BlockCompletionFunc *cb, void *opaque);
-BlockAIOCB *bdrv_aio_pdiscard(BlockDriverState *bs,
-                              int64_t offset, int count,
-                              BlockCompletionFunc *cb, void *opaque);
 void bdrv_aio_cancel(BlockAIOCB *acb);
 void bdrv_aio_cancel_async(BlockAIOCB *acb);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 4/9] block: Use blk_co_ioctl() for all BB level ioctls
  2016-10-20 13:46 [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Kevin Wolf
                   ` (2 preceding siblings ...)
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 3/9] block: Remove bdrv_aio_pdiscard() Kevin Wolf
@ 2016-10-20 13:46 ` Kevin Wolf
  2016-10-20 17:40   ` Eric Blake
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 5/9] raw-posix: Don't use bdrv_ioctl() Kevin Wolf
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2016-10-20 13:46 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, pbonzini, qemu-devel

All read/write functions already have a single coroutine-based function
on the BlockBackend level through which all requests go (no matter what
API style the external caller used) and which passes the requests down
to the block node level.

This patch exports a bdrv_co_ioctl() function and uses it to extend this
mode of operation to ioctls.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/block-backend.c          | 39 +++++++++++++++++++++++++++++++++------
 block/io.c                     |  8 ++++----
 include/block/block.h          |  1 +
 include/sysemu/block-backend.h |  1 +
 4 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index 39336de..c53ca30 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1141,23 +1141,50 @@ void blk_aio_cancel_async(BlockAIOCB *acb)
     bdrv_aio_cancel_async(acb);
 }
 
-int blk_ioctl(BlockBackend *blk, unsigned long int req, void *buf)
+int blk_co_ioctl(BlockBackend *blk, unsigned long int req, void *buf)
 {
     if (!blk_is_available(blk)) {
         return -ENOMEDIUM;
     }
 
-    return bdrv_ioctl(blk_bs(blk), req, buf);
+    return bdrv_co_ioctl(blk_bs(blk), req, buf);
+}
+
+static void blk_ioctl_entry(void *opaque)
+{
+    BlkRwCo *rwco = opaque;
+    rwco->ret = blk_co_ioctl(rwco->blk, rwco->offset,
+                             rwco->qiov->iov[0].iov_base);
+}
+
+int blk_ioctl(BlockBackend *blk, unsigned long int req, void *buf)
+{
+    return blk_prw(blk, req, buf, 0, blk_ioctl_entry, 0);
+}
+
+static void blk_aio_ioctl_entry(void *opaque)
+{
+    BlkAioEmAIOCB *acb = opaque;
+    BlkRwCo *rwco = &acb->rwco;
+
+    rwco->ret = blk_co_ioctl(rwco->blk, rwco->offset,
+                             rwco->qiov->iov[0].iov_base);
+    blk_aio_complete(acb);
 }
 
 BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned long int req, void *buf,
                           BlockCompletionFunc *cb, void *opaque)
 {
-    if (!blk_is_available(blk)) {
-        return blk_abort_aio_request(blk, cb, opaque, -ENOMEDIUM);
-    }
+    QEMUIOVector qiov;
+    struct iovec iov;
+
+    iov = (struct iovec) {
+        .iov_base = buf,
+        .iov_len = 0,
+    };
+    qemu_iovec_init_external(&qiov, &iov, 1);
 
-    return bdrv_aio_ioctl(blk_bs(blk), req, buf, cb, opaque);
+    return blk_aio_prwv(blk, req, 0, &qiov, blk_aio_ioctl_entry, 0, cb, opaque);
 }
 
 int blk_co_pdiscard(BlockBackend *blk, int64_t offset, int count)
diff --git a/block/io.c b/block/io.c
index ff93ba1..7c119d5 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2492,7 +2492,7 @@ int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int count)
     return rwco.ret;
 }
 
-static int bdrv_co_do_ioctl(BlockDriverState *bs, int req, void *buf)
+int bdrv_co_ioctl(BlockDriverState *bs, int req, void *buf)
 {
     BlockDriver *drv = bs->drv;
     BdrvTrackedRequest tracked_req;
@@ -2528,7 +2528,7 @@ typedef struct {
 static void coroutine_fn bdrv_co_ioctl_entry(void *opaque)
 {
     BdrvIoctlCoData *data = opaque;
-    data->ret = bdrv_co_do_ioctl(data->bs, data->req, data->buf);
+    data->ret = bdrv_co_ioctl(data->bs, data->req, data->buf);
 }
 
 /* needed for generic scsi interface */
@@ -2558,8 +2558,8 @@ int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
 static void coroutine_fn bdrv_co_aio_ioctl_entry(void *opaque)
 {
     BlockAIOCBCoroutine *acb = opaque;
-    acb->req.error = bdrv_co_do_ioctl(acb->common.bs,
-                                      acb->req.req, acb->req.buf);
+    acb->req.error = bdrv_co_ioctl(acb->common.bs,
+                                   acb->req.req, acb->req.buf);
     bdrv_co_complete(acb);
 }
 
diff --git a/include/block/block.h b/include/block/block.h
index 99a15a6..e06db62 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -318,6 +318,7 @@ void bdrv_aio_cancel(BlockAIOCB *acb);
 void bdrv_aio_cancel_async(BlockAIOCB *acb);
 
 /* sg packet commands */
+int bdrv_co_ioctl(BlockDriverState *bs, int req, void *buf);
 int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf);
 BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs,
         unsigned long int req, void *buf,
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index b07159b..6444e41 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -146,6 +146,7 @@ BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk, int64_t offset, int count,
                              BlockCompletionFunc *cb, void *opaque);
 void blk_aio_cancel(BlockAIOCB *acb);
 void blk_aio_cancel_async(BlockAIOCB *acb);
+int blk_co_ioctl(BlockBackend *blk, unsigned long int req, void *buf);
 int blk_ioctl(BlockBackend *blk, unsigned long int req, void *buf);
 BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned long int req, void *buf,
                           BlockCompletionFunc *cb, void *opaque);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 5/9] raw-posix: Don't use bdrv_ioctl()
  2016-10-20 13:46 [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Kevin Wolf
                   ` (3 preceding siblings ...)
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 4/9] block: Use blk_co_ioctl() for all BB level ioctls Kevin Wolf
@ 2016-10-20 13:46 ` Kevin Wolf
  2016-10-20 17:45   ` Eric Blake
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 6/9] block: Remove bdrv_ioctl() Kevin Wolf
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2016-10-20 13:46 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, pbonzini, qemu-devel

Instead of letting raw-posix use the bdrv_ioctl() abstraction to issue
an ioctl to itself, just call ioctl() directly.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/raw-posix.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/block/raw-posix.c b/block/raw-posix.c
index f481e57..247e47b 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -2069,13 +2069,23 @@ static bool hdev_is_sg(BlockDriverState *bs)
 
 #if defined(__linux__)
 
+    BDRVRawState *s = bs->opaque;
     struct stat st;
     struct sg_scsi_id scsiid;
     int sg_version;
+    int ret;
+
+    if (stat(bs->filename, &st) < 0 || !S_ISCHR(st.st_mode)) {
+        return false;
+    }
 
-    if (stat(bs->filename, &st) >= 0 && S_ISCHR(st.st_mode) &&
-        !bdrv_ioctl(bs, SG_GET_VERSION_NUM, &sg_version) &&
-        !bdrv_ioctl(bs, SG_GET_SCSI_ID, &scsiid)) {
+    ret = ioctl(s->fd, SG_GET_VERSION_NUM, &sg_version);
+    if (ret < 0) {
+        return false;
+    }
+
+    ret = ioctl(s->fd, SG_GET_SCSI_ID, &scsiid);
+    if (ret >= 0) {
         DPRINTF("SG device found: type=%d, version=%d\n",
             scsiid.scsi_type, sg_version);
         return true;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 6/9] block: Remove bdrv_ioctl()
  2016-10-20 13:46 [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Kevin Wolf
                   ` (4 preceding siblings ...)
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 5/9] raw-posix: Don't use bdrv_ioctl() Kevin Wolf
@ 2016-10-20 13:46 ` Kevin Wolf
  2016-10-20 17:47   ` Eric Blake
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 7/9] block: Introduce .bdrv_co_ioctl() driver callback Kevin Wolf
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2016-10-20 13:46 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, pbonzini, qemu-devel

It is unused now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/io.c            | 37 -------------------------------------
 include/block/block.h |  1 -
 2 files changed, 38 deletions(-)

diff --git a/block/io.c b/block/io.c
index 7c119d5..35fdcca 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2518,43 +2518,6 @@ out:
     return co.ret;
 }
 
-typedef struct {
-    BlockDriverState *bs;
-    int req;
-    void *buf;
-    int ret;
-} BdrvIoctlCoData;
-
-static void coroutine_fn bdrv_co_ioctl_entry(void *opaque)
-{
-    BdrvIoctlCoData *data = opaque;
-    data->ret = bdrv_co_ioctl(data->bs, data->req, data->buf);
-}
-
-/* needed for generic scsi interface */
-int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
-{
-    BdrvIoctlCoData data = {
-        .bs = bs,
-        .req = req,
-        .buf = buf,
-        .ret = -EINPROGRESS,
-    };
-
-    if (qemu_in_coroutine()) {
-        /* Fast-path if already in coroutine context */
-        bdrv_co_ioctl_entry(&data);
-    } else {
-        Coroutine *co = qemu_coroutine_create(bdrv_co_ioctl_entry, &data);
-
-        qemu_coroutine_enter(co);
-        while (data.ret == -EINPROGRESS) {
-            aio_poll(bdrv_get_aio_context(bs), true);
-        }
-    }
-    return data.ret;
-}
-
 static void coroutine_fn bdrv_co_aio_ioctl_entry(void *opaque)
 {
     BlockAIOCBCoroutine *acb = opaque;
diff --git a/include/block/block.h b/include/block/block.h
index e06db62..e0a54aa 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -319,7 +319,6 @@ void bdrv_aio_cancel_async(BlockAIOCB *acb);
 
 /* sg packet commands */
 int bdrv_co_ioctl(BlockDriverState *bs, int req, void *buf);
-int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf);
 BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs,
         unsigned long int req, void *buf,
         BlockCompletionFunc *cb, void *opaque);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 7/9] block: Introduce .bdrv_co_ioctl() driver callback
  2016-10-20 13:46 [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Kevin Wolf
                   ` (5 preceding siblings ...)
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 6/9] block: Remove bdrv_ioctl() Kevin Wolf
@ 2016-10-20 13:46 ` Kevin Wolf
  2016-10-20 17:51   ` Eric Blake
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 8/9] raw: Implement .bdrv_co_ioctl instead of .bdrv_aio_ioctl Kevin Wolf
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2016-10-20 13:46 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, pbonzini, qemu-devel

This allows drivers to implement ioctls in a coroutine-based way.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/io.c                | 16 ++++++++++------
 include/block/block_int.h |  2 ++
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/block/io.c b/block/io.c
index 35fdcca..370c7d8 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2502,17 +2502,21 @@ int bdrv_co_ioctl(BlockDriverState *bs, int req, void *buf)
     BlockAIOCB *acb;
 
     tracked_request_begin(&tracked_req, bs, 0, 0, BDRV_TRACKED_IOCTL);
-    if (!drv || !drv->bdrv_aio_ioctl) {
+    if (!drv || (!drv->bdrv_aio_ioctl && !drv->bdrv_co_ioctl)) {
         co.ret = -ENOTSUP;
         goto out;
     }
 
-    acb = drv->bdrv_aio_ioctl(bs, req, buf, bdrv_co_io_em_complete, &co);
-    if (!acb) {
-        co.ret = -ENOTSUP;
-        goto out;
+    if (drv->bdrv_co_ioctl) {
+        co.ret = drv->bdrv_co_ioctl(bs, req, buf);
+    } else {
+        acb = drv->bdrv_aio_ioctl(bs, req, buf, bdrv_co_io_em_complete, &co);
+        if (!acb) {
+            co.ret = -ENOTSUP;
+            goto out;
+        }
+        qemu_coroutine_yield();
     }
-    qemu_coroutine_yield();
 out:
     tracked_request_end(&tracked_req);
     return co.ret;
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 3e79228..e96e9ad 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -244,6 +244,8 @@ struct BlockDriver {
     BlockAIOCB *(*bdrv_aio_ioctl)(BlockDriverState *bs,
         unsigned long int req, void *buf,
         BlockCompletionFunc *cb, void *opaque);
+    int coroutine_fn (*bdrv_co_ioctl)(BlockDriverState *bs,
+                                      unsigned long int req, void *buf);
 
     /* List of options for creating images, terminated by name == NULL */
     QemuOptsList *create_opts;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 8/9] raw: Implement .bdrv_co_ioctl instead of .bdrv_aio_ioctl
  2016-10-20 13:46 [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Kevin Wolf
                   ` (6 preceding siblings ...)
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 7/9] block: Introduce .bdrv_co_ioctl() driver callback Kevin Wolf
@ 2016-10-20 13:46 ` Kevin Wolf
  2016-10-20 17:52   ` Eric Blake
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 9/9] block: Remove bdrv_aio_ioctl() Kevin Wolf
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2016-10-20 13:46 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, pbonzini, qemu-devel

It's the simpler interface to use for the raw format driver.

Apart from that, this removes the last user of the AIO emulation
implemented by bdrv_aio_ioctl().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/raw_bsd.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/block/raw_bsd.c b/block/raw_bsd.c
index 588d408..fc16ec1 100644
--- a/block/raw_bsd.c
+++ b/block/raw_bsd.c
@@ -176,12 +176,9 @@ static void raw_lock_medium(BlockDriverState *bs, bool locked)
     bdrv_lock_medium(bs->file->bs, locked);
 }
 
-static BlockAIOCB *raw_aio_ioctl(BlockDriverState *bs,
-                                 unsigned long int req, void *buf,
-                                 BlockCompletionFunc *cb,
-                                 void *opaque)
+static int raw_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
 {
-    return bdrv_aio_ioctl(bs->file->bs, req, buf, cb, opaque);
+    return bdrv_co_ioctl(bs->file->bs, req, buf);
 }
 
 static int raw_has_zero_init(BlockDriverState *bs)
@@ -261,7 +258,7 @@ BlockDriver bdrv_raw = {
     .bdrv_media_changed   = &raw_media_changed,
     .bdrv_eject           = &raw_eject,
     .bdrv_lock_medium     = &raw_lock_medium,
-    .bdrv_aio_ioctl       = &raw_aio_ioctl,
+    .bdrv_co_ioctl        = &raw_co_ioctl,
     .create_opts          = &raw_create_opts,
     .bdrv_has_zero_init   = &raw_has_zero_init
 };
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 9/9] block: Remove bdrv_aio_ioctl()
  2016-10-20 13:46 [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Kevin Wolf
                   ` (7 preceding siblings ...)
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 8/9] raw: Implement .bdrv_co_ioctl instead of .bdrv_aio_ioctl Kevin Wolf
@ 2016-10-20 13:46 ` Kevin Wolf
  2016-10-20 17:53   ` Eric Blake
  2016-10-20 14:37 ` [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Paolo Bonzini
  2016-10-20 15:20 ` no-reply
  10 siblings, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2016-10-20 13:46 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, pbonzini, qemu-devel

It is unused now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/io.c            | 27 ---------------------------
 include/block/block.h |  3 ---
 2 files changed, 30 deletions(-)

diff --git a/block/io.c b/block/io.c
index 370c7d8..79cbbdf 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2522,33 +2522,6 @@ out:
     return co.ret;
 }
 
-static void coroutine_fn bdrv_co_aio_ioctl_entry(void *opaque)
-{
-    BlockAIOCBCoroutine *acb = opaque;
-    acb->req.error = bdrv_co_ioctl(acb->common.bs,
-                                   acb->req.req, acb->req.buf);
-    bdrv_co_complete(acb);
-}
-
-BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs,
-        unsigned long int req, void *buf,
-        BlockCompletionFunc *cb, void *opaque)
-{
-    BlockAIOCBCoroutine *acb = qemu_aio_get(&bdrv_em_co_aiocb_info,
-                                            bs, cb, opaque);
-    Coroutine *co;
-
-    acb->need_bh = true;
-    acb->req.error = -EINPROGRESS;
-    acb->req.req = req;
-    acb->req.buf = buf;
-    co = qemu_coroutine_create(bdrv_co_aio_ioctl_entry, acb);
-    qemu_coroutine_enter(co);
-
-    bdrv_co_maybe_schedule_bh(acb);
-    return &acb->common;
-}
-
 void *qemu_blockalign(BlockDriverState *bs, size_t size)
 {
     return qemu_memalign(bdrv_opt_mem_align(bs), size);
diff --git a/include/block/block.h b/include/block/block.h
index e0a54aa..398a050 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -319,9 +319,6 @@ void bdrv_aio_cancel_async(BlockAIOCB *acb);
 
 /* sg packet commands */
 int bdrv_co_ioctl(BlockDriverState *bs, int req, void *buf);
-BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs,
-        unsigned long int req, void *buf,
-        BlockCompletionFunc *cb, void *opaque);
 
 /* Invalidate any cached metadata used by image formats */
 void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl
  2016-10-20 13:46 [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Kevin Wolf
                   ` (8 preceding siblings ...)
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 9/9] block: Remove bdrv_aio_ioctl() Kevin Wolf
@ 2016-10-20 14:37 ` Paolo Bonzini
  2016-10-20 15:20 ` no-reply
  10 siblings, 0 replies; 23+ messages in thread
From: Paolo Bonzini @ 2016-10-20 14:37 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-block, mreitz, qemu-devel



----- Original Message -----
> From: "Kevin Wolf" <kwolf@redhat.com>
> To: qemu-block@nongnu.org
> Cc: kwolf@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org
> Sent: Thursday, October 20, 2016 3:46:00 PM
> Subject: [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl
> 
> Paolo, this is my attempt at implementing what you were asking for last
> Friday.
> I converted blk_(co_)flush/pdiscard/ioctl so that all interfaces (coroutine,
> AIO, sync) go through the same coroutine-based function already on the
> BlockBackend level. Where it was reasonably easy, I also removed the
> corresponding emulations from block/io.c IIUC, this should cover your
> immediate
> needs.
> 
> 
> Function to remove this series leaves for another day:
> 
> * bdrv_aio_flush (used by blkdebug, blkverify, qed)
> * bdrv_flush (even more users)
> * bdrv_pdiscard (used by qcow2)
> 
> 
> BlockDriver callbacks to remove left for another day:
> 
> * bdrv_aio_pdiscard (implemented by raw-posix and rbd)
> * bdrv_aio_ioctl (implemented by raw-posix and iscsi)
> 
> In both cases, raw-posix is trivial to covert, but iscsi and rbd feel rather
> scary without a proper test setup.

Thanks!

Paolo

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl
  2016-10-20 13:46 [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Kevin Wolf
                   ` (9 preceding siblings ...)
  2016-10-20 14:37 ` [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Paolo Bonzini
@ 2016-10-20 15:20 ` no-reply
  10 siblings, 0 replies; 23+ messages in thread
From: no-reply @ 2016-10-20 15:20 UTC (permalink / raw)
  To: kwolf; +Cc: famz, qemu-block, pbonzini, qemu-devel, mreitz

Hi,

Your series seems to have some coding style problems. See output below for
more information:

Subject: [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl
Type: series
Message-id: 1476971169-31604-1-git-send-email-kwolf@redhat.com

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git show --no-patch --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
f1e92c7 block: Remove bdrv_aio_ioctl()
6f353df raw: Implement .bdrv_co_ioctl instead of .bdrv_aio_ioctl
1e5fd07 block: Introduce .bdrv_co_ioctl() driver callback
04b823d block: Remove bdrv_ioctl()
4fed6c5 raw-posix: Don't use bdrv_ioctl()
b972aa0 block: Use blk_co_ioctl() for all BB level ioctls
53ef487 block: Remove bdrv_aio_pdiscard()
d777b24 block: Use blk_co_pdiscard() for all BB level discard
2470c9c block: Use blk_co_flush() for all BB level flushes

=== OUTPUT BEGIN ===
Checking PATCH 1/9: block: Use blk_co_flush() for all BB level flushes...
Checking PATCH 2/9: block: Use blk_co_pdiscard() for all BB level discard...
Checking PATCH 3/9: block: Remove bdrv_aio_pdiscard()...
Checking PATCH 4/9: block: Use blk_co_ioctl() for all BB level ioctls...
Checking PATCH 5/9: raw-posix: Don't use bdrv_ioctl()...
Checking PATCH 6/9: block: Remove bdrv_ioctl()...
Checking PATCH 7/9: block: Introduce .bdrv_co_ioctl() driver callback...
ERROR: space prohibited between function name and open parenthesis '('
#51: FILE: include/block/block_int.h:247:
+    int coroutine_fn (*bdrv_co_ioctl)(BlockDriverState *bs,

total: 1 errors, 0 warnings, 35 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 8/9: raw: Implement .bdrv_co_ioctl instead of .bdrv_aio_ioctl...
Checking PATCH 9/9: block: Remove bdrv_aio_ioctl()...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 1/9] block: Use blk_co_flush() for all BB level flushes
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 1/9] block: Use blk_co_flush() for all BB level flushes Kevin Wolf
@ 2016-10-20 16:13   ` Eric Blake
  0 siblings, 0 replies; 23+ messages in thread
From: Eric Blake @ 2016-10-20 16:13 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: pbonzini, qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 686 bytes --]

On 10/20/2016 08:46 AM, Kevin Wolf wrote:
> All read/write functions already have a single coroutine-based function
> on the BlockBackend level through which all requests go (no matter what
> API style the external caller used) and which passes the requests down
> to the block node level.
> 
> This patch extends this mode of operation to flushes.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/block-backend.c | 27 +++++++++++++++++----------
>  1 file changed, 17 insertions(+), 10 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 2/9] block: Use blk_co_pdiscard() for all BB level discard
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 2/9] block: Use blk_co_pdiscard() for all BB level discard Kevin Wolf
@ 2016-10-20 16:18   ` Eric Blake
  0 siblings, 0 replies; 23+ messages in thread
From: Eric Blake @ 2016-10-20 16:18 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: pbonzini, qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

On 10/20/2016 08:46 AM, Kevin Wolf wrote:
> All read/write functions already have a single coroutine-based function
> on the BlockBackend level through which all requests go (no matter what
> API style the external caller used) and which passes the requests down
> to the block node level.
> 
> This patch extends this mode of operation to discards.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/block-backend.c | 30 ++++++++++++++++++------------
>  1 file changed, 18 insertions(+), 12 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 3/9] block: Remove bdrv_aio_pdiscard()
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 3/9] block: Remove bdrv_aio_pdiscard() Kevin Wolf
@ 2016-10-20 17:32   ` Eric Blake
  2016-10-21 10:59     ` Kevin Wolf
  0 siblings, 1 reply; 23+ messages in thread
From: Eric Blake @ 2016-10-20 17:32 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: pbonzini, qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

On 10/20/2016 08:46 AM, Kevin Wolf wrote:
> It is unused now.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/io.c            | 29 -----------------------------
>  block/trace-events    |  1 -
>  include/block/block.h |  3 ---
>  3 files changed, 33 deletions(-)

Might be nice to research which commit id removed the last use, and
mention it in the commit message as an idea for how long we've had dead
code, but that's not a necessity.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 4/9] block: Use blk_co_ioctl() for all BB level ioctls
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 4/9] block: Use blk_co_ioctl() for all BB level ioctls Kevin Wolf
@ 2016-10-20 17:40   ` Eric Blake
  0 siblings, 0 replies; 23+ messages in thread
From: Eric Blake @ 2016-10-20 17:40 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: pbonzini, qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 896 bytes --]

On 10/20/2016 08:46 AM, Kevin Wolf wrote:
> All read/write functions already have a single coroutine-based function
> on the BlockBackend level through which all requests go (no matter what
> API style the external caller used) and which passes the requests down
> to the block node level.
> 
> This patch exports a bdrv_co_ioctl() function and uses it to extend this
> mode of operation to ioctls.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/block-backend.c          | 39 +++++++++++++++++++++++++++++++++------
>  block/io.c                     |  8 ++++----
>  include/block/block.h          |  1 +
>  include/sysemu/block-backend.h |  1 +
>  4 files changed, 39 insertions(+), 10 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 5/9] raw-posix: Don't use bdrv_ioctl()
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 5/9] raw-posix: Don't use bdrv_ioctl() Kevin Wolf
@ 2016-10-20 17:45   ` Eric Blake
  0 siblings, 0 replies; 23+ messages in thread
From: Eric Blake @ 2016-10-20 17:45 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: pbonzini, qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

On 10/20/2016 08:46 AM, Kevin Wolf wrote:
> Instead of letting raw-posix use the bdrv_ioctl() abstraction to issue
> an ioctl to itself, just call ioctl() directly.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/raw-posix.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 6/9] block: Remove bdrv_ioctl()
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 6/9] block: Remove bdrv_ioctl() Kevin Wolf
@ 2016-10-20 17:47   ` Eric Blake
  0 siblings, 0 replies; 23+ messages in thread
From: Eric Blake @ 2016-10-20 17:47 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: pbonzini, qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

On 10/20/2016 08:46 AM, Kevin Wolf wrote:
> It is unused now.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/io.c            | 37 -------------------------------------
>  include/block/block.h |  1 -
>  2 files changed, 38 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 7/9] block: Introduce .bdrv_co_ioctl() driver callback
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 7/9] block: Introduce .bdrv_co_ioctl() driver callback Kevin Wolf
@ 2016-10-20 17:51   ` Eric Blake
  0 siblings, 0 replies; 23+ messages in thread
From: Eric Blake @ 2016-10-20 17:51 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: pbonzini, qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

On 10/20/2016 08:46 AM, Kevin Wolf wrote:
> This allows drivers to implement ioctls in a coroutine-based way.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/io.c                | 16 ++++++++++------
>  include/block/block_int.h |  2 ++
>  2 files changed, 12 insertions(+), 6 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 8/9] raw: Implement .bdrv_co_ioctl instead of .bdrv_aio_ioctl
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 8/9] raw: Implement .bdrv_co_ioctl instead of .bdrv_aio_ioctl Kevin Wolf
@ 2016-10-20 17:52   ` Eric Blake
  0 siblings, 0 replies; 23+ messages in thread
From: Eric Blake @ 2016-10-20 17:52 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: pbonzini, qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 522 bytes --]

On 10/20/2016 08:46 AM, Kevin Wolf wrote:
> It's the simpler interface to use for the raw format driver.
> 
> Apart from that, this removes the last user of the AIO emulation
> implemented by bdrv_aio_ioctl().
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/raw_bsd.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 9/9] block: Remove bdrv_aio_ioctl()
  2016-10-20 13:46 ` [Qemu-devel] [PATCH 9/9] block: Remove bdrv_aio_ioctl() Kevin Wolf
@ 2016-10-20 17:53   ` Eric Blake
  0 siblings, 0 replies; 23+ messages in thread
From: Eric Blake @ 2016-10-20 17:53 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: pbonzini, qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]

On 10/20/2016 08:46 AM, Kevin Wolf wrote:
> It is unused now.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/io.c            | 27 ---------------------------
>  include/block/block.h |  3 ---
>  2 files changed, 30 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 3/9] block: Remove bdrv_aio_pdiscard()
  2016-10-20 17:32   ` Eric Blake
@ 2016-10-21 10:59     ` Kevin Wolf
  2016-10-21 13:45       ` Eric Blake
  0 siblings, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2016-10-21 10:59 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-block, pbonzini, qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

Am 20.10.2016 um 19:32 hat Eric Blake geschrieben:
> On 10/20/2016 08:46 AM, Kevin Wolf wrote:
> > It is unused now.
> > 
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> >  block/io.c            | 29 -----------------------------
> >  block/trace-events    |  1 -
> >  include/block/block.h |  3 ---
> >  3 files changed, 33 deletions(-)
> 
> Might be nice to research which commit id removed the last use, and
> mention it in the commit message as an idea for how long we've had dead
> code, but that's not a necessity.

Patch 2 removed the last user.

Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 3/9] block: Remove bdrv_aio_pdiscard()
  2016-10-21 10:59     ` Kevin Wolf
@ 2016-10-21 13:45       ` Eric Blake
  0 siblings, 0 replies; 23+ messages in thread
From: Eric Blake @ 2016-10-21 13:45 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-block, pbonzini, qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

On 10/21/2016 05:59 AM, Kevin Wolf wrote:
> Am 20.10.2016 um 19:32 hat Eric Blake geschrieben:
>> On 10/20/2016 08:46 AM, Kevin Wolf wrote:
>>> It is unused now.
>>>
>>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>>> ---
>>>  block/io.c            | 29 -----------------------------
>>>  block/trace-events    |  1 -
>>>  include/block/block.h |  3 ---
>>>  3 files changed, 33 deletions(-)
>>
>> Might be nice to research which commit id removed the last use, and
>> mention it in the commit message as an idea for how long we've had dead
>> code, but that's not a necessity.
> 
> Patch 2 removed the last user.

Aha. So maybe "removed in the previous patch" is all the more mention it
needs, if at all.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2016-10-21 13:45 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-20 13:46 [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Kevin Wolf
2016-10-20 13:46 ` [Qemu-devel] [PATCH 1/9] block: Use blk_co_flush() for all BB level flushes Kevin Wolf
2016-10-20 16:13   ` Eric Blake
2016-10-20 13:46 ` [Qemu-devel] [PATCH 2/9] block: Use blk_co_pdiscard() for all BB level discard Kevin Wolf
2016-10-20 16:18   ` Eric Blake
2016-10-20 13:46 ` [Qemu-devel] [PATCH 3/9] block: Remove bdrv_aio_pdiscard() Kevin Wolf
2016-10-20 17:32   ` Eric Blake
2016-10-21 10:59     ` Kevin Wolf
2016-10-21 13:45       ` Eric Blake
2016-10-20 13:46 ` [Qemu-devel] [PATCH 4/9] block: Use blk_co_ioctl() for all BB level ioctls Kevin Wolf
2016-10-20 17:40   ` Eric Blake
2016-10-20 13:46 ` [Qemu-devel] [PATCH 5/9] raw-posix: Don't use bdrv_ioctl() Kevin Wolf
2016-10-20 17:45   ` Eric Blake
2016-10-20 13:46 ` [Qemu-devel] [PATCH 6/9] block: Remove bdrv_ioctl() Kevin Wolf
2016-10-20 17:47   ` Eric Blake
2016-10-20 13:46 ` [Qemu-devel] [PATCH 7/9] block: Introduce .bdrv_co_ioctl() driver callback Kevin Wolf
2016-10-20 17:51   ` Eric Blake
2016-10-20 13:46 ` [Qemu-devel] [PATCH 8/9] raw: Implement .bdrv_co_ioctl instead of .bdrv_aio_ioctl Kevin Wolf
2016-10-20 17:52   ` Eric Blake
2016-10-20 13:46 ` [Qemu-devel] [PATCH 9/9] block: Remove bdrv_aio_ioctl() Kevin Wolf
2016-10-20 17:53   ` Eric Blake
2016-10-20 14:37 ` [Qemu-devel] [PATCH 0/9] block-backend: Use coroutine for flush/discard/ioctl Paolo Bonzini
2016-10-20 15:20 ` no-reply

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.