| version 1.129, 2007/03/12 18:18:34 |
version 1.130, 2007/08/18 00:33:38 |
| Line 2184 pool_cache_destruct_object(struct pool_c |
|
| Line 2184 pool_cache_destruct_object(struct pool_c |
|
| pool_put(pc->pc_pool, object); |
pool_put(pc->pc_pool, object); |
| } |
} |
| |
|
| |
/* |
| |
* pool_do_cache_invalidate_grouplist: |
| |
* |
| |
* Invalidate a single grouplist and destruct all objects. |
| |
* XXX This is too expensive. We should swap the list then |
| |
* unlock. |
| |
*/ |
| static void |
static void |
| pool_do_cache_invalidate_grouplist(struct pool_cache_grouplist *pcgsl, |
pool_do_cache_invalidate_grouplist(struct pool_cache_grouplist *pcgsl, |
| struct pool_cache *pc, struct pool_pagelist *pq, |
struct pool_cache *pc, struct pool_pagelist *pq, |
| struct pool_cache_grouplist *pcgdl) |
struct pool_cache_grouplist *pcgdl) |
| { |
{ |
| struct pool_cache_group *pcg, *npcg; |
struct pool_cache_group *pcg; |
| void *object; |
void *object; |
| |
|
| for (pcg = LIST_FIRST(pcgsl); pcg != NULL; pcg = npcg) { |
LOCK_ASSERT(simple_lock_held(&pc->pc_slock)); |
| npcg = LIST_NEXT(pcg, pcg_list); |
LOCK_ASSERT(simple_lock_held(&pc->pc_pool->pr_slock)); |
| |
|
| |
while ((pcg = LIST_FIRST(pcgsl)) != NULL) { |
| |
pc->pc_ngroups--; |
| |
LIST_REMOVE(pcg, pcg_list); |
| |
LIST_INSERT_HEAD(pcgdl, pcg, pcg_list); |
| |
pc->pc_nitems -= pcg->pcg_avail; |
| |
simple_unlock(&pc->pc_pool->pr_slock); |
| |
simple_unlock(&pc->pc_slock); |
| |
|
| while (pcg->pcg_avail != 0) { |
while (pcg->pcg_avail != 0) { |
| pc->pc_nitems--; |
|
| object = pcg_get(pcg, NULL); |
object = pcg_get(pcg, NULL); |
| if (pc->pc_dtor != NULL) |
if (pc->pc_dtor != NULL) |
| (*pc->pc_dtor)(pc->pc_arg, object); |
(*pc->pc_dtor)(pc->pc_arg, object); |
| |
simple_lock(&pc->pc_pool->pr_slock); |
| pool_do_put(pc->pc_pool, object, pq); |
pool_do_put(pc->pc_pool, object, pq); |
| |
simple_unlock(&pc->pc_pool->pr_slock); |
| } |
} |
| pc->pc_ngroups--; |
|
| LIST_REMOVE(pcg, pcg_list); |
simple_lock(&pc->pc_slock); |
| LIST_INSERT_HEAD(pcgdl, pcg, pcg_list); |
simple_lock(&pc->pc_pool->pr_slock); |
| } |
} |
| } |
} |
| |
|