Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1268053rdg; Fri, 11 Aug 2023 16:03:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYT+gr+NgeyHG9uBx6b6lnWd/3dOrFoe3LsK0tLIxEMT6OPfOndJ9PKnp+buNaz2+9vzQ4 X-Received: by 2002:a05:6a20:1042:b0:134:2fd0:73d6 with SMTP id gt2-20020a056a20104200b001342fd073d6mr2987356pzc.31.1691795015262; Fri, 11 Aug 2023 16:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691795015; cv=none; d=google.com; s=arc-20160816; b=lB8wwJ8XszBXHeRFcBoF71ndZuQgYhRQ3JmFVpGftiHT+L5UlD0AlIuT+83AdyYcm5 tvJ9mPVRadwX0AFrRG/Al5x/GHQumkJWV3bHC6DhX7VQfUW+cj9auFfuCy5zmVS428Ns oDtgkZE3WgBbq2M268d3ZFNrGSpy9AVAk5CsCO7Zutft+jmPmruV2u+vrPQyNSvDD4XX M9DoTT1gzJNO0deIhf115mlY7ncp+jD9IKDJvWd+dw/mqUl4BSEwDUZY7f3TO3YOynCD kzcnlnqWPiWLCkhG1uxtmYuHo8/rpKVCubRdh1MWizp+rtekeXi/l91xNtun/yB7JaZa ejdQ== 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=Qz8RkCtSlpaaUMi8A3ozONo+enteZ/MCCgTe2bIRlP8=; fh=m4ZHAsZ2OHc5SJ4aQFFQo/VJ465+W941nLnMVoYIVaA=; b=RqW2dtw1/bl4sVcdfyqXQGYs4We2YoaTnizlksRr1po0aCoh0BUJzaHLeeExHxKMwD gVNiq5+3kJBtJwnoY3iHxA1xXr0qcnU373gaQxgTff4MWlS1/yvzDLOHKaCZu+Z1D6FZ tuTtpTdJSz42BExfp2LTIsxJWIwInuofa1LH1PkFHF/3gcCTUGsdTKdRtmdlf72C1y98 5wewgagL2aKG6szMmZNwFFchtSfqA7CbTZ4PQ/sUHa3Z6c8xCb4mACXa0uU2lN9f02JM 8py/Uli4ZVeFrCjMZtd5IwNTdGxPi+QcJRcTrRyYSEAVMiAmajqueB9LhHmWADnd7J7H 9CtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PlDrCP07; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 r2-20020a63fc42000000b005651147ebfdsi4020331pgk.127.2023.08.11.16.03.23; Fri, 11 Aug 2023 16:03:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=PlDrCP07; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S236686AbjHKW4h (ORCPT + 99 others); Fri, 11 Aug 2023 18:56:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230077AbjHKW4g (ORCPT ); Fri, 11 Aug 2023 18:56:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8DF31AE; Fri, 11 Aug 2023 15:56:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 665F864B3B; Fri, 11 Aug 2023 22:56:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDA2BC433C7; Fri, 11 Aug 2023 22:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691794594; bh=HCyq8KPMZZAZvmj1NbTZghVcsieOP3UsAupGoKw9OWk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PlDrCP07xWdo3qHM9CsIU1NEFu5DkbItFwpr4DoEPBOHwfNJcm0B4oNgRTsjRqs+s X6/yrWz5EL+2d5AM3VE/5XuYmjY9I44s4bI2MdUrx4NvgsPpEbjoZRDtFVLfCwGHv7 qsoxuhAtgWMfdD8bRMEZ8ymf081+Ai5DoFjjyvB8hJrcGS1kki9uosJmZQQbbflo0S vMJHkyBigpMa00gY2EpfMD5jGubVHNNpV+DPXKSuHao1QTuvkC7jXGw/w+3N07buk7 F+nN77aS+9hmNubgPxmPn7WDbHFOPCmSR0StEteS1ApY/Ry5h/NKjFzeRd7uHrVE49 J+wTBxzi/X9mQ== Date: Fri, 11 Aug 2023 15:56:34 -0700 From: "Darrick J. Wong" To: Kent Overstreet Cc: Christian Brauner , Linus Torvalds , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-bcachefs@vger.kernel.org, dchinner@redhat.com, sandeen@redhat.com, willy@infradead.org, josef@toxicpanda.com, tytso@mit.edu, bfoster@redhat.com, jack@suse.cz, andreas.gruenbacher@gmail.com, peterz@infradead.org, akpm@linux-foundation.org, dhowells@redhat.com, snitzer@kernel.org, axboe@kernel.dk Subject: Re: [GIT PULL] bcachefs Message-ID: <20230811225634.GI11336@frogsfrogsfrogs> References: <20230626214656.hcp4puionmtoloat@moria.home.lan> <20230706155602.mnhsylo3pnief2of@moria.home.lan> <20230712025459.dbzcjtkb4zem4pdn@moria.home.lan> <20230810155453.6xz2k7f632jypqyz@moria.home.lan> <20230811-neigt-baufinanzierung-4c9521b036c6@brauner> <20230811132141.qxppoculzs5amawn@moria.home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230811132141.qxppoculzs5amawn@moria.home.lan> 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-kernel@vger.kernel.org On Fri, Aug 11, 2023 at 09:21:41AM -0400, Kent Overstreet wrote: > On Fri, Aug 11, 2023 at 12:54:42PM +0200, Christian Brauner wrote: > > > I don't want to do that to Christian either, I think highly of the work > > > he's been doing and I don't want to be adding to his frustration. So I > > > apologize for loosing my cool earlier; a lot of that was frustration > > > from other threads spilling over. > > > > > > But: if he's going to be raising objections, I need to know what his > > > concerns are if we're going to get anywhere. Raising objections without > > > saying what the concerns are shuts down discussion; I don't think it's > > > unreasonable to ask people not to do that, and to try and stay focused > > > on the code. > > > > The technical aspects were made clear off-list and I believe multiple > > times on-list by now. Any VFS and block related patches are to be > > reviewed and accepted before bcachefs gets merged. > > Here's the one VFS patch in the series - could we at least get an ack > for this? It's a new helper, just breaks the existing d_tmpfile() up > into two functions - I hope we can at least agree that this patch > shouldn't be controversial? > > -->-- > Subject: [PATCH] fs: factor out d_mark_tmpfile() > > New helper for bcachefs - bcachefs doesn't want the > inode_dec_link_count() call that d_tmpfile does, it handles i_nlink on > its own atomically with other btree updates > > Signed-off-by: Kent Overstreet > Cc: Alexander Viro > Cc: Christian Brauner > Cc: linux-fsdevel@vger.kernel.org Yes, we can finally clean up this braindamage in xfs_generic_create: if (tmpfile) { /* * The VFS requires that any inode fed to d_tmpfile must * have nlink == 1 so that it can decrement the nlink in * d_tmpfile. However, we created the temp file with * nlink == 0 because we're not allowed to put an inode * with nlink > 0 on the unlinked list. Therefore we * have to set nlink to 1 so that d_tmpfile can * immediately set it back to zero. */ set_nlink(inode, 1); d_tmpfile(tmpfile, inode); } Reviewed-by: Darrick J. Wong --D > > diff --git a/fs/dcache.c b/fs/dcache.c > index 52e6d5fdab..dbdafa2617 100644 > --- a/fs/dcache.c > +++ b/fs/dcache.c > @@ -3249,11 +3249,10 @@ void d_genocide(struct dentry *parent) > > EXPORT_SYMBOL(d_genocide); > > -void d_tmpfile(struct file *file, struct inode *inode) > +void d_mark_tmpfile(struct file *file, struct inode *inode) > { > struct dentry *dentry = file->f_path.dentry; > > - inode_dec_link_count(inode); > BUG_ON(dentry->d_name.name != dentry->d_iname || > !hlist_unhashed(&dentry->d_u.d_alias) || > !d_unlinked(dentry)); > @@ -3263,6 +3262,15 @@ void d_tmpfile(struct file *file, struct inode *inode) > (unsigned long long)inode->i_ino); > spin_unlock(&dentry->d_lock); > spin_unlock(&dentry->d_parent->d_lock); > +} > +EXPORT_SYMBOL(d_mark_tmpfile); > + > +void d_tmpfile(struct file *file, struct inode *inode) > +{ > + struct dentry *dentry = file->f_path.dentry; > + > + inode_dec_link_count(inode); > + d_mark_tmpfile(file, inode); > d_instantiate(dentry, inode); > } > EXPORT_SYMBOL(d_tmpfile); > diff --git a/include/linux/dcache.h b/include/linux/dcache.h > index 6b351e009f..3da2f0545d 100644 > --- a/include/linux/dcache.h > +++ b/include/linux/dcache.h > @@ -251,6 +251,7 @@ extern struct dentry * d_make_root(struct inode *); > /* - the ramfs-type tree */ > extern void d_genocide(struct dentry *); > > +extern void d_mark_tmpfile(struct file *, struct inode *); > extern void d_tmpfile(struct file *, struct inode *); > > extern struct dentry *d_find_alias(struct inode *);