]> git.tuebingen.mpg.de Git - dss.git/blobdiff - dss.c
find_oldest_removable_snapshot(): Improve log message.
[dss.git] / dss.c
diff --git a/dss.c b/dss.c
index b6a3d3e714059861ab1ae100933655b7e4e13c50..db454491c7024b78eba4a7cd692b9585badfd09f 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -81,7 +81,7 @@ static int64_t next_snapshot_time;
 static struct timeval next_removal_check;
 /** Creation time of the snapshot currently being created. */
 static int64_t current_snapshot_creation_time;
-/** The snapshot currently being removed. */
+/* Set by the pre-rm hook, cleared by handle_remove_exit(). */
 struct snapshot *snapshot_currently_being_removed;
 /** Needed by the post-create hook. */
 static char *path_to_last_complete_snapshot;
@@ -574,9 +574,6 @@ static int is_reference_snapshot(struct snapshot *s)
        return strcmp(s->name, name_of_reference_snapshot)? 0 : 1;
 }
 
-/*
- * return: 0: no redundant snapshots, 1: rm process started, negative: error
- */
 static struct snapshot *find_redundant_snapshot(struct snapshot_list *sl)
 {
        int i, interval;
@@ -654,6 +651,7 @@ static struct snapshot *find_oldest_removable_snapshot(struct snapshot_list *sl)
        int i, num_complete;
        struct snapshot *s, *ref = NULL;
 
+       DSS_DEBUG_LOG(("picking snapshot with earliest creation time\n"));
        num_complete = num_complete_snapshots(sl);
        if (num_complete <= OPT_UINT32_VAL(DSS, MIN_COMPLETE))
                return NULL;
@@ -664,7 +662,6 @@ static struct snapshot *find_oldest_removable_snapshot(struct snapshot_list *sl)
                        ref = s;
                        continue;
                }
-               DSS_INFO_LOG(("oldest removable snapshot: %s\n", s->name));
                return s;
        }
        assert(ref);
@@ -1664,6 +1661,7 @@ static int com_prune(void)
        victim = find_redundant_snapshot(&sl);
        if (victim)
                goto rm;
+       dss_msg("nothing to prune\n");
        ret = 0;
        goto out;
 rm:
@@ -1678,6 +1676,7 @@ rm:
                ret = wait_for_remove_process();
                if (ret < 0)
                        goto out;
+               ret = -E_HOOK_FAILED;
                if (snapshot_removal_status != HS_PRE_SUCCESS)
                        goto out;
        }