From patchwork Wed Oct 27 03:49:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 34079 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9EAFA27BBE3; Wed, 27 Oct 2021 04:50:44 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 70CA327BBE1 for ; Wed, 27 Oct 2021 04:50:44 +0100 (BST) Received: from localhost ([::1]:42504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfZxb-0006Pl-JP for patchwork@mira.cbaines.net; Tue, 26 Oct 2021 23:50:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfZwx-0006Ov-71 for guix-patches@gnu.org; Tue, 26 Oct 2021 23:50:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36507) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfZww-0004vH-UA for guix-patches@gnu.org; Tue, 26 Oct 2021 23:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mfZww-0003G8-M1 for guix-patches@gnu.org; Tue, 26 Oct 2021 23:50:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#51427] [PATCH] nix: libstore: Do not remove unused links when deleting specific items. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 27 Oct 2021 03:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51427 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51427@debbugs.gnu.org Cc: Maxim Cournoyer X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.163530657612481 (code B ref -1); Wed, 27 Oct 2021 03:50:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Oct 2021 03:49:36 +0000 Received: from localhost ([127.0.0.1]:48053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfZwW-0003FF-8W for submit@debbugs.gnu.org; Tue, 26 Oct 2021 23:49:36 -0400 Received: from lists.gnu.org ([209.51.188.17]:45178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfZwU-0003F5-7K for submit@debbugs.gnu.org; Tue, 26 Oct 2021 23:49:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfZwT-0005tm-Vi for guix-patches@gnu.org; Tue, 26 Oct 2021 23:49:33 -0400 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]:36748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfZwQ-0004tn-9B for guix-patches@gnu.org; Tue, 26 Oct 2021 23:49:32 -0400 Received: by mail-qv1-xf2b.google.com with SMTP id d6so969218qvb.3 for ; Tue, 26 Oct 2021 20:49:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=USc2GRKlyZftlRGTlOFFKvKPqCXluZ/pmB5TfjQX7WE=; b=bCDR8WY99Pou8uT3lDKvjBN5u/6W4B3lk4G7ZlbYFqBexSkLpEeXC6KRk21Aq7kSPd PtCwgAU4m+YWqbyL6xqwaamG9eabHAJjiWLWlZ8SlO+UopxijpvuVEvVrfMxbQ62ciaP d4iERC6+DJ9eynJeKukWD/WKN+htz67CdkBgbY753KdKtL60F8EuC5gkayUxa+KgTJq5 fsbq9ZQV94Csyn9mHjUicV3DWNe0jk/W9IfmyTsmX3mRj13WkWOfUVWmPzT+ONWDHhQn qt483AKIEoSrog5L/WtwaY592ULL5oqhVn5xXyiae0genWL12kgqYIxHjLELTGx5c+1e JRGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=USc2GRKlyZftlRGTlOFFKvKPqCXluZ/pmB5TfjQX7WE=; b=IZKDac5J/NNhQjbFMQrxCj9ykKxlfr2mMtyBQ1UumXb7aZ40iv/+/T17oQdO4OvIqx /cX0K9vUBnGBRbExdNr77e9lDGnNvuiKhYZAZZHQD0TxJCelDDNGPmOs7UF3y+iewPzY Imn70GlLLklCqLWTS9JjK1fJDHsIfQcu5qk++UXqr0hhr9HmTlzKKBd1d4dL3WtwnhtX e4JOSgKhRfpEO05haQlgSiwy1gNyk0u24L0hM1IRfjiWxeh1xKBX5ByP7/WkSrQlCWWw gCVKWKOhXEjOX/DhMb7VqRR58jkZ869lTzk2G4KUgCne5ItvuMECls+EXAtyJvj7mhqN bt2w== X-Gm-Message-State: AOAM533UnQGt6thXSrBRj+Q6po16cQTj+9QYMZmKQPQgRMret+ouQnoY DOR7KMe5nQaye9fFAjYfX1d0yzeZvOk= X-Google-Smtp-Source: ABdhPJxeScrHBJgPbN4GobvrNZtvlJjPcqjZBcaqt4818K90bM6ysGTOUp9xZZ6v+a1P3arUXZZAtg== X-Received: by 2002:a05:6214:80f:: with SMTP id df15mr4159708qvb.37.1635306568933; Tue, 26 Oct 2021 20:49:28 -0700 (PDT) Received: from localhost.localdomain (dsl-10-133-98.b2b2c.ca. [72.10.133.98]) by smtp.gmail.com with ESMTPSA id e4sm12715171qty.59.2021.10.26.20.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 20:49:28 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 26 Oct 2021 23:49:18 -0400 Message-Id: <20211027034918.4591-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f2b; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qv1-xf2b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Deleting unused links can be a very costly operation, especially on rotative hard drives. As removing single store items is often used for experimentation rather than for cleaning purposes, this change allows it to run without the 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 & options, GCResults & results) deleteGarbage(state, state.trashDir); /* Clean up the links directory. */ - if (options.action == GCOptions::gcDeleteDead || options.action == GCOptions::gcDeleteSpecific) { + if (options.action == GCOptions::gcDeleteDead) { printMsg(lvlError, format("deleting unused links...")); removeUnusedLinks(state); }