From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2FF0C38147 for ; Wed, 18 Jan 2023 14:25:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231288AbjAROZs (ORCPT ); Wed, 18 Jan 2023 09:25:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231295AbjAROZ2 (ORCPT ); Wed, 18 Jan 2023 09:25:28 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E923D8B303; Wed, 18 Jan 2023 06:09:41 -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=MFcR0OGBOZF6nFAA9jXYIyh+Hu0YfDAUMAAwjfRCkqc=; b=3SD7Vdt5AdW0YvzZzC12FMR9aL W9WO1g7u7H/F/QxKA94pPX4KgPaws20mnQRb9EWhS61g3sN+SkwoJNIApn55lUy+3+rwB1CfjS10z rUdZ4zwzUYCfdxtc36QlvXCRBE5ze8P3CniwiDeoU5yAFhtanBI30KfBwMSN1YGPtqlUAmO416saT tctAs+YVGlvg9RsOb/6dtOVKnuJPD+NXC+2sewv4aTXnZND9MFqgCwy2HHGlE4BNSn5rtJiOFakcJ ix7/T8E6dBA/F6hiLhPZcDu701pHd2DriNYKHCiWtW35N+VL5Jdwz1quemNt9yDeCbx6mzsc2PpBj DlBYgbjA==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI985-001HFU-3c; Wed, 18 Jan 2023 14:09:29 +0000 Date: Wed, 18 Jan 2023 06:09:29 -0800 From: Christoph Hellwig To: David Howells Cc: Christoph Hellwig , Al Viro , Jens Axboe , Jan Kara , Matthew Wilcox , Logan Gunthorpe , linux-block@vger.kernel.org, Christoph Hellwig , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 09/34] bio: Rename BIO_NO_PAGE_REF to BIO_PAGE_REFFED and invert the meaning Message-ID: References: <167391054631.2311931.7588488803802952158.stgit@warthog.procyon.org.uk> <167391047703.2311931.8115712773222260073.stgit@warthog.procyon.org.uk> <2673696.1674050454@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2673696.1674050454@warthog.procyon.org.uk> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed, Jan 18, 2023 at 02:00:54PM +0000, David Howells wrote: > Actually, should I make it so that the bottom two bits of bi_flags are a > four-state variable and make it such that bio_release_page() gives a warning > if the state is 0 - ie. unset? > > The states would then be, say: > > 0 WARN(), do no cleanup > 1 FOLL_GET > 2 FOLL_PUT > 3 do no cleanup > > This should help debug any places, such as iomap_dio_zero() that I just found, > that add pages with refs without calling iov_iter_extract_pages(). I don't really see a point. The fundamental use case of the bio itself isn't really to this at all. So we're stealing one, or in the future two bits mostly to optimize some direct I/O use cases. In fact I wonder if instead we should just drop this micro-optimization entirely an just add a member for the foll flags to the direct I/O container structures (struct blkdev_dio, strut iomap_dio, struct dio, or just on stack for __blkdev_direct_IO_simple and zonefs_file_dio_append) and pass that to bio_release_pages.