Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp133510lqc; Thu, 29 Feb 2024 12:28:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV7WLwi8isyUjzVsYAtNvu3kTetM416sp/WWVafDIYb5wVHh2RFPo2zvo1/qmBusgo/4D+LwnZB8Xmzc6ZZm4sGAGQvAAFnKUUm12a/3Q== X-Google-Smtp-Source: AGHT+IEkj9c6hWBz6EETQFrI33lW1dr9au0yD7DgvohQLKkfYfR1yvCNNi2e+Ox0sQVdJPpOne/0 X-Received: by 2002:a17:903:984:b0:1db:a6b9:a311 with SMTP id mb4-20020a170903098400b001dba6b9a311mr3597551plb.41.1709238498160; Thu, 29 Feb 2024 12:28:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709238498; cv=pass; d=google.com; s=arc-20160816; b=n3/33CzMAKOVrQTm9mg3S7yLWUt8UdyDqAUXPFgevMaMp/GrVHfNUL2lDlEiL0gEaf btekb76A8LWhQNzv9CGvGdq388jcNoevv3D/j7wOAmAb7Tq13y7t3iT6e1jpUYc2foiL bvhpJwOJqY6q+Xkd4/Lnk6spD3BOCkxSz+nwdHNiruk+QfeTjSNJbtjzVADAKEKUJf+w fta3rPQBNJ+WAhC62l5Y3UnLAWsJZhl9xxg7vMFVZ3ZXfA1OQJTrdbdDyqDDFdGO0E/O I3IVCmu6mZgwwXER46+tEc+0GQtlZLF11SQ0yg64eIx5Es7uvAdBcm9wfnSlYAvWwcyA exHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=+453tVue0xWveQK5kV4RnPNnaZF9ETikWnY7ZZ7joUc=; fh=5tMfbpRQnLy0yRnT9uUsTcCBVP0N63CI2Z3z1/k8g1M=; b=bRyH96xOfl4gCSLL70F4AlFZIY1EZqotwLueZIu2L/zmHMKSxTBGC4E7N1GTdcas+o XOq/xmoE51KPdilOi4vjZ85QUAkLsJDpHFFJI88gzYBivtfj32FlNnZJWrjx2HyoMloQ 9C+Q9c6EHZ1eKvgeCGW5FPT+RZK9XU/j7ERC2bgNy00FzDB+IZa40J7P5u4Yg9l6eFVW 7gsThjOzPLQ3LxomyMaJcPUIKfvTgp2Misv1h3XCTpomT5hvetgNzAsZqlOgTXQ3Bbiv zNc9BqZSehGgupPMgkPBgG7YV64O98PunNSz+Y34+lNwZwPjcw8C1+MqM29KM7qczgqe MXeg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="Dhk/ug2F"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-87418-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87418-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q12-20020a170902dacc00b001dc8df92f1dsi969483plx.234.2024.02.29.12.28.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 12:28:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87418-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="Dhk/ug2F"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-87418-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87418-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 47F91B21A14 for ; Thu, 29 Feb 2024 20:25:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A521E13F444; Thu, 29 Feb 2024 20:25:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Dhk/ug2F" Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D3EE13C9FE for ; Thu, 29 Feb 2024 20:25:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709238319; cv=none; b=G3DjUSYUZhKrRKIAIUu39Q8/6sfqOA+AFTMFizXVUChBmq74O8eN5g3u9o3KyO7NMXMUhczuMLqmZj9AZw8gQb5K6n7eV17rCZllHwr5+SIlA+YocOh+zNezWEphC2/bD1xz/nOMpUOd2L/w+38JTXIEmLzkcG9SqkgU82otAak= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709238319; c=relaxed/simple; bh=JmJLqZXg2XBcwRLDNgn4Qm6j6l3aubXPxd1y1pXYKP0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=C7yiKJKLENemNO/mjEXedb88UTtb7HBoNqdL4/MV/qFRjiPTrCjc6sBjyvMRHcMCaMdFAL+8yAR2I6Lctl6G79WVCzOkYrUDYn9pT+SSFo1oI2bK6eEM4GodDLD5jr+WR+FWW5/S+6IxIJ9pVQO0hKfx1U4J5s3xnJV1NUXGFgc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Dhk/ug2F; arc=none smtp.client-ip=95.215.58.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Thu, 29 Feb 2024 15:25:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1709238311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+453tVue0xWveQK5kV4RnPNnaZF9ETikWnY7ZZ7joUc=; b=Dhk/ug2FNZqN03a1ikbKvhmMfxNyQrsAFWcn6K1zPF488zvdBX3ieEYYDQvcRCdfZpgM52 VGcByrRqe/Ss+lKjIxkJiNFckfnjIVCL1sUufLu6LS54/jxYsV9l7i7NwxPf0xRWl8j9qv mCyf3luA+JrNy+/2KydNXiK4YhiculI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Brian Foster Cc: linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org, djwong@kernel.org Subject: Re: [PATCH 03/21] bcachefs: btree write buffer knows how to accumulate bch_accounting keys Message-ID: References: <20240225023826.2413565-1-kent.overstreet@linux.dev> <20240225023826.2413565-4-kent.overstreet@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Thu, Feb 29, 2024 at 01:44:07PM -0500, Brian Foster wrote: > On Wed, Feb 28, 2024 at 05:42:39PM -0500, Kent Overstreet wrote: > > Shouldn't be any actual risk. It's just new accounting updates that the > > write buffer can't flush, and those are only going to be generated by > > interior btree node updates as journal replay has to split/rewrite nodes > > to make room for its updates. > > > > And for those new acounting updates, updates to the same counters get > > accumulated as they're flushed from the journal to the write buffer - > > see the patch for eytzingcer tree accumulated. So we could only overflow > > if the number of distinct counters touched somehow was very large. > > > > And the number of distinct counters will be growing significantly, but > > the new counters will all be for user data, not metadata. > > > > (Except: that reminds me, we do want to add per-btree counters, so users > > can see "I have x amount of extents, x amount of dirents, etc.). > > > > Heh, Ok. This all does sound a little open ended to me. Maybe the better > question is: suppose this hypothetically does happen after adding a > bunch of new counters, what would the expected side effect be in the > recovery scenario where the write buffer can't be flushed? The btree write buffer buf is allowed to grow - we try to keep it bounded in normal operation, but that's one of the ways we deal with the unpredictability of the amount of write buffer keys in the journal. So it'll grow until that kvrealloc fails. It won't show up as a deadlock, it'll show up as an allocation failure; and for that to mappen, that would mean the number of accounting keys being update - not the number of accounting updates, just the number of distinct keys being updated - is no longer fitting in the write buffer.