svn commit: r211253 - projects/ofed/head/sys/ofed/include/linux
Jeff Roberson
jeff at FreeBSD.org
Fri Aug 13 03:03:37 UTC 2010
Author: jeff
Date: Fri Aug 13 03:03:36 2010
New Revision: 211253
URL: http://svn.freebsd.org/changeset/base/211253
Log:
- Correct the sense of the bitmap in idr_remove()
- Add initialization via sysinit for statically defined irs.
Sponsored by: Isilon Systems, iX Systems, and Panasas.
Modified:
projects/ofed/head/sys/ofed/include/linux/idr.h
projects/ofed/head/sys/ofed/include/linux/linux_idr.c
Modified: projects/ofed/head/sys/ofed/include/linux/idr.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/idr.h Fri Aug 13 00:45:30 2010 (r211252)
+++ projects/ofed/head/sys/ofed/include/linux/idr.h Fri Aug 13 03:03:36 2010 (r211253)
@@ -29,6 +29,8 @@
#ifndef _LINUX_IDR_H_
#define _LINUX_IDR_H_
+#include <sys/kernel.h>
+
#define IDR_BITS 5
#define IDR_SIZE (1 << IDR_BITS)
#define IDR_MASK (IDR_SIZE - 1)
@@ -44,13 +46,16 @@ struct idr_layer {
};
struct idr {
+ struct mtx lock;
struct idr_layer *top;
struct idr_layer *free;
int layers;
- struct mtx lock;
};
-#define DEFINE_IDR(name) struct idr name
+#define DEFINE_IDR(name) \
+ struct idr name; \
+ SYSINIT(name##_idr_sysinit, SI_SUB_DRIVERS, SI_ORDER_FIRST, \
+ idr_init, &(name));
void *idr_find(struct idr *idp, int id);
int idr_pre_get(struct idr *idp, gfp_t gfp_mask);
Modified: projects/ofed/head/sys/ofed/include/linux/linux_idr.c
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/linux_idr.c Fri Aug 13 00:45:30 2010 (r211252)
+++ projects/ofed/head/sys/ofed/include/linux/linux_idr.c Fri Aug 13 03:03:36 2010 (r211253)
@@ -142,7 +142,7 @@ idr_remove(struct idr *idr, int id)
* We could make this non-fatal and unwind but linux dumps a stack
* and a warning so I don't think it's necessary.
*/
- if (il == NULL || (il->bitmap & (1 << idx)) == 0)
+ if (il == NULL || (il->bitmap & (1 << idx)) != 0)
panic("idr_remove: Item %d not allocated (%p, %p)\n",
id, idr, il);
il->ary[idx] = NULL;
@@ -173,7 +173,7 @@ idr_replace(struct idr *idr, void *ptr,
/*
* Replace still returns an error if the item was not allocated.
*/
- if (il != NULL && (il->bitmap & (1 << idx)) == 0) {
+ if (il != NULL && (il->bitmap & (1 << idx)) != 0) {
res = il->ary[idx];
il->ary[idx] = ptr;
}
More information about the svn-src-projects
mailing list