Author: mav
Date: Fri Apr 12 17:15:47 2013
New Revision: 249414
URL: http://svnweb.freebsd.org/changeset/base/249414

Log:
  MFC r249161:
  Following r241022, replace iteration over the provider list on media events
  by taking first one and asserting that there is no others.

Modified:
  stable/9/sys/geom/geom_disk.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/geom_disk.c
==============================================================================
--- stable/9/sys/geom/geom_disk.c       Fri Apr 12 17:01:07 2013        
(r249413)
+++ stable/9/sys/geom/geom_disk.c       Fri Apr 12 17:15:47 2013        
(r249414)
@@ -657,8 +657,12 @@ disk_media_changed(struct disk *dp, int 
 
        gp = dp->d_geom;
        if (gp != NULL) {
-               LIST_FOREACH(pp, &gp->provider, provider)
+               pp = LIST_FIRST(&gp->provider);
+               if (pp != NULL) {
+                       KASSERT(LIST_NEXT(pp, provider) == NULL,
+                           ("geom %p has more than one provider", gp));
                        g_media_changed(pp, flag);
+               }
        }
 }
 
@@ -670,8 +674,12 @@ disk_media_gone(struct disk *dp, int fla
 
        gp = dp->d_geom;
        if (gp != NULL) {
-               LIST_FOREACH(pp, &gp->provider, provider)
+               pp = LIST_FIRST(&gp->provider);
+               if (pp != NULL) {
+                       KASSERT(LIST_NEXT(pp, provider) == NULL,
+                           ("geom %p has more than one provider", gp));
                        g_media_gone(pp, flag);
+               }
        }
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to