🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #1866

Re: [PATCH v2 4/4] tmp-objdir: merge loose object index when migrating tmpdir

#1866
From: Justin Tobler
Date: Thu, 29 Oct 2026 21:20
38 lines
11874 bytes
On 26/10/29 09:05AM, Patrick Steinhardt wrote:
> On Wed, Oct 28, 2026 at 07:24:13PM -0500, Justin Tobler wrote:
> > +	if (loose_object_map_read(repo, dst, map, NULL) < 0) {
> > +		ret = error(_("unable to read loose object index %s"), dst);
> > +		goto out;
> > +	}
> > +
> > +	if (loose_object_map_read(repo, src, map, NULL) < 0) {
> > +		ret = error(_("unable to read loose object index %s"), src);
> > +		goto out;
> > +	}
> 
> It makes sense that we read `dst` under the lock so that we don't risk
> losing data that a concurrent process writes into it. But to minimize
> the critical section, can't we move `src` out of it and read it before
> we lock?

Ya good point. The src file can be read prior to acquiring the lock.
Will update.

> > diff --git a/loose.h b/loose.h
> > index ed663ac550..35b46f4be5 100644
> > --- a/loose.h
> > +++ b/loose.h
> > @@ -23,5 +23,7 @@ int repo_add_loose_object_map(struct odb_source_loose *loose,
> >  			      const struct object_id *compat_oid);
> >  int repo_read_loose_object_map(struct repository *repo);
> >  int repo_write_loose_object_map(struct repository *repo);
> > +int loose_object_idx_merge(struct repository *repo, const char *src,
> > +			   const char *dst);
> 
> Do we maybe want to add a comment to this new function?

Will do!

Thanks,
-Justin
Technical Details
Message-ID: <auO4Photxmne1R5Z@denethor>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73821-linux-kernel-git=dewy.ru
References: <20261022234007.3081825-1-jltobler@gmail.com> <20261029002413.3291184-1-jltobler@gmail.com> <20261029002413.3291184-5-jltobler@gmail.com> <auL-ZBontaECu8vo@pks.im>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73821-linux-kernel-git=dewy.ru
From: jltobler@gmail.com (Justin Tobler)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v2 4/4] tmp-objdir: merge loose object index when
 migrating tmpdir
Date: Thu, 29 Oct 2026 16:20:35 -0500
Organization: Usenet Network
Message-ID: <auO4Photxmne1R5Z@denethor>
References: <20261022234007.3081825-1-jltobler@gmail.com>
 <20261029002413.3291184-1-jltobler@gmail.com>
 <20261029002413.3291184-5-jltobler@gmail.com>
 <auL-ZBontaECu8vo@pks.im>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="2102366"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:WRHEyY5TeF4OgWUnkARKg+alRwU= sha256:WwksFC4nrBpyrixxUGst6duW1zmTUl2dK3Otz69CFlE=
	sha1:jj+8V9fO/uP+RHY1Z11aUsnn4v4= sha256:3hY7AWxutucsIer9svrVHNtzqwxIdvHUaLRInXl6Bk0=
Content-Disposition: inline
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id B413A125C79; Fri, 30 Oct 2026 00:20:57 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.148
X-Spam-Status: No, score=-3.148 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id UMt_EEvGR4Ck;
	Fri, 30 Oct 2026 00:20:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=git+bounces-73821-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id D9A62125C6E; Fri, 30 Oct 2026 00:20:44 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 304316015C0; Thu, 29 Oct 2026 21:20:42 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793308839;
	b=tk2RVutTWfr/8XxmNG0eoqkOxYlAeKAgPs+74oQnC4U69tkzTGlXZQt5q7xNdBH5DlOi
	 cBNNB5PhAxsVghSX+gJCM/ug/F1KdvjZ6ohHxe4mxvEiX7X0Iuv4g3zjpJMAd6Oheuege
	 dsGxDoV5/b79owkHsCTooe4AZsGxWZkzExx8berwSKOObaXYk2tlo/GLi933OGFA3JWng
	 HRXVAzBfNQL+0y+rqhfu6+GZbrWdzEoLLzanqR/ck3bzE/NV8ycKnphrOmCWNH6M7Uh1a
	 zNFsla2Foiq8ecghDrXgh6L/0iA6oNqrLCtp9SG4ITsvO4asjEwenk5Zz1lGfc9ZDqg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793308839;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Date:From:To:Cc:Subject:Message-ID:References:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To;
	bh=RZlVVghsARSJ3budySc9Tk3exls/qVV9TTbgx3rntEE=;
	b=RCIhVcrjbDJrEogyUhHdfijeofMBA0UxjnXK2YISWZno70ZLtECDx3jktRxezmbOoZ/K
	 YeLTbP8y8DPmDESBOhMaDGmu+SsvZtj7j7ILYAWjSh/sfwQlEJkFjZH0LGykiYO7U791K
	 pD0YKNlpKoF9DAq5iUBB3VWPSW//KgBWqoyvrAzYVfH7IpovajzB8+marTboQUbhJl2aD
	 I5UWJ5lSX4qf3DJXx2AdrPzM9IqcpyIv4stIvPN/X/+mdiWj/AMRbTlBsNTs5bSGreCrj
	 rjbCEvPQn+/zDHmwjQcqgTBB+MNwRsnkZ9XWnlx3SPWY1q19RwPPjuFS4gGa3XJCrIg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=mdD5EGzW;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 26604606A335;
	Thu, 29 Oct 2026 21:20:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=mdD5EGzW
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.52
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793308838;
	b=Cm18u1Adck1XiXfyjm1W35YKW5xinmszmp1pTCHUwdzFBu1NLRMa9OJN92B17EYmY7rV
	 qWkKKn2ZhAoOH/bTE5trqZx4cTe1JnfCALbe8vjh29YUb4I0FYKMLPfiEAyGMwT2Is1ZU
	 qehuwpFFZwgwwD7XCpHDfCje+234OCqD+ZTmAL/eKM6GjyzOveTjProup6IxISSpZUxkA
	 WtUqoeBBw/lpYHK241at42rnSCyR29vIOJhmJtJWRk6r9KzIRqNfyIinSbUoegvYb6MM8
	 rQY+GZVCQmyS46Q6kPnviL0siwLM013qUZGvbrzNHy+k1F+E1YhvbRPMO5Xp6hXhHJw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793308838;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Date:From:To:Cc:
	 Subject:Message-ID:References:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To;
	bh=RZlVVghsARSJ3budySc9Tk3exls/qVV9TTbgx3rntEE=;
	b=cioTwnVVW6OCjdMj9/22Jz9M3ak2tjWLdlz0AihlWnbmBWAMHwG4+3Hs7IPhSeRQJvns
	 V7B/A3DLtfd78WglClqHR/43pGdT3rgoJsdaS9jDNgsxJHs/4SLyA+NYZ6ZfUo4tBZhf8
	 bG8QP1RYvpC8sbHJ7SvQXjAQcrchzt6yFwgg1qYVSZo+SKTiQzDaIlKJCpjevEKDvtFry
	 GOrGE1GeNV0wsIM4SwqX4aJ3wuGZEXm67l+sqjUYhbgIeDFnp3Clt7UIQH5kBAYJaJXdN
	 vhnpernDjVdynYYG/hCwNBjWBQo1CtXCJdgi4klASm/k45pPzDSC8Yc1rU3VE0Xn8Ww==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=mdD5EGzW;
	arc=none smtp.remote-ip=209.85.210.52
X-Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id F062D606A324
	for <git@vger.kernel.org>; Thu, 29 Oct 2026 21:20:37 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F062D606A324
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-84a248254f4so89288a34.0
        for <git@vger.kernel.org>; Thu, 29 Oct 2026 14:20:37 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793308837; x=1793913637; darn=vger.kernel.org;
        h=in-reply-to:content-disposition:content-type:mime-version
         :references:message-id:subject:cc:to:from:date:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=RZlVVghsARSJ3budySc9Tk3exls/qVV9TTbgx3rntEE=;
        b=mdD5EGzWl7uPFya1mD+x9g8C+wqBoX3j7jZgGhofGO3Ht9E09BKXnCgHzdyQU705pB
         xZZ457AUmHvmgto7PWEID0XRJtxm6bnjgRaF0kJI1/jNQbBz3U2V5BWmwu4yg5KofdGE
         kWowQdsVcwchxjQpv94ZIO5b4iDIRoZLTWdOlXPKsY2vzrRmN13ZPgMoZKaKEkyuL/y2
         KjSlYpY31L11mj0W5bRcbDS/IK3Jo8XS2pmKgYhxEItkeYatHFQl01qMeChGoB8fUx9V
         +XKyBFbjpI25KD19XJxRoawMzwr63DJj6nWVWS/Z1LLpwIcELD77h79cxZ0VjHYlC/Us
         gapQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793308837; x=1793913637;
        h=in-reply-to:content-disposition:content-type:mime-version
         :references:message-id:subject:cc:to:from:date:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=RZlVVghsARSJ3budySc9Tk3exls/qVV9TTbgx3rntEE=;
        b=cEvnNIc3lkS/gz9bvdERBQ59svXd+i5CrLw3L7HEUmFZxy0CZfcu4J3KCOXv8P5w0x
         keRqM2DtDArIA4rhPFdrsFrXnVuwuDLU8GDa+jPH/TLoScW6yco7bcX9u2aObh4lnSRh
         0GrfZdO0DlATZuZGOJDoBT2PmmxbOTh1cvgZS1xRBjO+QQ/UYPX75LtKoo6adaGDSSOP
         LirI8J7URUcfeFUpjMkkWCJyw3i0p5oAoxpnqA/0IIWIciQb+SSDaTfLmfAJLKXVIT8k
         i0jwI7XdpM0/cgFJVGoIRnU9MxRwup2hbV4XeDwBHTvvwsTw73uMXLhd0Tjl+TD0ilOU
         D+Uw==
X-Gm-Message-State: AFq9FYJhQ1eftR3e4Tl0xG2RhbEQd11KtRr2ouYbWpV4keSZp32HORkS
	/GI1watDOg4N+jDaX88N5s300gJdw41QjcSgDl8NYDQ+ypOmO6Z7muphDZbuAw==
X-Gm-Gg: AYBFou3wmXSv5NaMe/GM5kz+mFKwtnnBSMlR3GKMwO/79pEgUw4iBrzzZ8EUZaRI3DS
	DW/XfGpPtraM6d21VipqZCJF/KVzLGOrxzesH7p7zmyJIxhP86Zx/Gp63josrTesAhpBtduo0B5
	peZp+JR/ypBswDYXT5XPfGuknnaUpjklxxpMfD1KtpbMi984DIkPMjFeyzGeKAPdqjdlpf8xXSs
	mqaAHMjVlalk+LkswnXNLbRBkdqmB0XNihk5l2zrm1VI+OTMr9hoiSgT/n0gXgDB7xT3y0uZTfi
	0sCnQRGbkHFSFq8AD3ORvsWfDxMofkNQpF0Skduuf6L6xAadpumkakTiJ28WzYj40f5TC65UeqE
	eYOJLfUKN9T+AGIxz5pFPvAD5JG9kqOn/pO01Wki+IpMYfyj+e0tEa/FqhSlhtYZoqdTh49Ueu7
	0RIXgJg4YFIihTFaqySQq4NitWghXP26S0SpUY2KAVtbL920hl5JX9SOcWVSjuccqPI02BFF3ZL
	DBgBj2rpK5kTjxw8PHg9bh+JPLly617XKEXugq8a+/0Pd8MVbdYWa4C1+fGenCHS1HbwbVndPsN
	13vdJmuNWP0igvOD5XEodz9pGqmGuCiHu6skfo9NpJ4kOTx015wxbwjsP4sCmx899oyhnUqF2FY
	=
X-Received: by 2002:a05:6830:2b0d:b0:80c:d34f:5f61 with SMTP id 46e09a7af769-85d36484c70mr368718a34.26.1793308836895;
        Thu, 29 Oct 2026 14:20:36 -0700 (PDT)
X-Received: from localhost ([136.51.44.64])
        by smtp.gmail.com with ESMTPSA id 46e09a7af769-85d354985b2sm510464a34.11.2026.10.29.14.20.36
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 29 Oct 2026 14:20:36 -0700 (PDT)
X-Cc: git@vger.kernel.org
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <auL-ZBontaECu8vo@pks.im>