+static void transaction_minimize_impact(Manager *m) {
+ bool again;
+ assert(m);
+
+ /* Drops all unnecessary jobs that reverse already active jobs
+ * or that stop a running service. */
+
+ do {
+ Job *j;
+ void *state;
+
+ again = false;
+
+ HASHMAP_FOREACH(j, m->transaction_jobs, state) {
+ for (; j; j = j->transaction_next) {
+
+ /* If it matters, we shouldn't drop it */
+ if (j->matters_to_anchor)
+ continue;
+
+ /* Would this stop a running service?
+ * Would this change an existing job?
+ * If so, let's drop this entry */
+ if ((j->type != JOB_STOP || name_is_dead(j->name)) &&
+ (!j->name->meta.job || job_type_is_conflicting(j->type, j->name->meta.job->state)))
+ continue;
+
+ /* Ok, let's get rid of this */
+ transaction_delete_job(m, j);
+ again = true;
+ break;
+ }
+
+ if (again)
+ break;
+ }
+
+ } while (again);
+}
+