From patchwork Tue Nov 14 08:58:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13454969 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 E976C125DA for ; Tue, 14 Nov 2023 08:58:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="JrPVoORc"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="bp9giYb2" Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C70301AC for ; Tue, 14 Nov 2023 00:58:39 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 41D715C029D; Tue, 14 Nov 2023 03:58:39 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 14 Nov 2023 03:58:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm1; t=1699952319; x=1700038719; bh=efY8GQtlBOa7xRStw4apSt7XO vxZTUQyVrjFk7/CGeQ=; b=JrPVoORcmWJxeG8LOj+itzOiJe16qjJ0xNpGgv96B 5MT9/ybJ/Z0iYdAMd0WNEx9lLV/OVJPKOulXaNXpRz2Tqvok4fmEwiPKo2AvwrsV in68K1+ydv4dp0nv6rvRd4+zolcU9JuNrnzPYmc/bvyc7w6huPaVE9Qd5Yt7Y9Fq eRmC+ErAMjAAvsr8hobzkJY77XyMOZx6sFFAAFBQyB8wD6C43HQ1QiYTF1k6OVvr olY59BSscx1PFttY39aXQOzgHqu2Bt1qSJeAWtIyi0QB3puK9DDqXxmZQHk5bbbD /hNeQqv8NRtf3d7YUuFvzE35UpwSvuouAYBCVQlYnbNyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1699952319; x=1700038719; bh=efY8GQtlBOa7xRStw4apSt7XOvxZTUQyVrj Fk7/CGeQ=; b=bp9giYb22DUQTwctJKrPd5i4wWOcSPUaLvWtA9GXeu/fuVOaQCY Qp9LLZbnaFFwKQpWYfK89ju1seahvWmNtVtM0ROSQ1dhox3nq8GYJBdNf4jD8UfU yMX86edbm2TNyBT8ETNHPQmshtAsdVQY9NC2c7ivX+O4M0KjFTbyWE1ZinF/ZOYp yGQJBf5dT8Ccrf7+v5+7atvZNqghItVgaOlNUk/tLzYGRqwQiPnTtO1OPuhKcpbJ /hMxQjTQoytc7NB/39tFK/JDYoonx2lxRVItpfsEKH2zmDtcfKlE+W06mipnpKwM cUk82GzB8Nvm66tAQu9doPx2om9bhPccDIg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudefuddguddviecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfggtggusehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeeugfeutdeuieehteelveegudejkeejheeljeejhffhgffhvefgkeeukeejtdeijeen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Nov 2023 03:58:38 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 84e5d7e6 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 14 Nov 2023 08:57:58 +0000 (UTC) Date: Tue, 14 Nov 2023 09:58:34 +0100 From: Patrick Steinhardt To: git@vger.kernel.org Cc: David Turner , Han-Wen Nienhuys Subject: [PATCH 0/4] refs: remove virtual `delete_refs()` function Message-ID: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Hi, this patch series refactors the virtual `delete_refs()` function to instead be implemented generically via a single reference transaction. The main intent of this patch series is to reduce complexity that we have in the reference backends so that it becomes easier to implement new backends that have the same semantics as others. But at the same time, benchmarks show that the new generic code is even faster than the old backend-specific code. This is mostly because we avoid the overhead of per-reference transactions when deleting many references, but also because the transactional code in the files backend knows to avoid rewriting the packed-refs file in case it contains none of the refs that are to be deleted. So in the end we have less duplicate code in the files backend, make it easier to implement new backends, and have faster deletion of many refs in the files backend. Patrick Patrick Steinhardt (4): t5510: ensure that the packed-refs file needs locking refs/files: use transactions to delete references refs: deduplicate code to delete references refs: remove `delete_refs` callback from backends refs.c | 48 ++++++++++++++++++++++++++++++++++++++--- refs/debug.c | 15 ------------- refs/files-backend.c | 49 ------------------------------------------ refs/packed-backend.c | 50 ------------------------------------------- refs/refs-internal.h | 3 --- t/t5510-fetch.sh | 1 + 6 files changed, 46 insertions(+), 120 deletions(-) base-commit: e0939bec273052b1a8d69db4a3f7c87aaf83e220