Date: Fri, 13 Aug 2010 03:03:37 +0000 (UTC) From: Jeff Roberson <jeff@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r211253 - projects/ofed/head/sys/ofed/include/linux Message-ID: <201008130303.o7D33bYt074046@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008130303.o7D33bYt074046>