Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5010377rwr; Sun, 23 Apr 2023 19:06:38 -0700 (PDT) X-Google-Smtp-Source: AKy350ZVsXMA7KEP1VQ/m8C51WVIEhXpChUKChXqfxG2jbgA5Ub0PhSKwjA4iK8u+UuLVwNEPWZi X-Received: by 2002:a05:6a00:b51:b0:5a8:8535:18b with SMTP id p17-20020a056a000b5100b005a88535018bmr16204604pfo.11.1682301997916; Sun, 23 Apr 2023 19:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682301997; cv=none; d=google.com; s=arc-20160816; b=L1cP2dnd3hnP1o7i5OdzzXr0yVZkRGMZzeyJ4+opJLhsy2JldxtHeo3GSYKl9UZysI A8oyTbeDHp+Et/L4ZG3VU2vXxS1soaBIQjq2oW5qcqMkiFzBy0yZnZBz8DXYWDTJBQ9h b4gl/i6P1I8e/suyMwcSMQ5bj/0KsXMn86SkMG3Krv8RqxTi378FpoOoMSW/k5Hh0wK4 Jv7Jgy4xzKzqMeak/uJ4OgZom8pKeRErnPib4HrvBheDpZvTr/nHUtdsPTJ3Te868YfR 81FnmHXPyHTnJ/W0Wxm93oVprAOFsv4Vblh4zWWJP41cIhxQkxfAXDLGY09wV/Z1zgAE aTXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=TQDHD4jI59yg5j92q8CZUXHlZNsl1jsaeFCptRogf/Y=; b=bz+9mUIZ8j/fS3VH64Tyoagj5ud0JwfLCKXw048c3VdjTR7sfPQFFeSOJAcHJ82FXJ pxKZ6m6zEePM4PGyMnL4uWerwv0KckM/Q7lmT676PgwXwh+huwX4OxlnwJjTrAEMRJZi NIikGMjYv5B2/LLM71z+XUPAMlVnw7l5HkC0d3nfl38Mykt8fS2cehbE7YCs9L0KPfJ3 4x1eeeKEIshSBRjqG1rNgf09tgJmtpBqmzjoqho6QFyGOYyYZympYLDeTTczY4aY1qz7 cVJa3CmeULlrOB7Q+0xi9NyvUuYNTFjjGOR+NW0DLhoDXq0m1xBTWrHVgbeS0baIezbN oIXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=nayINonr; dkim=pass header.i=@codewreck.org header.s=2 header.b=ZgF5Qrma; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codewreck.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g23-20020aa796b7000000b0063b71d46b6dsi9934897pfk.75.2023.04.23.19.06.25; Sun, 23 Apr 2023 19:06:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=nayINonr; dkim=pass header.i=@codewreck.org header.s=2 header.b=ZgF5Qrma; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codewreck.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229715AbjDWXn2 (ORCPT + 99 others); Sun, 23 Apr 2023 19:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229509AbjDWXn1 (ORCPT ); Sun, 23 Apr 2023 19:43:27 -0400 Received: from nautica.notk.org (ipv6.notk.org [IPv6:2001:41d0:1:7a93::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EF7810DC; Sun, 23 Apr 2023 16:43:24 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 108) id 686F9C01F; Mon, 24 Apr 2023 01:43:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1682293402; bh=TQDHD4jI59yg5j92q8CZUXHlZNsl1jsaeFCptRogf/Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nayINonr/sB4v3HW01quRhd+xr1575UgoZGlXNPxkHRu0meWc+xGEpBqEY90gPHP8 76XrWUKGCCJJHAc5BgkDSUrD8bJIk8M5Fql/xU50B5DBdZBo/JVG3oQFa5cy/gVoj4 jZkJ68P1PTuWSJnRJ5S4LszBxCoL+/UmJz+DYKjwxXMy5kpiFU6QIzcZPl+iA4MLXE XHKJ5xZZtOXPWer934KcW5il7y7zMyTxO4sFPr2o9UuC8Bfy6Wk2nui3/3IDr6SsvY olITCQkJ2zg12b4dQTSIcgxH3PfFzgeucr7OWzxMscw9F7hhmn6Heo+kPBnrLjQxMS 4yyfyFIdMnf+g== X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Received: from odin.codewreck.org (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id F0968C009; Mon, 24 Apr 2023 01:43:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1682293401; bh=TQDHD4jI59yg5j92q8CZUXHlZNsl1jsaeFCptRogf/Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZgF5QrmaAmHNgSkif+qUnkKMyLqSqljUL0cTguaelnnOqeGcCBVylo0uZENCEK2OK px1O6P0Sawbks/lLuOaBtLIguspd//gxo3jSUg9HRNbbNpSr+EIVZFg4whJ7AOb6FD 36ybP1jS7cloLsRTNhG1JVhJavATBrkwqQ51jJSW5yDIYbhT3ska57S68zUVlvY0JG Nh2pW/BY/4LYoHscdkLgto9pdpa8gAE6xy8qHHW2aJL4yB2VF2u4okCDSEAlVYxRHk 05tmLz0V0PySqMuHVDY9Snl2ArWz9ofBzLBNN9StZ1r72I4lMVvT0NzfEfZFNs9oon GHJwQGWA9WMxQ== Received: from localhost (odin.codewreck.org [local]) by odin.codewreck.org (OpenSMTPD) with ESMTPA id a40d7486; Sun, 23 Apr 2023 23:43:15 +0000 (UTC) Date: Mon, 24 Apr 2023 08:43:00 +0900 From: Dominique Martinet To: Dave Chinner Cc: Alexander Viro , Christian Brauner , Jens Axboe , Pavel Begunkov , Stefan Roesch , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, io-uring@vger.kernel.org Subject: Re: [PATCH RFC 2/2] io_uring: add support for getdents Message-ID: References: <20230422-uring-getdents-v1-0-14c1db36e98c@codewreck.org> <20230422-uring-getdents-v1-2-14c1db36e98c@codewreck.org> <20230423224045.GS447837@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230423224045.GS447837@dread.disaster.area> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dave Chinner wrote on Mon, Apr 24, 2023 at 08:40:45AM +1000: > This doesn't actually introduce non-blocking getdents operations, so > what's the point? If it just shuffles the getdents call off to a > background thread, why bother with io_uring in the first place? As said in the cover letter my main motivation really is simplifying the userspace application: - style-wise, mixing in plain old getdents(2) or readdir(3) in the middle of an io_uring handling loop just feels wrong; but this may just be my OCD talking. - in my understanding io_uring has its own thread pool, so even if the actual getdents is blocking other IOs can progress (assuming there is less blocked getdents than threads), without having to build one's own extra thread pool next to the uring handling. Looking at io_uring/fs.c the other "metadata related" calls there also use the synchronous APIs (renameat, unlinkat, mkdirat, symlinkat and linkat all do), so I didn't think of that as a problem in itself. > Filesystems like XFS can easily do non-blocking getdents calls - we > just need the NOWAIT plumbing (like we added to the IO path with > IOCB_NOWAIT) to tell the filesystem not to block on locks or IO. > Indeed, filesystems often have async readahead built into their > getdents paths (XFS does), so it seems to me that we really want > non-blocking getdents to allow filesystems to take full advantage of > doing work without blocking and then shuffling the remainder off to > a background thread when it actually needs to wait for IO.... I believe that can be done without any change of this API, so that'll be a very welcome addition when it is ready; I don't think the adding the uring op should wait on this if we can agree a simple wrapper API is good enough (or come up with a better one if someone has a Good Idea) (looking at io_uring/rw.c for comparison, io_getdents() will "just" need to be adjusted to issue an async req if IO_URING_F_NONBLOCK is set, and the poll/retry logic sorted out) Thanks, -- Dominique Martinet | Asmadeus