svn commit: r191711 - head/sys/kern

Jamie Gritton jamie at FreeBSD.org
Thu Apr 30 22:43:22 UTC 2009


Author: jamie
Date: Thu Apr 30 22:43:21 2009
New Revision: 191711
URL: http://svn.freebsd.org/changeset/base/191711

Log:
  Don't call the OSD destructor if the data slot is NULL
  (since it's already not done on unused slots, which are indistinguishable
  to the caller).
  
  Approved by:	bz (mentor)

Modified:
  head/sys/kern/kern_osd.c

Modified: head/sys/kern/kern_osd.c
==============================================================================
--- head/sys/kern/kern_osd.c	Thu Apr 30 22:30:01 2009	(r191710)
+++ head/sys/kern/kern_osd.c	Thu Apr 30 22:43:21 2009	(r191711)
@@ -297,8 +297,10 @@ do_osd_del(u_int type, struct osd *osd, 
 		OSD_DEBUG("Slot doesn't exist (type=%u, slot=%u).", type, slot);
 		return;
 	}
-	osd_destructors[type][slot - 1](osd->osd_slots[slot - 1]);
-	osd->osd_slots[slot - 1] = NULL;
+	if (osd->osd_slots[slot - 1] != NULL) {
+		osd_destructors[type][slot - 1](osd->osd_slots[slot - 1]);
+		osd->osd_slots[slot - 1] = NULL;
+	}
 	for (i = osd->osd_nslots - 1; i >= 0; i--) {
 		if (osd->osd_slots[i] != NULL) {
 			OSD_DEBUG("Slot still has a value (type=%u, slot=%u).",


More information about the svn-src-all mailing list