Changeset 266294a9 in mainline for generic/src/mm/slab.c
- Timestamp:
- 2006-02-05T17:01:03Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5c9a08b
- Parents:
- 9b9e385
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/mm/slab.c
r9b9e385 r266294a9 229 229 slab_t *slab) 230 230 { 231 int freed = 0; 232 231 233 if (!slab) 232 234 slab = obj2slab(obj); … … 235 237 ASSERT(slab->available < cache->objects); 236 238 239 if (cache->destructor) 240 freed = cache->destructor(obj); 241 237 242 spinlock_lock(&cache->slablock); 238 243 … … 247 252 spinlock_unlock(&cache->slablock); 248 253 249 return slab_space_free(cache, slab);254 return freed + slab_space_free(cache, slab); 250 255 251 256 } else if (slab->available == 1) { … … 255 260 } 256 261 spinlock_unlock(&cache->slablock); 257 return 0;262 return freed; 258 263 } 259 264 … … 291 296 slab->nextavail = *((int *)obj); 292 297 slab->available--; 298 293 299 if (! slab->available) 294 300 list_prepend(&slab->link, &cache->full_slabs); … … 297 303 298 304 spinlock_unlock(&cache->slablock); 305 306 if (cache->constructor && cache->constructor(obj, flags)) { 307 /* Bad, bad, construction failed */ 308 slab_obj_destroy(cache, obj, slab); 309 return NULL; 310 } 299 311 return obj; 300 312 } … … 532 544 size_t align, 533 545 int (*constructor)(void *obj, int kmflag), 534 void(*destructor)(void *obj),546 int (*destructor)(void *obj), 535 547 int flags) 536 548 { … … 597 609 size_t align, 598 610 int (*constructor)(void *obj, int kmflag), 599 void(*destructor)(void *obj),611 int (*destructor)(void *obj), 600 612 int flags) 601 613 {
Note:
See TracChangeset
for help on using the changeset viewer.