From nobody Thu May 16 15:12:09 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1559506726; cv=none; d=zoho.com; s=zohoarc; b=kGi6nKebAhPu7yXMcbITZtXvcbGPTmHKEeGaFfLH++ksTPpu06eN8aSF3UKHX1mIO8VjpSKxqbdUW2BmAzd9YG2nfx578erjYlzP7RsrvN6ou9htIcJJI4Fl46+70j8z8duPnFTRkmidD/eVuiF4UUZmubAHo5ukjoXZRQtFFvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559506726; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=JJC3y5FgvvbzIXcCDu3j94Y1erdK3NlWW/tiF8L6Oi4=; b=RK2dmK2zAYPWt0dJMFLDg+sMXE6iWAt6lz1sCoHBXmZI9cU8vBVLmn3eWAkvaqjmN2xoUN9CBnnnIHBKSDkGsI62wRhoLNx1JcA4eeKUj2H78iMBkn2lPWuOm6XouDq7j/z1cHr3WJWMhAkEFFGqGyAa/swBGwWYAW/BcanUA2g= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559506725904200.17257735668693; Sun, 2 Jun 2019 13:18:45 -0700 (PDT) Received: from localhost ([127.0.0.1]:52542 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hXWw2-0002Fe-Lv for importer@patchew.org; Sun, 02 Jun 2019 16:18:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hXWvB-0001iS-5J for qemu-devel@nongnu.org; Sun, 02 Jun 2019 16:17:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hXWv9-00068u-Tn for qemu-devel@nongnu.org; Sun, 02 Jun 2019 16:17:37 -0400 Received: from smtp48.i.mail.ru ([94.100.177.108]:56354) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hXWv9-00067a-Aq for qemu-devel@nongnu.org; Sun, 02 Jun 2019 16:17:35 -0400 Received: by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1hXWv4-0001PM-Jx; Sun, 02 Jun 2019 23:17:31 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Message-Id:Date:Subject:Cc:To:From; bh=JJC3y5FgvvbzIXcCDu3j94Y1erdK3NlWW/tiF8L6Oi4=; b=mSd9TL1M6A38vVBi6nGczgUPdD/PGSyzTgg7SvX7OeefhCJCDWVM9XUrKY81jxCyqfVbfVJnVO4Icla4pBKJtZHy+NAnITdykgNjalzBcSdEZg19Vg9uwTZDPjk/INTb8UgCBYSYf2OmuRV6V9kHvMX55+ge3rkdMT5fwUv5zAA=; To: qemu-devel@nongnu.org Date: Sun, 2 Jun 2019 23:17:09 +0300 Message-Id: <20190602201709.11901-1-jusual@mail.ru> X-Mailer: git-send-email 2.17.1 Authentication-Results: smtp48.i.mail.ru; auth=pass smtp.auth=jusual@mail.ru smtp.mailfrom=jusual@mail.ru X-77F55803: 257C4F86AB09C89C5A78504BD2AC2941988784FC6C4AE31F9672AF9B3B928BC0910B9CD103F8184182AE88D8AAE8D318A3B75102AD07AABE X-7FA49CB5: 0D63561A33F958A5DF53127363732015EA709D4FA80CC134FCB00143F2C94C828941B15DA834481FA18204E546F3947C25D43C09D2508269F6B57BC7E64490618DEB871D839B7333395957E7521B51C2545D4CF71C94A83E9FA2833FD35BB23D27C277FBC8AE2E8B6D77D8F98F67F34EA471835C12D1D977C4224003CC8364767815B9869FA544D8D32BA5DBAC0009BE9E8FC8737B5C22497C48477FF724415E3AA81AA40904B5D9CF19DD082D7633A093541453170D46FCD81D268191BDAD3D78DA827A17800CE7436E4CC186B5AB2DB3661434B16C20AC93541453170D46FCAAAE862A0553A39223F8577A6DFFEA7C29113EBC45E7010B072AAC739A9836F6EFF80C71ABB335746BA297DBC24807EA27F269C8F02392CD9B131C21E5171FED3C9F3DD0FB1AF5EB4E70A05D1297E1BBCB5012B2E24CD356 X-Mailru-Sender: 42ECD68FB001EF95CFF07A00C0DCB66EA366D5AA146F84BACBA5A4425A1ADE1CAED14ECBD12AF47CBCD5BA2C93075E1EC77752E0C033A69E882C431543FD75E20226C39053983FF03453F38A29522196 X-Mras: OK X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 94.100.177.108 Subject: [Qemu-devel] [PATCH] block/linux-aio: Drop unused BlockAIOCB submission method X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Julia Suvorova via Qemu-devel Reply-To: Julia Suvorova Cc: Kevin Wolf , Max Reitz , Stefan Hajnoczi , Paolo Bonzini , Julia Suvorova , Aarushi Mehta Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Stefan Hajnoczi --- 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 =20 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) } =20 /* - * 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_la= iocb *laiocb) } =20 laiocb->ret =3D 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); } } =20 @@ -273,30 +269,6 @@ static bool qemu_laio_poll_cb(void *opaque) return true; } =20 -static void laio_cancel(BlockAIOCB *blockacb) -{ - struct qemu_laiocb *laiocb =3D (struct qemu_laiocb *)blockacb; - struct io_event event; - int ret; - - if (laiocb->ret !=3D -EINPROGRESS) { - return; - } - ret =3D io_cancel(laiocb->ctx->ctx, &laiocb->iocb, &event); - laiocb->ret =3D -ECANCELED; - if (ret !=3D 0) { - /* iocb is not cancelled, cb will be called by the event loop late= r */ - return; - } - - laiocb->common.cb(laiocb->common.opaque, laiocb->ret); -} - -static const AIOCBInfo laio_aiocb_info =3D { - .aiocb_size =3D sizeof(struct qemu_laiocb), - .cancel_async =3D 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; } =20 -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 =3D sector_num * BDRV_SECTOR_SIZE; - int ret; - - laiocb =3D qemu_aio_get(&laio_aiocb_info, bs, cb, opaque); - laiocb->nbytes =3D nb_sectors * BDRV_SECTOR_SIZE; - laiocb->ctx =3D s; - laiocb->ret =3D -EINPROGRESS; - laiocb->is_read =3D (type =3D=3D QEMU_AIO_READ); - laiocb->qiov =3D qiov; - - ret =3D 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, in= t fd, uint64_t offset, QEMUIOVector *qiov, int t= ype); -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); --=20 2.17.1