From: Andre Noll Date: Tue, 29 Dec 2015 15:28:02 +0000 (+0000) Subject: Always try to keep one snapshot for recycling. X-Git-Tag: v0.1.7~18 X-Git-Url: http://git.tuebingen.mpg.de/dss.git/log?p=dss.git;a=commitdiff_plain;h=f1aa445d6e57465d08b8a1ee6b9c87c9bb1d25f6 Always try to keep one snapshot for recycling. 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. --- diff --git a/dss.c b/dss.c index 979ff13..a3bda53 100644 --- 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);