All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/linux-aio: Drop unused BlockAIOCB submission method
@ 2019-06-02 20:17 Julia Suvorova via Qemu-devel
  2019-06-03  7:14 ` Stefan Hajnoczi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Julia Suvorova via Qemu-devel @ 2019-06-02 20:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Max Reitz, Stefan Hajnoczi, Paolo Bonzini,
	Julia Suvorova, Aarushi Mehta

Callback-based laio_submit() and laio_cancel() were left after
rewriting Linux AIO backend to coroutines in hope that they would be
used in other code that could bypass coroutines. They can be safely
removed because they have not been used since that time.

Signed-off-by: Julia Suvorova <jusual@mail.ru>
---
 block/linux-aio.c       | 72 ++++++-----------------------------------
 include/block/raw-aio.h |  3 --
 2 files changed, 10 insertions(+), 65 deletions(-)

diff --git a/block/linux-aio.c b/block/linux-aio.c
index d4b61fb251..27100c2fd1 100644
--- a/block/linux-aio.c
+++ b/block/linux-aio.c
@@ -30,7 +30,6 @@
 #define MAX_EVENTS 128
 
 struct qemu_laiocb {
-    BlockAIOCB common;
     Coroutine *co;
     LinuxAioState *ctx;
     struct iocb iocb;
@@ -72,7 +71,7 @@ static inline ssize_t io_event_ret(struct io_event *ev)
 }
 
 /*
- * Completes an AIO request (calls the callback and frees the ACB).
+ * Completes an AIO request.
  */
 static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)
 {
@@ -94,18 +93,15 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)
     }
 
     laiocb->ret = ret;
-    if (laiocb->co) {
-        /* If the coroutine is already entered it must be in ioq_submit() and
-         * will notice laio->ret has been filled in when it eventually runs
-         * later.  Coroutines cannot be entered recursively so avoid doing
-         * that!
-         */
-        if (!qemu_coroutine_entered(laiocb->co)) {
-            aio_co_wake(laiocb->co);
-        }
-    } else {
-        laiocb->common.cb(laiocb->common.opaque, ret);
-        qemu_aio_unref(laiocb);
+
+    /*
+     * If the coroutine is already entered it must be in ioq_submit() and
+     * will notice laio->ret has been filled in when it eventually runs
+     * later.  Coroutines cannot be entered recursively so avoid doing
+     * that!
+     */
+    if (!qemu_coroutine_entered(laiocb->co)) {
+        aio_co_wake(laiocb->co);
     }
 }
 
@@ -273,30 +269,6 @@ static bool qemu_laio_poll_cb(void *opaque)
     return true;
 }
 
-static void laio_cancel(BlockAIOCB *blockacb)
-{
-    struct qemu_laiocb *laiocb = (struct qemu_laiocb *)blockacb;
-    struct io_event event;
-    int ret;
-
-    if (laiocb->ret != -EINPROGRESS) {
-        return;
-    }
-    ret = io_cancel(laiocb->ctx->ctx, &laiocb->iocb, &event);
-    laiocb->ret = -ECANCELED;
-    if (ret != 0) {
-        /* iocb is not cancelled, cb will be called by the event loop later */
-        return;
-    }
-
-    laiocb->common.cb(laiocb->common.opaque, laiocb->ret);
-}
-
-static const AIOCBInfo laio_aiocb_info = {
-    .aiocb_size         = sizeof(struct qemu_laiocb),
-    .cancel_async       = laio_cancel,
-};
-
 static void ioq_init(LaioQueue *io_q)
 {
     QSIMPLEQ_INIT(&io_q->pending);
@@ -431,30 +403,6 @@ int coroutine_fn laio_co_submit(BlockDriverState *bs, LinuxAioState *s, int fd,
     return laiocb.ret;
 }
 
-BlockAIOCB *laio_submit(BlockDriverState *bs, LinuxAioState *s, int fd,
-        int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
-        BlockCompletionFunc *cb, void *opaque, int type)
-{
-    struct qemu_laiocb *laiocb;
-    off_t offset = sector_num * BDRV_SECTOR_SIZE;
-    int ret;
-
-    laiocb = qemu_aio_get(&laio_aiocb_info, bs, cb, opaque);
-    laiocb->nbytes = nb_sectors * BDRV_SECTOR_SIZE;
-    laiocb->ctx = s;
-    laiocb->ret = -EINPROGRESS;
-    laiocb->is_read = (type == QEMU_AIO_READ);
-    laiocb->qiov = qiov;
-
-    ret = laio_do_submit(fd, laiocb, offset, type);
-    if (ret < 0) {
-        qemu_aio_unref(laiocb);
-        return NULL;
-    }
-
-    return &laiocb->common;
-}
-
 void laio_detach_aio_context(LinuxAioState *s, AioContext *old_context)
 {
     aio_set_event_notifier(old_context, &s->e, false, NULL, NULL);
diff --git a/include/block/raw-aio.h b/include/block/raw-aio.h
index ba223dd1f1..0cb7cc74a2 100644
--- a/include/block/raw-aio.h
+++ b/include/block/raw-aio.h
@@ -50,9 +50,6 @@ LinuxAioState *laio_init(Error **errp);
 void laio_cleanup(LinuxAioState *s);
 int coroutine_fn laio_co_submit(BlockDriverState *bs, LinuxAioState *s, int fd,
                                 uint64_t offset, QEMUIOVector *qiov, int type);
-BlockAIOCB *laio_submit(BlockDriverState *bs, LinuxAioState *s, int fd,
-        int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
-        BlockCompletionFunc *cb, void *opaque, int type);
 void laio_detach_aio_context(LinuxAioState *s, AioContext *old_context);
 void laio_attach_aio_context(LinuxAioState *s, AioContext *new_context);
 void laio_io_plug(BlockDriverState *bs, LinuxAioState *s);
-- 
2.17.1



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

* Re: [Qemu-devel] [PATCH] block/linux-aio: Drop unused BlockAIOCB submission method
  2019-06-02 20:17 [Qemu-devel] [PATCH] block/linux-aio: Drop unused BlockAIOCB submission method Julia Suvorova via Qemu-devel
@ 2019-06-03  7:14 ` Stefan Hajnoczi
  2019-06-03  7:51 ` Kevin Wolf
  2019-06-03  9:00 ` no-reply
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2019-06-03  7:14 UTC (permalink / raw)
  To: Julia Suvorova
  Cc: Kevin Wolf, qemu-devel, Max Reitz, Stefan Hajnoczi,
	Paolo Bonzini, Aarushi Mehta

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

On Sun, Jun 02, 2019 at 11:17:09PM +0300, Julia Suvorova via Qemu-devel wrote:
> Callback-based laio_submit() and laio_cancel() were left after
> rewriting Linux AIO backend to coroutines in hope that they would be
> used in other code that could bypass coroutines. They can be safely
> removed because they have not been used since that time.
> 
> Signed-off-by: Julia Suvorova <jusual@mail.ru>
> ---
>  block/linux-aio.c       | 72 ++++++-----------------------------------
>  include/block/raw-aio.h |  3 --
>  2 files changed, 10 insertions(+), 65 deletions(-)

Thank you!

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [Qemu-devel] [PATCH] block/linux-aio: Drop unused BlockAIOCB submission method
  2019-06-02 20:17 [Qemu-devel] [PATCH] block/linux-aio: Drop unused BlockAIOCB submission method Julia Suvorova via Qemu-devel
  2019-06-03  7:14 ` Stefan Hajnoczi
@ 2019-06-03  7:51 ` Kevin Wolf
  2019-06-03  9:00 ` no-reply
  2 siblings, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2019-06-03  7:51 UTC (permalink / raw)
  To: Julia Suvorova
  Cc: Paolo Bonzini, Max Reitz, qemu-devel, Stefan Hajnoczi, Aarushi Mehta

Am 02.06.2019 um 22:17 hat Julia Suvorova geschrieben:
> Callback-based laio_submit() and laio_cancel() were left after
> rewriting Linux AIO backend to coroutines in hope that they would be
> used in other code that could bypass coroutines. They can be safely
> removed because they have not been used since that time.
> 
> Signed-off-by: Julia Suvorova <jusual@mail.ru>

Thanks, applied to the block branch.

Kevin


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

* Re: [Qemu-devel] [PATCH] block/linux-aio: Drop unused BlockAIOCB submission method
  2019-06-02 20:17 [Qemu-devel] [PATCH] block/linux-aio: Drop unused BlockAIOCB submission method Julia Suvorova via Qemu-devel
  2019-06-03  7:14 ` Stefan Hajnoczi
  2019-06-03  7:51 ` Kevin Wolf
@ 2019-06-03  9:00 ` no-reply
  2 siblings, 0 replies; 4+ messages in thread
From: no-reply @ 2019-06-03  9:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: kwolf, qemu-devel, mreitz, stefanha, pbonzini, jusual, mehta.aaru20

Patchew URL: https://patchew.org/QEMU/20190602201709.11901-1-jusual@mail.ru/



Hi,

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

Subject: [Qemu-devel] [PATCH] block/linux-aio: Drop unused BlockAIOCB submission method
Type: series
Message-id: 20190602201709.11901-1-jusual@mail.ru

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

From https://github.com/patchew-project/qemu
 * [new tag]               patchew/20190602201709.11901-1-jusual@mail.ru -> patchew/20190602201709.11901-1-jusual@mail.ru
Switched to a new branch 'test'
299a71c8ce block/linux-aio: Drop unused BlockAIOCB submission method

=== OUTPUT BEGIN ===
ERROR: Author email address is mangled by the mailing list
#2: 
Author: Julia Suvorova via Qemu-devel <qemu-devel@nongnu.org>

total: 1 errors, 0 warnings, 111 lines checked

Commit 299a71c8ced6 (block/linux-aio: Drop unused BlockAIOCB submission method) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190602201709.11901-1-jusual@mail.ru/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

end of thread, other threads:[~2019-06-03  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-02 20:17 [Qemu-devel] [PATCH] block/linux-aio: Drop unused BlockAIOCB submission method Julia Suvorova via Qemu-devel
2019-06-03  7:14 ` Stefan Hajnoczi
2019-06-03  7:51 ` Kevin Wolf
2019-06-03  9:00 ` 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.