diff options
| author | Andre Noll <maan@systemlinux.org> | 2009-08-27 14:55:02 +0200 |
|---|---|---|
| committer | Andre Noll <maan@systemlinux.org> | 2009-08-27 14:55:02 +0200 |
| commit | 676f0d8d399ade79ff579e28787a63f00bdf2ce3 (patch) | |
| tree | 170dedf27ae3937f5eea1311dbb3b0dac5a22ac8 | |
| parent | 0ba29646cbd80a8bb7bdf827352bd1332217c398 (diff) | |
Fix off-by-one bug in find_outdated_snapshot().
The man page sayeth:
"dss removes any snapshots older than n times u",
where n is the number of unit intervals and u is the duration of
a unit interval. As intervals count from zero, this means that a
snapshot should be considered outdated if its interval number
is greater _or equal_ than n.
However, the current code only removes snapshots in intervals
strictly greater than n. Fix this bug and clarify the documentation.
| -rw-r--r-- | dss.c | 4 | ||||
| -rw-r--r-- | dss.ggo | 16 |
2 files changed, 13 insertions, 7 deletions
@@ -385,14 +385,14 @@ static struct snapshot *find_outdated_snapshot(struct snapshot_list *sl) int i; struct snapshot *s; - DSS_DEBUG_LOG("looking for snapshots belonging to intervals greater than %d\n", + DSS_DEBUG_LOG("looking for snapshots belonging to intervals >= %d\n", conf.num_intervals_arg); FOR_EACH_SNAPSHOT(s, i, sl) { if (snapshot_is_being_created(s)) continue; if (is_reference_snapshot(s)) continue; - if (s->interval <= conf.num_intervals_arg) + if (s->interval < conf.num_intervals_arg) continue; return s; } @@ -110,11 +110,17 @@ groupoption "prune" P "Remove redundant and outdated snapshots" group="command" details=" - A snapshot is considered outdated if it belongs to an interval - greater than the maximum number of intervals. It is said to be - redundant if it belongs to an interval that already contains - more than the desired number of snapshots. This command gets - rid of such snapshots. + A snapshot is considered outdated if its interval number + is greater or equal than the specified number of unit + intervals. See the \"Intervals\" section below for the precise + definition of these terms. + + A snapshot is said to be redundant if it belongs to an + interval that already contains more than the desired number + of snapshots. + + The prune command gets rid of both outdated and redundant + snapshots. " groupoption "ls" L |
