- struct snapshot *s = get_oldest_snapshot(sl);
-
- if (!s) /* no snapshot found */
- return NULL;
- DSS_INFO_LOG("oldest snapshot: %s\n", s->name);
- if (snapshot_is_being_created(s))
- return NULL;
- return s;
+ int i;
+ struct snapshot *s;
+ FOR_EACH_SNAPSHOT(s, i, sl) {
+ if (snapshot_is_being_created(s))
+ continue;
+ if (is_reference_snapshot(s))
+ continue;
+ DSS_INFO_LOG("oldest removable snapshot: %s\n", s->name);
+ return s;
+ }
+ return NULL;