Subject: bug#24937: "deleting unused links" GC phase is too slow

From: [email-masked] (Ludovic Courtès)
Date: Sun, 13 Nov 2016 18:41:01 +0100

‘LocalStore::removeUnusedLinks’ traverses all the entries in
/gnu/store/.links and calls lstat(2) on each one of them and checks
‘st_nlink’ to determine whether they can be deleted.

There are two problems: lstat(2) can be slow on spinning disks as found
on hydra.gnu.org, and the algorithm is proportional in the number of
entries in /gnu/store/.links, which is a lot on hydra.gnu.org.

Ludo’.