From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0ER7ECGxemGLbQEAgWs5BA (envelope-from ) for ; Thu, 28 Oct 2021 16:18:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id qBQtDCGxemFPHQAA1q6Kng (envelope-from ) for ; Thu, 28 Oct 2021 14:18:09 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 083FB32207 for ; Thu, 28 Oct 2021 16:18:09 +0200 (CEST) Received: from localhost ([::1]:38986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mg6EJ-0006Wp-Oi for larch@yhetil.org; Thu, 28 Oct 2021 10:18:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mg6DH-0005h3-Du for guix-patches@gnu.org; Thu, 28 Oct 2021 10:17:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41332) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mg6DG-0003kI-6l for guix-patches@gnu.org; Thu, 28 Oct 2021 10:17:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mg6DF-0002Kg-Pe for guix-patches@gnu.org; Thu, 28 Oct 2021 10:17:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#51427] [PATCH] nix: libstore: Do not remove unused links when deleting specific items. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 28 Oct 2021 14:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51427 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: 51427@debbugs.gnu.org Received: via spool by 51427-submit@debbugs.gnu.org id=B51427.16354305938926 (code B ref 51427); Thu, 28 Oct 2021 14:17:01 +0000 Received: (at 51427) by debbugs.gnu.org; 28 Oct 2021 14:16:33 +0000 Received: from localhost ([127.0.0.1]:52878 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mg6Cm-0002Ju-Vj for submit@debbugs.gnu.org; Thu, 28 Oct 2021 10:16:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57746) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mg6Cl-0002Jh-Hr for 51427@debbugs.gnu.org; Thu, 28 Oct 2021 10:16:32 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51254) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mg6Cf-0003K0-VJ; Thu, 28 Oct 2021 10:16:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=kw7IzbQ1HNvuYJ5k6sz5WTp6sxI5tcSt0+Cm6WlRw7Y=; b=rIbUGGqlIOonBDinCxCS aowVF0+8VA+W0bVwX+moS9D/UfshnucOMEA+M6S6y2EtyRzOD5TVCduQ3kAsWy2HahgnydIktnJ7/ VAcDMWY919yJ3XfPKQG1baTiB+SRumeI5sDb8btrfQnCsT+pHSNt+Eu32SqrkbawLuh8xND/N+xYF /d32cEUKJFAUrDXlItwu3fdOgqdcvC1MOCgOZtwUDeIh9bCpADhxmPel4wv9vbfoqswLDmMMZbLxR OY058EXoVK1K7rmu1PEsIInAGQ6hSl+vtR6crLrsJW9iqCYtDNZGvOBtnja1cxGG/Gr+jrV8lmSsu 4SKcJTq6sVFcOQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:54824 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mg6Cf-0006k0-8y; Thu, 28 Oct 2021 10:16:25 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20211027034918.4591-1-maxim.cournoyer@gmail.com> Date: Thu, 28 Oct 2021 16:16:22 +0200 In-Reply-To: <20211027034918.4591-1-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Tue, 26 Oct 2021 23:49:18 -0400") Message-ID: <87o8795j61.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635430689; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=kw7IzbQ1HNvuYJ5k6sz5WTp6sxI5tcSt0+Cm6WlRw7Y=; b=n/tkDpyGeA2n0dvDrojtDONFjS/kCAlG8gE88BI3WB92T5nIENNExAmbe2ULYBCw204LDr egxf5XZAX9+ES8EaLTdPXQTqvGEWUwnSvzZq/1UXud2G3f7o9DYPiE8osHQRDKZwK9IHsJ cd9dssDOp5QdauR8tjK8sSINEpAfRwqktW6Dpwuk0HNsWCCDu9b7asBFM35sJvdhhJ8+y9 yixryV682mH4j1kG9AEzPPU8OucEYz7Tfr1Pd+1MhfU0l+1LUPO5QfNP/3DzLuDub4WzYs Gn0RSGoqO7kNgoSCHhFKQovH061ZwruF9Iy6DfSmEflmmY09yddzw7wtN5MXgw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635430689; a=rsa-sha256; cv=none; b=Dnv8DhCzPmJS1EfB+Pyd+A/lTBNnIj07HrWCJIz0BpoKFzznioIG4gQ8bbHbWuHMD/KSDJ uTpcqnlqb4hpkjdEY95f1vMQVqBIwtvEVwToYHKISNbF3qTQuy4I0tcM0EFscu9dnxZU3Q uQhy+7YppIViH7gh/38yL+o2Ta+ZMIkSVhmixXfG+kcNk3aEWmh5DaFZ7JccuQbrE1qxJ1 lRHiCgJ11dfAWRcAWYtfPQozc7jOmRqtEABTGYQbm2nIVJGcPt8tyjfGVckgHMYaITw8Ap v+wd+H7EgXVDPM/ZVGk3etvGoFevTGvNy7O648Mz9fGCn3qLT+SdmWJHhjFtig== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=rIbUGGql; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -2.93 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=rIbUGGql; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 083FB32207 X-Spam-Score: -2.93 X-Migadu-Scanner: scn0.migadu.com X-TUID: 9ZtL6xc/NbFg Hi, Maxim Cournoyer skribis: > Deleting unused links can be a very costly operation, especially on rotat= ive > hard drives. As removing single store items is often used for experiment= ation > rather than for cleaning purposes, this change allows it to run without t= he > links cleanup. > > * nix/libstore/gc.cc (LocalStore::collectGarbage): Do not clean up links = when > the specified action is GCOptions::gcDeleteSpecific. > --- > nix/libstore/gc.cc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc > index e1d0765154..7d872d8cc1 100644 > --- a/nix/libstore/gc.cc > +++ b/nix/libstore/gc.cc > @@ -771,7 +771,7 @@ void LocalStore::collectGarbage(const GCOptions & opt= ions, GCResults & results) > deleteGarbage(state, state.trashDir); >=20=20 > /* Clean up the links directory. */ > - if (options.action =3D=3D GCOptions::gcDeleteDead || options.action = =3D=3D GCOptions::gcDeleteSpecific) { > + if (options.action =3D=3D GCOptions::gcDeleteDead) { I believe the effect is that =E2=80=98guix gc -D /gnu/store/=E2=80=A6-disk-= image=E2=80=99 would remove nothing: /gnu/store/.links would still contain a copy of that big disk image, so as a result, you=E2=80=99ve freed zero bytes. Am I right? Perhaps what we could do is, upon =E2=80=98gcDeleteSpecific=E2=80=99, only = look at the relevant entry in .links instead of traversing all of them. WDYT? Thanks, Ludo=E2=80=99.