]> git.tuebingen.mpg.de Git - dss.git/commitdiff
Always try to keep one snapshot for recycling.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 29 Dec 2015 15:28:02 +0000 (15:28 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 3 Mar 2016 14:34:48 +0000 (15:34 +0100)
Currently, if --keep-redundant is not given, we try to get rid of
outdated and redundant snapshots quickly, even if there is plenty of
free disk space available. However, as these snapshots can be used
for recycling, it seems to be worth to keep them around as long as
there are fewer snapshots available as configured.

This commit changes try_to_free_disk_space() to not remove snapshots
any more in this case. This patch should reduce disk I/O in the common
case where no snapshots need to be removed due to low disk space.

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);