Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7799975rwl; Tue, 10 Jan 2023 05:40:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXuTmVOMqR5VwvmcxSNUZ7n2i9QYMeylumzFbqeTg6FZWtrzZ/z3ptHq+nzW+gi2G3vkHDfH X-Received: by 2002:a17:906:c0d5:b0:84d:2eb0:57d6 with SMTP id bn21-20020a170906c0d500b0084d2eb057d6mr13528736ejb.52.1673358018388; Tue, 10 Jan 2023 05:40:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673358018; cv=none; d=google.com; s=arc-20160816; b=BD/YzB+bZN/VZyHiBE8EP5ha9toQkC6E2Z3w+55Fxt+O+O/KzNMQQDZ8/bzfqnGNkH 4gE6Vy75Pn75ebQ+xACYYM+YLyQMvdN0dN5I1MxseMKTeiaRGC+308pRr02Gu220dvzm ek5TQyPdNA9s2yTdA5pfDklAKSoAOPxuhxoJXSYVkLVgZaQiUMjkRLFD0DIbZnuWdldz hRBr2AXyz2LWf3Qa/2dbsBJJz+7NCY4IjMsDV2+aVGTRKXe7hCPq2YcLoGjLGVh0ybij 6tkYpCn1+Wdwwwt02EglqTXbxxP6cDLpgfEbzyLm1YHDpW1IiOtK16OJgL1B9fpKcwmG lwqA== 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; bh=iaT9LQ1txjWmxV1XSqA3EJtlgw8CwLxTrjASqWSS7ew=; b=xYKQlWVU04px4qdrh0cBVfgE0clJqK2CF0lUjYI+pkd1ridPtVVWa3xcmJcyynCV8t H7bwoVOAYmYIGPONEnMsMc7LMUzKP73JlXVvcSXFK/lxVCocFhvEd72ZYI+mRE97Jfpb Vpj+tWQMH0oEUYYdi5enotCZwO9DVRjdNw8DN9g21oh8ixEXG8vfjx5I6eXCzp2sXJoi SR2PXv02wkO/JMqhtwXa/kl6rkWxocwCNhXU8tELtRvfUcQR0coltDUJDI4jhyV8SwKO zDigs3ABVRhsfBAm40DIVMYRyPyQUW9CG/GTMnBEmIjvAUR+gubHhjqxD1VVjmc3TOiY Tn3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=epUV45ap; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw10-20020a1709066a0a00b0080f0493b9c2si11028992ejc.249.2023.01.10.05.39.50; Tue, 10 Jan 2023 05:40:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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=@infradead.org header.s=casper.20170209 header.b=epUV45ap; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232546AbjAJNfK (ORCPT + 99 others); Tue, 10 Jan 2023 08:35:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238613AbjAJNes (ORCPT ); Tue, 10 Jan 2023 08:34:48 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80EE95792F; Tue, 10 Jan 2023 05:34:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=iaT9LQ1txjWmxV1XSqA3EJtlgw8CwLxTrjASqWSS7ew=; b=epUV45aphPRps7u7Vq4Cq2vV62 Mit3JVAAMWsoPGuvfc8UjBmHKZ1ppZrvqfZXJCvAPnuHAvP1Qrb4ehCWA7e+vCzpqZHMlWb9Hws8S A1f1dD49dUdh4aj0DW0R0Sfq69V/J5AzIofvjxjVU6NiOw6dKaZZUKctwR/ldOlGgUHa0l9O2da/T HdoM0Tgph2sBGPLtuwn+1HpFzLxbHFFj9xmtEFmxVNPeqvnWbZWGF8OJaITltqqa9KhZz2SpcaNCt Fp+x9zPIQx3XMNyPCjf2vKIkWdQPiKs619GLOCwidJ1JWPy1QJ3tJS9y0MJZDjixqlQeV3r5jy0VP SXHPpeUw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFElc-003FE0-AE; Tue, 10 Jan 2023 13:34:16 +0000 Date: Tue, 10 Jan 2023 13:34:16 +0000 From: Matthew Wilcox To: Christoph Hellwig Cc: Andreas Gruenbacher , Dave Chinner , "Darrick J . Wong" , Alexander Viro , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, cluster-devel@redhat.com, Christoph Hellwig Subject: Re: [RFC v6 04/10] iomap: Add iomap_get_folio helper Message-ID: References: <20230108213305.GO1971568@dread.disaster.area> <20230108194034.1444764-1-agruenba@redhat.com> <20230108194034.1444764-5-agruenba@redhat.com> <20230109124642.1663842-1-agruenba@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Jan 10, 2023 at 12:46:45AM -0800, Christoph Hellwig wrote: > On Mon, Jan 09, 2023 at 01:46:42PM +0100, Andreas Gruenbacher wrote: > > We can handle that by adding a new IOMAP_NOCREATE iterator flag and > > checking for that in iomap_get_folio(). Your patch then turns into > > the below. > > Exactly. And as I already pointed out in reply to Dave's original > patch what we really should be doing is returning an ERR_PTR from > __filemap_get_folio instead of reverse-engineering the expected > error code. Ouch, we have a nasty problem. If somebody passes FGP_ENTRY, we can return a shadow entry. And the encodings for shadow entries overlap with the encodings for ERR_PTR, meaning that some shadow entries will look like errors. The way I solved this in the XArray code is by shifting the error values by two bits and encoding errors as XA_ERROR(-ENOMEM) (for example). I don't _object_ to introducing XA_ERROR() / xa_err() into the VFS, but so far we haven't, and I'd like to make that decision intentionally.