]> git.tuebingen.mpg.de Git - dss.git/blobdiff - dss.c
Always try to keep one snapshot for recycling.
[dss.git] / dss.c
diff --git a/dss.c b/dss.c
index 979ff132b04c30f233a7e05b59d05ea5b0e4ed07..a3bda5330510e5290ef234d0a8e67b29a726461d 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -612,7 +612,12 @@ static int try_to_free_disk_space(void)
         */
        dss_get_snapshot_list(&sl);
        ret = 0;
-       if (!low_disk_space && sl.num_snapshots <= 1)
+       /*
+        * Don't remove anything if there is free space and we have fewer
+        * snapshots than configured, plus one. This way there is always one
+        * snapshot that can be recycled.
+        */
+       if (!low_disk_space && sl.num_snapshots <= 1 << conf.num_intervals_arg)
                goto out;
        why = "outdated";
        victim = find_outdated_snapshot(&sl);