X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=blobdiff_plain;f=dss.c;h=08a9f4c5767918c9226b51d721d11dc83de0e07f;hp=979ff132b04c30f233a7e05b59d05ea5b0e4ed07;hb=fafaa26953e4f452c6b91de4e24ec5ad2a8f6700;hpb=bb57abb9288aae5dfe0fec57d953f01b514443ec diff --git a/dss.c b/dss.c index 979ff13..08a9f4c 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); @@ -622,13 +627,13 @@ static int try_to_free_disk_space(void) victim = find_redundant_snapshot(&sl); if (victim) goto remove; - /* try harder only if disk space is low */ - if (!low_disk_space) - goto out; why = "orphaned"; victim = find_orphaned_snapshot(&sl); if (victim) goto remove; + /* try harder only if disk space is low */ + if (!low_disk_space) + goto out; DSS_WARNING_LOG(("disk space low and nothing obvious to remove\n")); victim = find_oldest_removable_snapshot(&sl); if (victim)