}
void
+drop_multipath (vector mpvec, char * wwid, int free_paths)
+{
+ int i;
+ struct multipath * mpp;
+
+ if (!mpvec)
+ return;
+
+ vector_foreach_slot (mpvec, mpp, i) {
+ if (!strncmp(mpp->wwid, wwid, WWID_SIZE)) {
+ free_multipath(mpp, free_paths);
+ vector_del_slot(mpvec, i);
+ return;
+ }
+ }
+}
+
+void
free_multipathvec (vector mpvec, int free_paths)
{
int i;
void free_pathgroup (struct pathgroup * pgp, int free_paths);
void free_pgvec (vector pgvec, int free_paths);
void free_multipath (struct multipath *, int free_paths);
+void drop_multipath (vector mpvec, char * wwid, int free_paths);
void free_multipathvec (vector mpvec, int free_paths);
int store_path (vector pathvec, struct path * pp);
}
static int
+deadmap (struct multipath * mpp)
+{
+ int i, j;
+ struct pathgroup * pgp;
+ struct path * pp;
+
+ vector_foreach_slot (mpp->pg, pgp, i)
+ vector_foreach_slot (pgp->paths, pp, j)
+ if (strlen(pp->dev))
+ return 0; /* alive */
+
+ return 1; /* dead */
+}
+
+static int
coalesce_paths (vector curmp, vector pathvec)
{
int k, i;
condlog(3, "action set to %i", mpp->action);
domap(mpp);
+ drop_multipath(curmp, mpp->wwid, KEEP_PATHS);
free_multipath(mpp, KEEP_PATHS);
}
+ /*
+ * Flush maps with only dead paths (ie not in sysfs)
+ * Keep maps with only failed paths
+ */
+ vector_foreach_slot (curmp, mpp, i) {
+ if (!deadmap(mpp))
+ continue;
+
+ if (dm_flush_map(mpp->alias, DEFAULT_TARGET))
+ condlog(2, "remove: %s (dead) failed!",
+ mpp->alias);
+ else
+ condlog(2, "remove: %s (dead)", mpp->alias);
+ }
return 0;
}