From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154]) (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 A868033A70E for ; Mon, 13 Jul 2026 16:34:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.154 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783960461; cv=none; b=FdPU3XsoSfJQifbUkAQmmt2yJplL6fCt4sQc9bPx+FSdFQAAfJmDAK/cHpo5NPjuqc6ogwbD5dfA7PBzrnxtZeFKRjbYngN1vmy34csKG2HoLnLpaLhJBzwNtL6ntksSLFSqma5bTjyeflv8F5yA6qWhtTugG9DFrZyNswerktU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783960461; c=relaxed/simple; bh=U+ye8tA7+dXRP3O99TSPV2cVZwox/2X6yPtR7/ZeswA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=uMqNcktvcIc6vkenSqCK7HaXl3c+gSIw+D1g5T8R3f8qK+x4MghjtBsqtvSdBu0tPLWyRMWMH2TFbBOROep1wNhuKQUQFPGGhfkhwiEMp09E+n7qFTpzhV5CCY6T4wdV//OQjpzKOWlFQ2DtjG3fmfAdWCBqlnYLwQK+zg8AL8M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=iZYLrXGC; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=btfHyYl1; arc=none smtp.client-ip=103.168.172.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="iZYLrXGC"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="btfHyYl1" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id EAA1714000CC; Mon, 13 Jul 2026 12:34:18 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-05.internal (MEProxy); Mon, 13 Jul 2026 12:34:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1783960458; x=1784046858; bh=BCNlpzdSKM cnehBz14tiBB5AsBd2nBpg5h+TsCn6DPY=; b=iZYLrXGCWiWfQ7qnHV8vq/ZjzA iMj5IBmsiMZX7MTHFNRYu/Q8ghXNuhn59ijfP5do2kxJBFgc8w5gwepvo2I6Z19g D6vIYmlCa70myO7LOwKOsQGI3rvfBaulCYLBdbazZNDbCTHGNl42AhzqL1LY7Sh7 PDnefZeYiBSJYDMwWdhaj6EW4Rjxkr6FDvBs+qOsR2eDHb0GMH24eNsMtdIFcfij yrCx67ZztU7daqF4eoU3v1ydlMMrML4/ztJqfuSpTzPfCxAHb7xRLOqHbiSkm2EW EReeGQ2hkYEZaly++ExhgGAxA3xdnXoPz1ITsp2Pr1e1ZhUcGl551o3aOqug== 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:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1783960458; x=1784046858; bh=BCNlpzdSKMcnehBz14t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li6En+qn/X2zlQ X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Jul 2026 12:34:18 -0400 (EDT) From: Junio C Hamano To: Patrick Steinhardt Cc: git@vger.kernel.org Subject: Re: [PATCH v2 12/12] odb: make optimizations pluggable In-Reply-To: <20260713-b4-pks-odb-optimize-v2-12-9c2c3ee94b38@pks.im> (Patrick Steinhardt's message of "Mon, 13 Jul 2026 07:52:15 +0200") References: <20260713-b4-pks-odb-optimize-v2-0-9c2c3ee94b38@pks.im> <20260713-b4-pks-odb-optimize-v2-12-9c2c3ee94b38@pks.im> Date: Mon, 13 Jul 2026 09:34:17 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Patrick Steinhardt writes: > Move `odb_optimize()` and `odb_optimize_required()` from "builtin/gc.c" > into the "files" source and wire them up via newly introduced vtable > pointers for the object database sources. This makes the logic pluggable > and thus allows other backends to have their own, custom implementation. > > Signed-off-by: Patrick Steinhardt > --- > builtin/gc.c | 490 +---------------------------------------------------- > odb.c | 12 ++ > odb.h | 45 +++++ > odb/source-files.c | 470 ++++++++++++++++++++++++++++++++++++++++++++++++++ Reviewing this commit with "git show --color-moved" is an excellent way to verify that this is 90% pure code motion. Only minimal adjustments were required, such as replacing a direct reference to a struct member in the original with a variable that was previously assigned the equivalent value. For example, this original > - switch (opts->strategy) { > - case ODB_OPTIMIZE_INCREMENTAL: { > - int gc_auto_threshold = 6700; > - int gc_auto_pack_limit = 50; > - > - repo_config_get_int(odb->repo, "gc.auto", &gc_auto_threshold); > - repo_config_get_int(odb->repo, "gc.autopacklimit", &gc_auto_pack_limit); > - > - /* > - * Setting gc.auto to 0 or negative can disable the > - * automatic gc. > - */ turns into > + switch (opts->strategy) { > + case ODB_OPTIMIZE_INCREMENTAL: { > + int gc_auto_threshold = 6700; > + int gc_auto_pack_limit = 50; > + > + repo_config_get_int(repo, "gc.auto", &gc_auto_threshold); > + repo_config_get_int(repo, "gc.autopacklimit", &gc_auto_pack_limit); > + > + /* > + * Setting gc.auto to 0 or negative can disable the > + * automatic gc. > + */ And the change from odb->repo vs repo is such an adjustment. Looking good.