From 77ff799cc8214db4db8f848c56bdc8c502a0fdb7 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Fri, 28 Jun 2024 00:05:21 -0700 Subject: gc: refactor the gc server thread out into a class without changing it This removes a *whole load* of variables from scope and enforces thread boundaries with the type system. There is not much change of significance in here, so the things to watch out for while reviewing it are primarily that the destructor ordering may have changed inadvertently, I think. Change-Id: I3cd87e6d5a08dfcf368637407251db22a8906316 --- src/libstore/local-store.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libstore/local-store.cc') diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 757aa21e3..10d43ee3e 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -181,7 +181,7 @@ LocalStore::LocalStore(const Params & params) , LocalFSStore(params) , dbDir(stateDir + "/db") , linksDir(realStoreDir + "/.links") - , reservedPath(dbDir + "/reserved") + , reservedSpacePath(dbDir + "/reserved") , schemaPath(dbDir + "/schema") , tempRootsDir(stateDir + "/temproots") , fnTempRoots(fmt("%s/%d", tempRootsDir, getpid())) @@ -259,10 +259,10 @@ LocalStore::LocalStore(const Params & params) before doing a garbage collection. */ try { struct stat st; - if (stat(reservedPath.c_str(), &st) == -1 || + if (stat(reservedSpacePath.c_str(), &st) == -1 || st.st_size != settings.reservedSize) { - AutoCloseFD fd{open(reservedPath.c_str(), O_WRONLY | O_CREAT | O_CLOEXEC, 0600)}; + AutoCloseFD fd{open(reservedSpacePath.c_str(), O_WRONLY | O_CREAT | O_CLOEXEC, 0600)}; int res = -1; #if HAVE_POSIX_FALLOCATE res = posix_fallocate(fd.get(), 0, settings.reservedSize); -- cgit v1.2.3