示例#1
0
static void
heap_purgeDone(RemovalPurgeWalker * walker)
{
    HeapPurgeData *heap_walker = walker->_data;
    RemovalPolicy *policy = walker->_policy;
    HeapPolicyData *heap = policy->_data;
    StoreEntry *entry;
    assert(strcmp(policy->_type, "heap") == 0);
    assert(heap->nwalkers > 0);
    heap->nwalkers -= 1;
    if (heap_walker->min_age > 0) {
	heap->heap->age = heap_walker->min_age;
	debug(81, 3) ("heap_purgeDone: Heap age set to %f\n",
	    (double) heap->heap->age);
    }
    /*
     * Reinsert the locked entries
     */
    while ((entry = linklistShift(&heap_walker->locked_entries))) {
	heap_node *node = heap_insert(heap->heap, entry);
	SET_POLICY_NODE(entry, node);
	storeUnlockObject(entry);
    }
    safe_free(walker->_data);
    cbdataFree(walker);
}
示例#2
0
/*      
 * Clean up references from the SIO before it gets released.
 * The actuall SIO is managed by cbdata so we do not need
 * to bother with that.
 */
static void
storeAufsIOFreeEntry(void *siop)
{
    storeIOState *sio = (storeIOState *) siop;
    squidaiostate_t *aiostate = (squidaiostate_t *) sio->fsstate;
    struct _queued_write *qw;
    struct _queued_read *qr;
    while ((qw = linklistShift(&aiostate->pending_writes))) {
	if (qw->free_func)
	    qw->free_func(qw->buf);
	memPoolFree(aufs_qwrite_pool, qw);
    }
    while ((qr = linklistShift(&aiostate->pending_reads))) {
	cbdataUnlock(qr->callback_data);
	memPoolFree(aufs_qread_pool, qr);
    }
    if (sio->read.callback_data)
	cbdataUnlock(sio->read.callback_data);
    if (sio->callback_data)
	cbdataUnlock(sio->callback_data);
    memPoolFree(squidaio_state_pool, aiostate);
}
示例#3
0
static int
storeAufsKickWriteQueue(storeIOState * sio)
{
    squidaiostate_t *aiostate = (squidaiostate_t *) sio->fsstate;
    struct _queued_write *q = linklistShift(&aiostate->pending_writes);
    if (NULL == q)
	return 0;
    debug(79, 3) ("storeAufsKickWriteQueue: writing queued chunk of %ld bytes\n",
	(long int) q->size);
    storeAufsWrite(INDEXSD(sio->swap_dirn), sio, q->buf, q->size, q->offset, q->free_func);
    memPoolFree(aufs_qwrite_pool, q);
    return 1;
}
示例#4
0
static int
storeAufsKickZCopyQueue(storeIOState * sio)
{
    squidaiostate_t *aiostate = (squidaiostate_t *) sio->fsstate;
    struct _queued_zcopy *q = linklistShift(&(aiostate->pending_zcopies));
    if (NULL == q)
	return 0;
    debug(79, 3) ("storeAufsKickReadQueue: zcopying queued request of %ld bytes\n",(long int) q->size);
    if (cbdataValid(q->callback_data))
	storeAufsZCopy(INDEXSD(sio->swap_dirn), sio, q->zc_target_fd, q->size, q->offset, q->callback, q->callback_data);
    cbdataUnlock(q->callback_data);
    memPoolFree(aufs_qzcopy_pool, q);
    return 1;
}