[ER] guix gc should tell how much space it recovered

  • Done
  • quality assurance status badge
Details
3 participants
  • Andreas Enge
  • Ludovic Courtès
  • Vincent Legoll
Owner
unassigned
Submitted by
Vincent Legoll
Severity
normal
V
V
Vincent Legoll wrote on 14 Jul 2016 12:54
(address . bug-guix@gnu.org)
CAEwRq=o5Z9e03m+3kKGVfyd=hmRaJgLwEMK8gzZDZ9i8U0GQoQ@mail.gmail.com
It already shows:
note: currently hard linking saves 485.41 MiB

Recovered disk space would nicely complement that.

I could be mentored to do it myself, but I'm very new to guile & guix
;-)

I'd at least require high level directions as to where I should look (in
the code) to graft that functionality.

--
Vincent Legoll
V
V
Vincent Legoll wrote on 14 Jul 2016 13:30
(address . 23979@debbugs.gnu.org)
CAEwRq=opeGzxOQ+4ssndfdE0Ria20FGsGiTYbObzxBon1=SNPw@mail.gmail.com
Looks like I helped myself out of step 1:
this is in guix/scripts/gc.scm if I'm not mistaken

--
Vincent Legoll
L
L
Ludovic Courtès wrote on 15 Jul 2016 16:33
(name . Vincent Legoll)(address . vincent.legoll@gmail.com)(address . 23979@debbugs.gnu.org)
87eg6v0y45.fsf@gnu.org
Vincent Legoll <vincent.legoll@gmail.com> skribis:

Toggle quote (5 lines)
> It already shows:
> note: currently hard linking saves 485.41 MiB
>
> Recovered disk space would nicely complement that.

Indeed.

Toggle quote (3 lines)
> Looks like I helped myself out of step 1:
> this is in guix/scripts/gc.scm if I'm not mistaken

Yep, you’re on the right track!

This code calls the ‘collect-garbage’ procedure, defined in (guix
store). You’ll see that this procedure returns two values, which are
currently ignored: the name of the items that were removed from the
store, and the number of bytes freed.

Your mission, if you accept it, is to change gc.scm to retrieve this
second value and to display it in a human-friendly way. :-)

HTH!

Ludo’.
A
A
Andreas Enge wrote on 15 Jul 2016 17:12
(name . Ludovic Courtès)(address . ludo@gnu.org)
20160715151206.GA8436@solar
On Fri, Jul 15, 2016 at 04:33:46PM +0200, Ludovic Courtès wrote:
Toggle quote (5 lines)
> This code calls the ‘collect-garbage’ procedure, defined in (guix
> store). You’ll see that this procedure returns two values, which are
> currently ignored: the name of the items that were removed from the
> store, and the number of bytes freed.

Brutto or netto? Otherwise said, does it take into account the hardlinks
used for deduplication, or does it pretend that every deleted file saves
as much memory as its size indicates?

Andreas
L
L
Ludovic Courtès wrote on 15 Jul 2016 19:06
(name . Andreas Enge)(address . andreas@enge.fr)
87vb06ygoc.fsf@gnu.org
Andreas Enge <andreas@enge.fr> skribis:

Toggle quote (10 lines)
> On Fri, Jul 15, 2016 at 04:33:46PM +0200, Ludovic Courtès wrote:
>> This code calls the ‘collect-garbage’ procedure, defined in (guix
>> store). You’ll see that this procedure returns two values, which are
>> currently ignored: the name of the items that were removed from the
>> store, and the number of bytes freed.
>
> Brutto or netto? Otherwise said, does it take into account the hardlinks
> used for deduplication, or does it pretend that every deleted file saves
> as much memory as its size indicates?

The latter, I think. The actual computation is done by the daemon, in
libstore/gc.cc.

Ludo’.
V
V
Vincent Legoll wrote on 16 Jul 2016 10:20
(name . Ludovic Courtès)(address . ludo@gnu.org)
CAEwRq=r7Db_6ze89paueaN8xRaPNH2+ODG3SnNVx+S70qODM0Q@mail.gmail.com
Here is an attempt:


I tried to use call-with-values, but couldn't make it to work so
reverted back to let-values...

To test, I added (guix-gc "-C") at the end of the script and ran "guix
pull && guile gc.scm", looked OK...

--
Vincent Legoll
V
Closed
?