/* Move all pending pokes from POKEL into its free list. If SYNC is true, otherwise do nothing. */ void _pokel_exec (struct pokel *pokel, int sync, int wait) { struct poke *pl, *pokes, *last = NULL; spin_lock (&pokel->lock); pokes = pokel->pokes; pokel->pokes = NULL; spin_unlock (&pokel->lock); for (pl = pokes; pl; last = pl, pl = pl->next) if (sync) { ext2_debug ("syncing 0x%x[%ul]", pl->offset, pl->length); pager_sync_some (pokel->pager, pl->offset, pl->length, wait); } if (last) { spin_lock (&pokel->lock); last->next = pokel->free_pokes; pokel->free_pokes = pokes; spin_unlock (&pokel->lock); } }
/* Move all pending pokes from POKEL into its free list. If SYNC is true, otherwise do nothing. */ void _pokel_exec (struct pokel *pokel, int sync, int wait) { struct poke *pl, *pokes, *last = NULL; pthread_spin_lock (&pokel->lock); pokes = pokel->pokes; pokel->pokes = NULL; pthread_spin_unlock (&pokel->lock); for (pl = pokes; pl; last = pl, pl = pl->next) { if (sync) { ext2_debug ("syncing 0x%lx[%ul]", pl->offset, pl->length); pager_sync_some (pokel->pager, pl->offset, pl->length, wait); } if (pokel->image == disk_cache) { vm_offset_t begin = trunc_block (pl->offset); vm_offset_t end = round_block (pl->offset + pl->length); for (vm_offset_t i = begin; i != end; i += block_size) disk_cache_block_deref (pokel->image + i); } } if (last) { pthread_spin_lock (&pokel->lock); last->next = pokel->free_pokes; pokel->free_pokes = pokes; pthread_spin_unlock (&pokel->lock); } }