svn commit: r211442 - projects/ofed/head/sys/ofed/include/linux

Jeff Roberson jeff at FreeBSD.org
Wed Aug 18 07:32:24 UTC 2010


Author: jeff
Date: Wed Aug 18 07:32:24 2010
New Revision: 211442
URL: http://svn.freebsd.org/changeset/base/211442

Log:
   - Properly initialize the free dr bitmap.
   - Reset the leaf bitmap when freeing an idr item.
   - Add a lookup and assert after add to catch any other bugs early.
  
  Sponsored by:	Isilon Systems, iX Systems, and Panasas.

Modified:
  projects/ofed/head/sys/ofed/include/linux/linux_idr.c

Modified: projects/ofed/head/sys/ofed/include/linux/linux_idr.c
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/linux_idr.c	Wed Aug 18 07:31:28 2010	(r211441)
+++ projects/ofed/head/sys/ofed/include/linux/linux_idr.c	Wed Aug 18 07:32:24 2010	(r211442)
@@ -146,6 +146,7 @@ idr_remove(struct idr *idr, int id)
 		panic("idr_remove: Item %d not allocated (%p, %p)\n",
 		    id, idr, il);
 	il->ary[idx] = NULL;
+	il->bitmap |= 1 << idx;
 	mtx_unlock(&idr->lock);
 	return;
 }
@@ -226,7 +227,7 @@ idr_pre_get(struct idr *idr, gfp_t gfp_m
 			iln = malloc(sizeof(*il), M_IDR, M_ZERO | gfp_mask);
 			if (iln == NULL)
 				break;
-			iln->bitmap = IDR_MASK;
+			bitmap_fill(&iln->bitmap, IDR_SIZE);
 			if (head != NULL) {
 				il->ary[0] = iln;
 				il = iln;
@@ -327,6 +328,10 @@ idr_get_new(struct idr *idr, void *ptr, 
 	error = 0;
 out:
 	mtx_unlock(&idr->lock);
+	if (error == 0 && idr_find(idr, id) != ptr) {
+		panic("idr_get_new: Failed for idr %p, id %d, ptr %p\n",
+		    idr, id, ptr);
+	}
 	return (error);
 }
 


More information about the svn-src-projects mailing list