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 73D29C7EE22 for ; Mon, 15 May 2023 09:25:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229492AbjEOJZi (ORCPT ); Mon, 15 May 2023 05:25:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240033AbjEOJZP (ORCPT ); Mon, 15 May 2023 05:25:15 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B224A2118 for ; Mon, 15 May 2023 02:23:19 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 7EA7668C4E; Mon, 15 May 2023 11:22:55 +0200 (CEST) Date: Mon, 15 May 2023 11:22:54 +0200 From: Christoph Hellwig To: David Sterba Cc: Christoph Hellwig , Chris Mason , Josef Bacik , David Sterba , "open list:BTRFS FILE SYSTEM" , naohiro.aota@wdc.com Subject: Re: [PATCH 3/3] btrfs: don't hold an extra reference for redirtied buffers Message-ID: <20230515092254.GA21580@lst.de> References: <20230508145839.43725-1-hch@lst.de> <20230508145839.43725-4-hch@lst.de> <20230509225737.GK32559@twin.jikos.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230509225737.GK32559@twin.jikos.cz> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Wed, May 10, 2023 at 12:57:37AM +0200, David Sterba wrote: > On Mon, May 08, 2023 at 07:58:39AM -0700, Christoph Hellwig wrote: > > When btrfs_redirty_list_add redirties a buffer, it also acquires > > an extra reference that is released on transaction commit. But > > this is not required as buffers that are dirty or under writeback > > are never freed (look for calls to extent_buffer_under_io())). > > > > Remove the extra reference and the infrastructure used to drop it > > again. > > I vaguely remember that the redirty list was need for zoned to avoid > some write pattern that disrupts the ordering, added in d3575156f662 > ("btrfs: zoned: redirty released extent buffers"). So the redirting itself is needed for that - without it buffers where the dirty bit wasn't ever set would never get written, leading to a write outside of the zone pointer. But the extra reference can't influece the write pattern, as we don't make writeback descriptions based of it. > I'd appreciate more eyes on this patch, with the indirections and > writeback involved it's not clear to me that we don't need the list at > all. My suspicision is that Aoto-san wanted the extra safety of the extra reference because he didn't want to trust or hadn't noticed the extent_buffer_under_io() magic. Auto-san, can you confirm or deny? :)