PERFORCE change 133299 for review
Steve Wise
swise at FreeBSD.org
Mon Jan 14 18:11:16 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=133299
Change 133299 by swise at swise:vic10:iwarp on 2008/01/15 02:10:25
YAGF - Yet Another Genpool Fix!
wasn't rounding up the chunks correctly.
Affected files ...
.. //depot/projects/iwarp/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cxio_hal.h#8 edit
Differences ...
==== //depot/projects/iwarp/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cxio_hal.h#8 (text+ko) ====
@@ -249,7 +249,7 @@
int chunks;
daddr_t blkno;
- chunks = size >> gp->gen_chunk_shift;
+ chunks = (size + (1<<gp->gen_chunk_shift) - 1) >> gp->gen_chunk_shift;
blkno = blist_alloc(gp->gen_list, chunks);
if (blkno == SWAPBLK_NONE)
@@ -258,29 +258,13 @@
return (gp->gen_base + ((1 << gp->gen_chunk_shift) * blkno));
}
-#define cxio_wait(ctx, lockp, cond) \
-({ \
- int __ret = 0; \
- mtx_lock_spin(lockp); \
- while (!cond) { \
- msleep_spin(ctx, lockp, "cxio_wait", hz); \
- if (SIGPENDING(curthread)) { \
- __ret = ERESTART; \
- break; \
- } \
- } \
- mtx_unlock_spin(lockp); \
- __ret; \
-})
-
-
static __inline void
gen_pool_free(struct gen_pool *gp, daddr_t address, int size)
{
int chunks;
daddr_t blkno;
- chunks = size >> gp->gen_chunk_shift;
+ chunks = (size + (1<<gp->gen_chunk_shift) - 1) >> gp->gen_chunk_shift;
blkno = (address - gp->gen_base) / (1 << gp->gen_chunk_shift);
blist_free(gp->gen_list, blkno, chunks);
}
@@ -292,4 +276,19 @@
free(gp, M_DEVBUF);
}
+#define cxio_wait(ctx, lockp, cond) \
+({ \
+ int __ret = 0; \
+ mtx_lock_spin(lockp); \
+ while (!cond) { \
+ msleep_spin(ctx, lockp, "cxio_wait", hz); \
+ if (SIGPENDING(curthread)) { \
+ __ret = ERESTART; \
+ break; \
+ } \
+ } \
+ mtx_unlock_spin(lockp); \
+ __ret; \
+})
+
#endif
More information about the p4-projects
mailing list