From nobody Sun Feb 8 18:29:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) 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=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1564508512; cv=none; d=zoho.com; s=zohoarc; b=F4qq3gjBvIwzHqMTTHBN/xXWjilOIRI1zRMDzW4UdvzBseheKbscTybfHs8b6S6SzlidhDqC9CG/Svqwgfb37XqSHDQXD6VGbtWoexF+OCaULbt21+DUU8PWv2/nzByVuUZns0rPIlF4WVC5AnkWRMAoZkFNy14OPS4eQEhCfVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564508512; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ipr3iNyxvPc1pw+FEpkLWVBnB0CK9mROZwdZiLP7cbc=; b=LCNjnHQVF+FMtKGTxax9FnZqPulVsHfCtliLb4gRPZ8wjr0WJAUz6U02yTPNRmlYfZmgzOaB9yNwe0ZYZVWNcmaEDgx15OpChJUHY36FZVrE1sWptbOeJIvwaEQF6sZcB2/Q8inHg1w320DdLaGKTlciREBASgDQ+KA8LoVPr5Y= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1564508512622547.8060808521798; Tue, 30 Jul 2019 10:41:52 -0700 (PDT) Received: from localhost ([::1]:35220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsW8F-0007rk-Md for importer@patchew.org; Tue, 30 Jul 2019 13:41:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35836) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsW30-0005rH-Pf for qemu-devel@nongnu.org; Tue, 30 Jul 2019 13:36:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsW2z-0000PX-KB for qemu-devel@nongnu.org; Tue, 30 Jul 2019 13:36:26 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:33817) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsW2z-0000P8-Da; Tue, 30 Jul 2019 13:36:25 -0400 Received: by mail-pf1-x441.google.com with SMTP id b13so30208413pfo.1; Tue, 30 Jul 2019 10:36:25 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.97]) by smtp.gmail.com with ESMTPSA id q24sm59122895pjp.14.2019.07.30.10.36.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 30 Jul 2019 10:36:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ipr3iNyxvPc1pw+FEpkLWVBnB0CK9mROZwdZiLP7cbc=; b=cAL0ShHQZsLPdL3PFRrNQ17vNpwMi7pb5aJ6MHfW9L0DGYWgLq3IkrFSqczAw0Jet8 gnHlgUBtDE9tUGDaywSxy+IiIosKd6qqOWG6kNIeBqsjcnU3XsnHqdMNa8y2sYdIe00I jSCPwPV1RJuvd3WpYUsVuf1J3RA0ub9FBWINxtdBRqeCPQhd/IJXlgZ4+FAH4AfZidJB m8gqn1UL26q+Xjh51ujr2I606s+jd+mGntWlqZBNZwL7/FCUMtD2D/Yz/WWNAF//SEQt wuCaMsofIhqijK15HnSX2bp5p9kM6x+8kKQpuvKqDFJBmdc4S/wj/yj3Cf6Uiv/9IuZh dZ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ipr3iNyxvPc1pw+FEpkLWVBnB0CK9mROZwdZiLP7cbc=; b=GW/Q09BrpEtHaB7iZJvhYgLMswTadqR5lyC4LwLGuHTlYS1KTKLymWd0bwRThzJMli fV5JggEYZZ49CvSIwgBiNgu4/9p1CjJppwPrb4Vz4HtIfklBrFvurhDVV6jiNLFS9GKq 7rjioO34Y95IGDedH4a1On2JyZHPosnpedyTIHvmlkzCDmnOwOakCuuCpjjfSS4Wzgxq gq3xDHMTbemgiE/9uVswzof4J737QKKukhkN3rcwh/DsguJcm+8JfuYATTFtsybP5MSn LXiIe/Sh/ehQUXxtTCnIpIIkl2Ql9wIF+eMDpQIosozMY7Urj8ltxNxE3LIdwFSLcQCR Ol6Q== X-Gm-Message-State: APjAAAXduR0EKBh6p367afi5+kH/6kZinzjFbQPk1m6252tU+ZUja7xG SXXAFXh/NVloE7Lfn0M7Pni5lP+3P+oKxA== X-Google-Smtp-Source: APXvYqxh12DVKX8vkQ9g3bjhtCaX/MJjbIzLvGJhl2gB1qocXPsxfSCkcVLdieKmIcBoy4Hyy2xQRQ== X-Received: by 2002:a17:90a:9f4a:: with SMTP id q10mr117732468pjv.95.1564508184100; Tue, 30 Jul 2019 10:36:24 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Tue, 30 Jul 2019 23:04:36 +0530 Message-Id: <20190730173441.26486-12-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190730173441.26486-1-mehta.aaru20@gmail.com> References: <20190730173441.26486-1-mehta.aaru20@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH v8 11/16] qemu-io: adds option to use aio engine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Maxim Levitsky , saket.sinha89@gmail.com, Max Reitz , Stefan Hajnoczi , Paolo Bonzini , Stefan Hajnoczi , 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-Type: text/plain; charset="utf-8" Signed-off-by: Aarushi Mehta --- qemu-io.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index f64eca6940..0abb4af134 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -130,7 +130,8 @@ static void open_help(void) " -C, -- use copy-on-read\n" " -n, -- disable host cache, short for -t none\n" " -U, -- force shared permissions\n" -" -k, -- use kernel AIO implementation (on Linux only)\n" +" -k, -- use kernel AIO implementation (Linux only, prefer use of -i)\n" +" -i, -- use AIO mode (threads, native or io_uring)\n" " -t, -- use the given cache mode for the image\n" " -d, -- use the given discard mode for the image\n" " -o, -- options to be given to the block driver" @@ -172,7 +173,7 @@ static int open_f(BlockBackend *blk, int argc, char **a= rgv) QDict *opts; bool force_share =3D false; =20 - while ((c =3D getopt(argc, argv, "snCro:kt:d:U")) !=3D -1) { + while ((c =3D getopt(argc, argv, "snCro:ki:t:d:U")) !=3D -1) { switch (c) { case 's': flags |=3D BDRV_O_SNAPSHOT; @@ -204,6 +205,13 @@ static int open_f(BlockBackend *blk, int argc, char **= argv) return -EINVAL; } break; + case 'i': + if (bdrv_parse_aio(optarg, &flags) < 0) { + error_report("Invalid aio option: %s", optarg); + qemu_opts_reset(&empty_opts); + return -EINVAL; + } + break; case 'o': if (imageOpts) { printf("--image-opts and 'open -o' are mutually exclusive\= n"); @@ -291,7 +299,9 @@ static void usage(const char *name) " -n, --nocache disable host cache, short for -t none\n" " -C, --copy-on-read enable copy-on-read\n" " -m, --misalign misalign allocations for O_DIRECT\n" -" -k, --native-aio use kernel AIO implementation (on Linux only)\n" +" -k, --native-aio use kernel AIO implementation\n" +" (Linux only, prefer use of -i)\n" +" -i, --aio=3DMODE use AIO mode (threads, native or io_uring)\n" " -t, --cache=3DMODE use the given cache mode for the image\n" " -d, --discard=3DMODE use the given discard mode for the image\n" " -T, --trace [[enable=3D]][,events=3D][,file=3D]\n" @@ -489,7 +499,7 @@ static QemuOptsList file_opts =3D { int main(int argc, char **argv) { int readonly =3D 0; - const char *sopt =3D "hVc:d:f:rsnCmkt:T:U"; + const char *sopt =3D "hVc:d:f:rsnCmki:t:T:U"; const struct option lopt[] =3D { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, @@ -501,6 +511,7 @@ int main(int argc, char **argv) { "copy-on-read", no_argument, NULL, 'C' }, { "misalign", no_argument, NULL, 'm' }, { "native-aio", no_argument, NULL, 'k' }, + { "aio", required_argument, NULL, 'i' }, { "discard", required_argument, NULL, 'd' }, { "cache", required_argument, NULL, 't' }, { "trace", required_argument, NULL, 'T' }, @@ -568,6 +579,12 @@ int main(int argc, char **argv) case 'k': flags |=3D BDRV_O_NATIVE_AIO; break; + case 'i': + if (bdrv_parse_aio(optarg, &flags) < 0) { + error_report("Invalid aio option: %s", optarg); + exit(1); + } + break; case 't': if (bdrv_parse_cache_mode(optarg, &flags, &writethrough) < 0) { error_report("Invalid cache option: %s", optarg); --=20 2.21.0