From patchwork Sun Feb 25 02:38:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 205969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1406350dyb; Sat, 24 Feb 2024 18:41:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXrFL7TVsheJPdnmDz82wM7H6i7z/CjhmFz/CkWuKe5eIec8N9XP8SSRJqEx0R/DSX/fpXmQnkwVmBES3zf581CoHAEjg== X-Google-Smtp-Source: AGHT+IEZT8Y4aMqPQ1hGgxgls75xdcdvrQoGA/YjfemzGy19J8yQz4VqqlWGPquLxH6GibKfrBlD X-Received: by 2002:a17:902:8d85:b0:1db:fc18:2db9 with SMTP id v5-20020a1709028d8500b001dbfc182db9mr3356533plo.64.1708828872506; Sat, 24 Feb 2024 18:41:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708828872; cv=pass; d=google.com; s=arc-20160816; b=dLz61f+kMyVfU3k/Hy2DHnaUsQoh3qj1u2f05jN08+MNthF3gEWBcXHSa8sB+4tyuR wJ3o7wArbB4pCEEs7zGQwtho8UDU+1Q24s1yYDH3JD6s57ferNrv1udxmo+qN4uP5iva X2WMhnr/xr0etMYnHCP/p6MZQs1tv8Y5964o+OV+r8P2m4X37udxb4UJHf/UL7W9duip WKVYJ0YkRnjdwTrhg84OxDgTUl+ta6zGfEUzIXRbMvc2dCQtpA/1i+NqysGHa67ieMWe AY/UnxhavBEX7vPY5Q/2H5ygiMuE2nCpDgGeaJ/jIAXkeEDv4EGteXjiDKICAlj5Xv/N mZQw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sochMrpvNfdQFlEjZm/ljf2msW7UTBhTHpI35Xx9Jzs=; fh=cHCDtKbuQPXHd8MTSa2UUr5dC1B5BRlSqWWb9m+1Nbw=; b=WryRcB07s+Oev0ogN4NzvcPSLpb/ewBlRdRNX4GBs2G8D3gjBRn1v1cJBn8lAwJM+8 HcBcm9tZas1R7EQIReNcSKtXMJOJ9CjHdcpER6EObRfsot15ztLuZ+qf4sIrNOc8AVXr ZDp0by2YeM8fungPvFgzN8ekvuzDWNQQmoB4y/a8N04lDDr5/4N4f6ekZSIjalaELFUU 1/3cHdVK2LUcVSzM8126yGDxu49TCA9AVrNl4v0J/GAKTxc5B0ZGLnF/t2tDNv2eky62 xUY7jzrriz+FB3PJJqWQDXGIXFDUucZjoe6WjzHtCKInDQ5kew2WYkaxhWy9l8UJRFsg 4erg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=CHg59nt2; 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-79937-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79937-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b8-20020a170903228800b001d9859103e0si1586022plh.153.2024.02.24.18.41.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 18:41:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79937-ouuuleilei=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=CHg59nt2; 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-79937-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79937-ouuuleilei=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 DAAC1B20E11 for ; Sun, 25 Feb 2024 02:40:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D0F717551; Sun, 25 Feb 2024 02:38:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="CHg59nt2" Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (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 50AA5EEC6 for ; Sun, 25 Feb 2024 02:38:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708828726; cv=none; b=qmHV2z7ERKCqGCUnnRSioFbzab83i+m6QFOPcUHuwLttmkd8h67Q0wrSJNbUVM8ZcQadRK/Y+vf7bxI+Z4E+4C1x0PXv+gwInEUgrhnY58f1DdMyARH57vjOestvbrGemDlCWiNwysSuU+/wABBsT07CR/Bh1z14xHCo/ilHdaY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708828726; c=relaxed/simple; bh=u2DvZcMqKB6og8Lq7jawbKRlhTvu+07YR4ER+eXC/KI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VCHbipdlgS7elrLoTJ7ObypNXCz+xGuwy/dRxDmMt/+SMA+DPy+9dfDdU4pB0jrIu+RxwFlkwa+Ysil/R7umr+t3qJQcN8mDW7lnU89tXl30Z/8d5+YkpRBrvH9pn1mBJ+CjPWRbAciDvgdt4SbT8zi7qfk7rv24S1zcjZrNIro= 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=CHg59nt2; arc=none smtp.client-ip=95.215.58.189 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 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708828722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sochMrpvNfdQFlEjZm/ljf2msW7UTBhTHpI35Xx9Jzs=; b=CHg59nt2Qc17U0pd3Uar1bIzO02xmb907r29R+H1Ixq3v6WI/2XSZIJLjqKNjZ6nEm1rxD RhcM4nF1wtBLX7jXN0JoWApSoWtOFmwradLNdJ5wZqB+gnt8Bbs4UbGeDAU1nq6dOFNBYL gVrJR7dzjGlV4CQotVij2gybSgRaPH4= From: Kent Overstreet To: linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kent Overstreet , djwong@kernel.org, bfoster@redhat.com Subject: [PATCH 09/21] bcachefs: Kill writing old accounting to journal Date: Sat, 24 Feb 2024 21:38:11 -0500 Message-ID: <20240225023826.2413565-10-kent.overstreet@linux.dev> In-Reply-To: <20240225023826.2413565-1-kent.overstreet@linux.dev> References: <20240225023826.2413565-1-kent.overstreet@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791836943936433385 X-GMAIL-MSGID: 1791836943936433385 More ripping out of the old disk space accounting. Note that the new disk space accounting is incompatible with the old, and writing out old style disk space accounting with the new code is infeasible. This means upgrading and downgrading past this version requires regenerating accounting. Signed-off-by: Kent Overstreet --- fs/bcachefs/sb-clean.c | 45 ------------------------------------------ 1 file changed, 45 deletions(-) diff --git a/fs/bcachefs/sb-clean.c b/fs/bcachefs/sb-clean.c index a7f2cc774492..1af2785653f6 100644 --- a/fs/bcachefs/sb-clean.c +++ b/fs/bcachefs/sb-clean.c @@ -175,25 +175,6 @@ void bch2_journal_super_entries_add_common(struct bch_fs *c, struct jset_entry **end, u64 journal_seq) { - percpu_down_read(&c->mark_lock); - - if (!journal_seq) { - for (unsigned i = 0; i < ARRAY_SIZE(c->usage); i++) - bch2_fs_usage_acc_to_base(c, i); - } else { - bch2_fs_usage_acc_to_base(c, journal_seq & JOURNAL_BUF_MASK); - } - - { - struct jset_entry_usage *u = - container_of(jset_entry_init(end, sizeof(*u)), - struct jset_entry_usage, entry); - - u->entry.type = BCH_JSET_ENTRY_usage; - u->entry.btree_id = BCH_FS_USAGE_inodes; - u->v = cpu_to_le64(c->usage_base->b.nr_inodes); - } - { struct jset_entry_usage *u = container_of(jset_entry_init(end, sizeof(*u)), @@ -204,32 +185,6 @@ void bch2_journal_super_entries_add_common(struct bch_fs *c, u->v = cpu_to_le64(atomic64_read(&c->key_version)); } - for (unsigned i = 0; i < BCH_REPLICAS_MAX; i++) { - struct jset_entry_usage *u = - container_of(jset_entry_init(end, sizeof(*u)), - struct jset_entry_usage, entry); - - u->entry.type = BCH_JSET_ENTRY_usage; - u->entry.btree_id = BCH_FS_USAGE_reserved; - u->entry.level = i; - u->v = cpu_to_le64(c->usage_base->persistent_reserved[i]); - } - - for (unsigned i = 0; i < c->replicas.nr; i++) { - struct bch_replicas_entry_v1 *e = - cpu_replicas_entry(&c->replicas, i); - struct jset_entry_data_usage *u = - container_of(jset_entry_init(end, sizeof(*u) + e->nr_devs), - struct jset_entry_data_usage, entry); - - u->entry.type = BCH_JSET_ENTRY_data_usage; - u->v = cpu_to_le64(c->usage_base->replicas[i]); - unsafe_memcpy(&u->r, e, replicas_entry_bytes(e), - "embedded variable length struct"); - } - - percpu_up_read(&c->mark_lock); - for (unsigned i = 0; i < 2; i++) { struct jset_entry_clock *clock = container_of(jset_entry_init(end, sizeof(*clock)),