From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-2.7 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id AD34820A21 for ; Thu, 14 Sep 2017 22:17:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751782AbdINWRN (ORCPT ); Thu, 14 Sep 2017 18:17:13 -0400 Received: from mout.gmx.net ([212.227.17.21]:61650 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543AbdINWRM (ORCPT ); Thu, 14 Sep 2017 18:17:12 -0400 Received: from virtualbox ([37.201.193.73]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MGzwE-1deofa0V2w-00Dqc3; Fri, 15 Sep 2017 00:16:56 +0200 Date: Fri, 15 Sep 2017 00:16:40 +0200 (CEST) From: Johannes Schindelin X-X-Sender: virtualbox@virtualbox To: Michael Haggerty cc: Junio C Hamano , =?UTF-8?Q?Nguy=E1=BB=85n_Th=C3=A1i_Ng=E1=BB=8Dc_Duy?= , Stefan Beller , Jeff King , =?UTF-8?Q?=C3=86var_Arnfj=C3=B6r=C3=B0_Bjarmason?= , Brandon Williams , git@vger.kernel.org Subject: Re: [PATCH 00/20] Read `packed-refs` using mmap() In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21.1 (DEB 209 2017-03-23) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K0:lddnY01d9t1w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8sexYh02xG9F2LlZ75Vpw2L3CXmCCG10sQceb8QT4qZsTvbU= Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi Michael, On Thu, 14 Sep 2017, Michael Haggerty wrote: > On 09/13/2017 07:15 PM, Michael Haggerty wrote: > > [...] > > * `mmap()` the whole file rather than `read()`ing it. > > [...] > > Apparently this doesn't work on Windows, because the `snapshot` is > keeping the `packed-refs` file open too long, so the new file can't be > renamed on top of it. Indeed, I sent you a mail about it before I checked for new mails ;-) > I didn't realize that this is even allowed, but TIL that you can close a > file while keeping it mmapped. Does that technique work on Windows? If > so, I'll change v2 to do it as sketched below. I do not know whether that technique works on Windows, but it would not solve the problem *entirely*, as I outlined in my reply: in delete_branches(), for example, the main_worktree_ref_store is implicitly getting its snapshot initialized, and nothing seems to release it. This is only one example, as I figure that multiple worktrees could cause even more ref_stores to have unreleased snapshots of the packed-refs file. I imagine that something like close_all_packs() is needed ("clear_all_snapshots()"?). Ciao, Dscho