]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix #1605 - timeshift: mark file space as free at earliest opportunity.
authorAdam Sutton <dev@adamsutton.me.uk>
Fri, 15 Feb 2013 10:31:59 +0000 (10:31 +0000)
committerAdam Sutton <dev@adamsutton.me.uk>
Fri, 15 Feb 2013 10:31:59 +0000 (10:31 +0000)
Previously the space was only marked as free when the file was physically
removed (which happens async) which resulted in the buffer immediately
being seen as full.

src/timeshift/timeshift_filemgr.c

index a0d1603a342eac1a4f3d377b48948b324c64e035..19bc6b439b97ae585272f5f81b4403cdc71bc787 100644 (file)
@@ -75,7 +75,6 @@ static void* timeshift_reaper_callback ( void *p )
       if (errno != ENOTEMPTY)
         tvhlog(LOG_ERR, "timeshift", "failed to remove %s [e=%s]",
                dpath, strerror(errno));
-    atomic_add_u64(&timeshift_total_size, -tsf->size);
 
     /* Free memory */
     while ((ti = TAILQ_FIRST(&tsf->iframes))) {
@@ -163,6 +162,7 @@ void timeshift_filemgr_remove
   if (tsf->fd != -1)
     close(tsf->fd);
   TAILQ_REMOVE(&ts->files, tsf, link);
+  atomic_add_u64(&timeshift_total_size, -tsf->size);
   timeshift_reaper_remove(tsf);
 }