Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7960098rwl; Tue, 10 Jan 2023 07:27:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXtjT+YvbI5hFK9XvqAxgnmAgg53U64gw5QQqvne77BDurt5Eji/xKCWL/fpIrhgScp2PjPB X-Received: by 2002:a17:907:a50f:b0:7c0:d609:6f9b with SMTP id vr15-20020a170907a50f00b007c0d6096f9bmr64647380ejc.27.1673364421409; Tue, 10 Jan 2023 07:27:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673364421; cv=none; d=google.com; s=arc-20160816; b=c533UKls1OlKbkGd46HA3YwvxPDP6f4+vHMBwMVOVRAhTvzCKduuGQ3S+SJB3tlTqx oZ5y3ctZkItAUzWT6oWfiz76JZOfdOwLZt227yiz9bNIoo3uQVLV/6FklS0Pr8lremLL dNGmLFVPtWOBlXsVLdOC3DVScncmpac1hfggCeNWSuKOymARn+pqmYgA9CxwMHIzn1+d 6uKCppjJBVUnQfo4Q8PlNBFBfadzXum2uPrTXA01ldKXA+V0BL12T2KzpSkVrXpOHRnh jT5HbdOIJH3S2Qg2sUW6tsAMpJbBVsBMamMH5V5HBPoAddSHoVo+Fgt0Xef5sIGUXzq/ xvxg== 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=oNTdMR+VSzbfWekKWcdjtSu/K0LW9KTEw3USctOnxiU=; b=l4q7JZBx0Z1HGUKP28mVwsbFg9E5MHUNVRzjbz86tzAFPMscvbuukH7wZKOEJLqd2a yzjH9WwQJo9sHLjSHnp2CFqjv8AsFn2ePhm7STf/B4XHGIHENI0B9EYMkIJkqPSGVx0E NlWgGTispgsTu1EwqptSwOJAEsVQEo0h6mRqS9M2d/Z/QIJHaKQrimnnhbBa/ynUQsgS btAxKudDevEkQGh6vrynnjPiJ5Oc7FfDWDfVcCGXhK7uOrXzY37KaYk9vryNr5FjMuU0 64zdzfuioPPGaz1CRLb/GTs72Qzn74txJALfpjWEyNg7tije5cZPZMnNrMuiH2RW1808 TV+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=zDpFs6D6; 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 sa18-20020a1709076d1200b007ae4717bf08si13901263ejc.359.2023.01.10.07.26.33; Tue, 10 Jan 2023 07:27:01 -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=bombadil.20210309 header.b=zDpFs6D6; 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 S238218AbjAJPZT (ORCPT + 99 others); Tue, 10 Jan 2023 10:25:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238977AbjAJPYi (ORCPT ); Tue, 10 Jan 2023 10:24:38 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 281918D5C4; Tue, 10 Jan 2023 07:24:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=oNTdMR+VSzbfWekKWcdjtSu/K0LW9KTEw3USctOnxiU=; b=zDpFs6D6/Tjb+OJyb9xHVqz5ls pFBMbIHtHrX5PunG/rgPabqbdWsIp1KBDrf94nAwIf9VYD6FmA/1emyHb1r0sQyyYkWM/4hPMTuYH CjuTU2l4k73L7IxJXvEelJio32ymOa/d75HhexdbaH1Pm73qL+xhGiJHI9FGLfxoavkIFYh0jEdtH zdctHIHRZL2kUGScC6WtgGn7TciKAR23dSJH5DDLnVpfqgaSthQAGfeSBcaaTPNgZDREUasnqBkig kdHpEzl5txPM+j1xgPLyjr9/q0Y7/aL0jYStyfxdcapJzOIxqTOST0W0pqT6rhKzv6TlZxEw/VKXv 9aVLJvpQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFGUF-007Yt2-4o; Tue, 10 Jan 2023 15:24:27 +0000 Date: Tue, 10 Jan 2023 07:24:27 -0800 From: Christoph Hellwig To: Matthew Wilcox Cc: Christoph Hellwig , 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-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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 01:34:16PM +0000, Matthew Wilcox wrote: > > 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. So what would be an alternative way to tell the callers why no folio was found instead of trying to reverse engineer that? Return an errno and the folio by reference? The would work, but the calling conventions would be awful.