From nobody Mon Feb 9 01:35:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1597236171; cv=none; d=zohomail.com; s=zohoarc; b=B95M8LaxDU8BwxkP1CfDEodIiQ2lFnaqfdq7jOXjOsyXL+1oJ5FW/kRjqPWa4lBYr1lIM5dBrCwnuvpjRdd2zKcU88ynk2NuDy1GJgzXoCxCyQn7tW6FAaQH7DFPPNpL98kECOSaIKbIgCIhHPqSbNX9yd4hyTuMFFd4WptfsM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597236171; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=T2J09mvUFLK9pfie0B4k4vjsxQngaipbuBkNxzJ0X1s=; b=XdonWLPgDdGbnpGG2yaulGfU6yibVpvtra68SUbZgC/SOMPRmx2uztnwBuPPZWwGCuOoaqxOhgc4WdEg+n+DIrpcwwEHRuq2luEAHH+ZxSGeLctzladd7MjDcik6qWjYcXoMAPdRhjRAjQDSDHmMWqlpOyzKseVVW0FI8quiCuQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine 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 1597236171235623.3371317452192; Wed, 12 Aug 2020 05:42:51 -0700 (PDT) Received: from localhost ([::1]:44492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5q5i-00031m-2G for importer@patchew.org; Wed, 12 Aug 2020 08:42:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5q4j-0001em-FH for qemu-devel@nongnu.org; Wed, 12 Aug 2020 08:41:50 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:32807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5q4i-00058D-26 for qemu-devel@nongnu.org; Wed, 12 Aug 2020 08:41:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=T2J09mvUFLK9pfie0B4k4vjsxQngaipbuBkNxzJ0X1s=; b=TfqU/ QpGgsPzQ0uyYVpv7BW4VdRHZIN4jCvRDFkrTVyZOA8mqUpuSEDoanDgfWRVL69xcDEOzluhBHDNwk De/m1f4xNvCsf7EPhCgHPhu4Hr80J8bRgX8r8prHV82RovzderNVZ1HAT4UUiBIgrsoJFZURmJlXA bG2q3ee0Db707R2a+cH0KzUUTb89TmxlAVS6IpebjSA2x5VPLrt+H3WxjbHYqVkRnBt1yOqPj82k2 OyUJ8Kun57o22BztzP7LhCf9MpExTqh91leKpy7R5sfj1NbZLjEHf7M4SOwLvbgMB1g7hLx/cmSE+ o0049fS2SotP6FPNAW2yYnDXvE5pQ==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Wed, 29 Jul 2020 10:11:54 +0200 Subject: [PULL 3/7] 9pfs: split out fs driver core of v9fs_co_readdir() To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=dd8151f4fed6ee078a33cff4caa9ac5c558940ef@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/12 08:16:56 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The implementation of v9fs_co_readdir() has two parts: the outer part is executed by main I/O thread, whereas the inner part is executed by fs driver on a background I/O thread. Move the inner part to its own new, private function do_readdir(), so it can be shared by another upcoming new function. This is just a preparatory patch for the subsequent patch, with the purpose to avoid the next patch to clutter the overall diff. Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: Signed-off-by: Christian Schoenebeck --- hw/9pfs/codir.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/hw/9pfs/codir.c b/hw/9pfs/codir.c index 73f9a751e1..24e1955ab2 100644 --- a/hw/9pfs/codir.c +++ b/hw/9pfs/codir.c @@ -18,28 +18,38 @@ #include "qemu/main-loop.h" #include "coth.h" =20 +/* + * Intended to be called from bottom-half (e.g. background I/O thread) + * context. + */ +static int do_readdir(V9fsPDU *pdu, V9fsFidState *fidp, struct dirent **de= nt) +{ + int err =3D 0; + V9fsState *s =3D pdu->s; + struct dirent *entry; + + errno =3D 0; + entry =3D s->ops->readdir(&s->ctx, &fidp->fs); + if (!entry && errno) { + *dent =3D NULL; + err =3D -errno; + } else { + *dent =3D entry; + } + return err; +} + int coroutine_fn v9fs_co_readdir(V9fsPDU *pdu, V9fsFidState *fidp, struct dirent **dent) { int err; - V9fsState *s =3D pdu->s; =20 if (v9fs_request_cancelled(pdu)) { return -EINTR; } - v9fs_co_run_in_worker( - { - struct dirent *entry; - - errno =3D 0; - entry =3D s->ops->readdir(&s->ctx, &fidp->fs); - if (!entry && errno) { - err =3D -errno; - } else { - *dent =3D entry; - err =3D 0; - } - }); + v9fs_co_run_in_worker({ + err =3D do_readdir(pdu, fidp, dent); + }); return err; } =20 --=20 2.20.1