Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2098436rwb; Sun, 15 Jan 2023 09:09:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXvL0/I6rJY8+VIZxebPEqtb118+rDDhY3JaO7F1mXy0uX8sY0zgoQViFUx1A7IBkyyrHKiN X-Received: by 2002:a50:cc4c:0:b0:463:e2cd:a8b5 with SMTP id n12-20020a50cc4c000000b00463e2cda8b5mr78672714edi.11.1673802573555; Sun, 15 Jan 2023 09:09:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673802573; cv=none; d=google.com; s=arc-20160816; b=R1p6dKy81hQpiYNYqjiCodOGhyD7YrFuaawpdaFQeHIWG76HMXANsilAyiPWUdzc/o PqLvspYSXXjOSYjG8wkTf1aeFDxViX6iTi1MlnpVCW/NvrPxBI4S1yv+f523HgxflIYp 3KGvWMqRpZQzteZ+MK7pV1nXHaSfGRsiSAelqfK8amanAxuqq8FkJ5W8zeqaMCexXCoN D1qT/c08z76nJXovCao9iWP/Y/4zUsQvsLM1rcaLCDrJG7Oex2lEwNJW2DCv3EaccUBU hDpnYBS2GdQdaJJupJ8WIDz9lFVd1ziy0bLz7AyLje0V6Tyw6jgVxi+WUr5usXMt0+OY gyzA== 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=2DeLHkCdkTJ+4e3GbHng+dPGISVoyUr5Ar6TzppXNUk=; b=PtjZUAAc+KaaxLzLIV/6nFSjkRp2aLbmkM826xaOgLE2BxdYaZWBXPVDlphXUMKW3v w7cNEgVy6vELLCy/4ohMvQdsO6CNvtzH5ZBX8MSeIHZQMOeLvnp5J0g1zZayj+0Nzlsv +Pppgrx2yBaffkJtY1bHSnE8UkZg1EiCw3+11OkTeQVepjPKWm3rAWe+514zU1B+pxa4 GG3492uDc86VzhWvBCaRszMMWIOWbBMXU6vRwQGVuPwwpEC3oMBXSrxtULE2NpXyWzDJ U03Jlb6ml0YxzjgmTKmraLX+8iDX4arb2ohRg11W/WHpHBgPAISIXflDXEIFpBXfNn8N rHeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ER1gN5dV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020a05640235d100b0049e07ea3918si3242418edc.520.2023.01.15.09.09.09; Sun, 15 Jan 2023 09:09:33 -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=@kernel.org header.s=k20201202 header.b=ER1gN5dV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231552AbjAORHQ (ORCPT + 99 others); Sun, 15 Jan 2023 12:07:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231569AbjAORHA (ORCPT ); Sun, 15 Jan 2023 12:07:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F9D010A90; Sun, 15 Jan 2023 09:06:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E325360D58; Sun, 15 Jan 2023 17:06:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41C40C433EF; Sun, 15 Jan 2023 17:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673802411; bh=+crzPVi66jqHfKaNucFDjZ0PcQ/R8J1h/0R/3vs99TM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ER1gN5dVvBAlxtXU9pxQVLrJL0qLrAgzeM5h5kXJzIpLFiN57alMMvvYYv4bCzSKV /7N9J8NIKpYTa2GqaA37bXOvQgXrE/H30BnN/B7pwj5jbFSC+ahJeyx7H7Ve6SYczV /WvNzB6ElrG5WeKbgEhVzzI2GbaHp96DoXC/9AgTaBPjn4DneqRirl9MMgW9FpBM4/ qshX5Vex9vuAGoTGNvJQLCyQv/RWyWP8PsnJ3AIQwVDGHfBdhft60swAUN04EOXNpU 8ts+MOCUPLGFbnreCyhTAa7ZdRm9RJVd/rac1dWmjnaxp44gj/XH9/AHxb+qL1+2+E oxGGAlCSrn8qg== Date: Sun, 15 Jan 2023 09:06:50 -0800 From: "Darrick J. Wong" To: Matthew Wilcox Cc: Christoph Hellwig , Andreas Gruenbacher , Dave Chinner , 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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Sun, Jan 15, 2023 at 09:01:22AM -0800, Darrick J. Wong wrote: > On Tue, Jan 10, 2023 at 01:34:16PM +0000, Matthew Wilcox wrote: > > 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. > > Sorry, I'm not following this at all -- where in buffered-io.c does > anyone pass FGP_ENTRY? Andreas' code doesn't seem to introduce it > either...? Oh, never mind, I worked out that the conflict is between iomap not passing FGP_ENTRY and wanting a pointer or a negative errno; and someone who does FGP_ENTRY, in which case the xarray value can be confused for a negative errno. OFC now I wonder, can we simply say that the return value is "The found folio or NULL if you set FGP_ENTRY; or the found folio or a negative errno if you don't" ? --D > --D