From nobody Mon Feb 9 00:06:58 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=1596016464; cv=none; d=zohomail.com; s=zohoarc; b=kD1Ac+X3u9ZYIo+X0XlOcftQ2NIgXsoqP6/q56Z2wtIaJkajJGfhO6ELOeUp78Cfkwv5tJZX4PEwozg3mut7e5QZouXh2Ic/Q7djXPuRvacJPm15168GQFGTZGvwswjsCyCgLq1B8iKAU9gJjIC6PU15bHMfavWWfQkaUYpzSSY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596016464; 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=7YfBaX+4mZIaB/1KGeVpeZ5wEcuMfcWwYHidz6lYcoU=; b=OElm7AmfgDViJc1lsidecVeeDbFB/IHnXIu0W3kCSQ7scvOjQgW+cY2eCqOU5a8aTIqcPeGtnleWsblhIDH1OKg1RFScIaBBiTuZxPrMvjaNhbTE/20P4nsYZgqyTco+EzJZK8kudRv8U2wrj2IN45P3mNujk9f8SpDlGBWc0Xw= 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 1596016464126150.4458657091726; Wed, 29 Jul 2020 02:54:24 -0700 (PDT) Received: from localhost ([::1]:42214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0in0-0006O2-KS for importer@patchew.org; Wed, 29 Jul 2020 05:54:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0imC-0005my-2d for qemu-devel@nongnu.org; Wed, 29 Jul 2020 05:53:32 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:40351) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0imA-0005XD-Fy for qemu-devel@nongnu.org; Wed, 29 Jul 2020 05:53:31 -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=7YfBaX+4mZIaB/1KGeVpeZ5wEcuMfcWwYHidz6lYcoU=; b=PypMt BZVlA48zbxiit1W8HI/R8ejsFU+1+8JnKYJOggcND1eroxKdTvpFiGsqtExMFTSvTdIoLAaXNaM4P qj6x6xbV4Z3xs4OGgWwR7pGXmwvvapigjfIoELoo+Bvrv27mXYJu5QwywK7ctA5OfolIomtaba/7N EZmK6PJKF4BaDiF9kJSbA3ayNHRiLDKZx//E5T4CHS6RFykz7zSim5QNNmYgeuH0URl2IBZNbnhyL G1KawCLL8FjNpJYXsTVhtBUE5AEMHqOztuyJ5zYcBgKnUlhtlTzNjUxFMhsUkXAnPo390+1mrZbcC kg9SjsNNW/mWAM5HYFLAjumgfeZzg==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Wed, 29 Jul 2020 10:11:54 +0200 Subject: [PATCH v8 3/7] 9pfs: split out fs driver core of v9fs_co_readdir() To: qemu-devel@nongnu.org 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=a426ee06e77584fa2d8253ce5d8bea519eb3ffd4@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/29 05:20:03 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, 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=ham 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 --- hw/9pfs/codir.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/hw/9pfs/codir.c b/hw/9pfs/codir.c index 73f9a751e1..ff57fb8619 100644 --- a/hw/9pfs/codir.c +++ b/hw/9pfs/codir.c @@ -18,28 +18,37 @@ #include "qemu/main-loop.h" #include "coth.h" =20 +/* + * This must solely be executed on a background IO thread. + */ +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