Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp50363rbe; Wed, 28 Feb 2024 11:41:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVHIPFUMDWWzqg9JRqx0IDiy5tt2CfVW2ER9aa25InfJMkW7zhtu00LN8rXxoPQnHnzeVHdVsMJg9KuGWpkj//AwGbbVGvEMFBJV6dXxw== X-Google-Smtp-Source: AGHT+IERjOlG+ql8kOVBKFiAdxQsAW9OAVn5xsqa1H6ZO9dVXbdx5FJ8fjO4tn7zi8WwyeWS/mL4 X-Received: by 2002:a17:906:3bd7:b0:a3f:6717:37ae with SMTP id v23-20020a1709063bd700b00a3f671737aemr424981ejf.69.1709149315485; Wed, 28 Feb 2024 11:41:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709149315; cv=pass; d=google.com; s=arc-20160816; b=pAsmPrd+S+ZKbObQJGIVqAtgBsDQOtoONjvNLIC8vHe2CgcCg+biEsKIzReoQX3ZT5 9i/g2mxB7TPees79MBvPslKFMSEhBULXOWWA/3nzQ8GbZ39qtXyX4+EvJMR120oREAi7 oIUqUI7vhtyKFw2qX23uet5SpHsiGFdu9Rv1j44DT4F5rmIFErFAue+ogdM9U2PsxrTb 66tfgL+RrWsz1kwm5Tm5lTIq85F7ps5uTJMgcHSj0ZDT1sGpTVNIEmZTijs04p07IXIU KRvLtPwWtLslPQ2ME0jhrR5XsUVpBWCA3MEv3T9piI/js7Wr0HQv96aFCO7YJn2aeHT2 VQNA== 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=KxjyznzsUQpuSnVHC/hJK3IlSwcsWUORbF0nzzW2cZA=; fh=5tMfbpRQnLy0yRnT9uUsTcCBVP0N63CI2Z3z1/k8g1M=; b=PEttjjFsWn/HUBv1YCRquOfvmLcijwHm9+8gR4lSmZNsO3qu3hpkS3/MRi78M5tYDp 7VyE9vrx30ffXws2SE9fqgnw3MWMZrozo9utNv07aDUVP//SlKn56eP8fyQ2edaidLFy F4KLjfPP0OY/fvsACLdNjsn9/pRugEP5A16U6lhoStc5psk0amdv5WzQ3LXNRAr2nO/F 3lHp5UujE3qjJ2IDmEwNadwJw9heFXYpygCFYOnirfxAz1vPtRlYeQNTvDjWO419B8dW V4eZV+iAZSqUBDekXCkmVjhyUD0NqKwxMf8j7L6l1q5KQRhQJ98JrK9iOS2ayPanuT4b aArg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=CwteKCrm; 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-85630-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85630-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a15-20020a170906468f00b00a42eb04e692si1948574ejr.80.2024.02.28.11.41.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 11:41:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85630-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=CwteKCrm; 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-85630-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85630-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1AE1D1F21DD4 for ; Wed, 28 Feb 2024 19:41:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 159096FD06; Wed, 28 Feb 2024 19:39:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="CwteKCrm" Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) (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 5BCFF6FCFC for ; Wed, 28 Feb 2024 19:39:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709149185; cv=none; b=SaDO+jQr/dtqkl/FQUK28FZoFhQCLtR04pYlF4e+ll1uM73OnRKefjCtpXKyqJiP0wvv/A82fSKMvdcZIWLJgvtVQXymvH12gZ9ksGkw2tg0+2tT5nabdfg1MdhLX2wpVJLLhgeDH1Mcpc8dIdhF/EFS9j5D1wkX3tVT6n6Tj7g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709149185; c=relaxed/simple; bh=K6BFDpHPwpmKaTZ0wDrBzeFVCZ2JiaeGyq0H8B2Yl3g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hCrtAoSsqUTDHlLPJQF1jLX920ECwP9i0z/ptypRY7Q/PFig6jwzhQHFwTi2wpzxH1m/le/ec63zcNM+vNeuPfSEO70dlzO0aFJnZUT4Tguuz29wX75+BAND9yKM31ItNbQMS6dHkR9U6i8seh1p0glU2GCFad1n219Q5t9uVfY= 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=CwteKCrm; arc=none smtp.client-ip=95.215.58.177 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: Wed, 28 Feb 2024 14:39:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1709149181; 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=KxjyznzsUQpuSnVHC/hJK3IlSwcsWUORbF0nzzW2cZA=; b=CwteKCrmj5APkGH5f4E4W4Lqat6v4lYSpC15zG9mOOlbEEvVeXbTRKJmt7zESTRiDBcGEy nA8Rp6Gp/kkr8RQOODcjmspH6JAkhatBzHRXuiFEnkui5m3m/8hp3MgX5mTBcHoC4jmi4p syp+45pcMlmc8zCU0bZY//h/oA71N78= 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 01/21] bcachefs: KEY_TYPE_accounting Message-ID: References: <20240225023826.2413565-1-kent.overstreet@linux.dev> <20240225023826.2413565-2-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 Tue, Feb 27, 2024 at 10:49:19AM -0500, Brian Foster wrote: > On Sat, Feb 24, 2024 at 09:38:03PM -0500, Kent Overstreet wrote: > > New key type for the disk space accounting rewrite. > > > > - Holds a variable sized array of u64s (may be more than one for > > accounting e.g. compressed and uncompressed size, or buckets and > > sectors for a given data type) > > > > - Updates are deltas, not new versions of the key: this means updates > > to accounting can happen via the btree write buffer, which we'll be > > teaching to accumulate deltas. > > > > Signed-off-by: Kent Overstreet > > --- > > fs/bcachefs/Makefile | 3 +- > > fs/bcachefs/bcachefs.h | 1 + > > fs/bcachefs/bcachefs_format.h | 80 +++------------ > > fs/bcachefs/bkey_methods.c | 1 + > > fs/bcachefs/disk_accounting.c | 70 ++++++++++++++ > > fs/bcachefs/disk_accounting.h | 52 ++++++++++ > > fs/bcachefs/disk_accounting_format.h | 139 +++++++++++++++++++++++++++ > > fs/bcachefs/replicas_format.h | 21 ++++ > > fs/bcachefs/sb-downgrade.c | 12 ++- > > fs/bcachefs/sb-errors_types.h | 3 +- > > 10 files changed, 311 insertions(+), 71 deletions(-) > > create mode 100644 fs/bcachefs/disk_accounting.c > > create mode 100644 fs/bcachefs/disk_accounting.h > > create mode 100644 fs/bcachefs/disk_accounting_format.h > > create mode 100644 fs/bcachefs/replicas_format.h > > > ... > > diff --git a/fs/bcachefs/disk_accounting_format.h b/fs/bcachefs/disk_accounting_format.h > > new file mode 100644 > > index 000000000000..e06a42f0d578 > > --- /dev/null > > +++ b/fs/bcachefs/disk_accounting_format.h > > @@ -0,0 +1,139 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +#ifndef _BCACHEFS_DISK_ACCOUNTING_FORMAT_H > > +#define _BCACHEFS_DISK_ACCOUNTING_FORMAT_H > > + > > +#include "replicas_format.h" > > + > > +/* > > + * Disk accounting - KEY_TYPE_accounting - on disk format: > > + * > > + * Here, the key has considerably more structure than a typical key (bpos); an > > + * accounting key is 'struct disk_accounting_key', which is a union of bpos. > > + * > > First impression.. I'm a little confused why the key type is a union of > bpos. I'm possibly missing something fundamental/obvious, but could you > elaborate more on why that is here? How's this? * More specifically: a key is just a muliword integer (where word endianness * matches native byte order), so we're treating bpos as an opaque 20 byte * integer and mapping bch_accounting_key to that.