mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
daemon: Account for deleted store files when deduplication is on.
Previously, a store item that is a regular file would not be accounted for in the 'bytesFreed' value computed by 'deletePath' because its 'st_nlink' count would always be >= 2. This commit fixes that. * nix/libutil/util.hh (deletePath): Add optional 'linkThreshold' argument. * nix/libutil/util.cc (_deletePath): Add 'linkThreshold' argument and honor it. Pass it down in recursive call. (deletePath): Add 'linkThreshold' and honor it. * nix/libstore/gc.cc (LocalStore::deleteGarbage): Pass 'linkThreshold' argument to 'deletePath', with a value of 2 when PATH is a store item and deduplication is on.
This commit is contained in:
parent
79154f0a09
commit
7033c7692c
3 changed files with 17 additions and 8 deletions
|
@ -94,10 +94,12 @@ void writeLine(int fd, string s);
|
|||
|
||||
/* Delete a path; i.e., in the case of a directory, it is deleted
|
||||
recursively. Don't use this at home, kids. The second variant
|
||||
returns the number of bytes and blocks freed. */
|
||||
returns the number of bytes and blocks freed, and 'linkThreshold' denotes
|
||||
the number of links under which a file is accounted for in 'bytesFreed'. */
|
||||
void deletePath(const Path & path);
|
||||
|
||||
void deletePath(const Path & path, unsigned long long & bytesFreed);
|
||||
void deletePath(const Path & path, unsigned long long & bytesFreed,
|
||||
size_t linkThreshold = 1);
|
||||
|
||||
/* Create a temporary directory. */
|
||||
Path createTempDir(const Path & tmpRoot = "", const Path & prefix = "nix",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue