Beispiel #1
0
static void
ald_shutdown(void *arg, int howto)
{
    struct alq *alq;

    ALD_LOCK();

    /* Ensure no new queues can be created. */
    ald_shutingdown = 1;

    /* Shutdown all ALQs prior to terminating the ald_daemon. */
    while ((alq = BSD_LIST_FIRST(&ald_queues)) != NULL) {
        BSD_LIST_REMOVE(alq, aq_link);
        ALD_UNLOCK();
        alq_shutdown(alq);
        ALD_LOCK();
    }

    /* At this point, all ALQs are flushed and shutdown. */

    /*
     * Wake ald_daemon so that it exits. It won't be able to do
     * anything until we mtx_sleep because we hold the ald_mtx.
     */
    wakeup(&ald_active);

    /* Wait for ald_daemon to exit. */
    mtx_sleep(ald_proc, &ald_mtx, PWAIT, "aldslp", 0);

    ALD_UNLOCK();
}
Beispiel #2
0
void
alq_destroy(struct alq *alq)
{
    /* Drain all pending IO. */
    alq_shutdown(alq);

    mtx_destroy(&alq->aq_mtx);
    bsd_free(alq->aq_entbuf, M_ALD);
    bsd_free(alq, M_ALD);
}
static void
ald_shutdown(void *arg, int howto)
{
	struct alq *alq;

	ALD_LOCK();
	ald_shutingdown = 1;

	while ((alq = LIST_FIRST(&ald_queues)) != NULL) {
		LIST_REMOVE(alq, aq_link);
		ALD_UNLOCK();
		alq_shutdown(alq);
		ALD_LOCK();
	}
	ALD_UNLOCK();
}
/*
 * Flush remaining data, close the file and free all resources.
 */
void
alq_close(struct alq *alq)
{
	/*
	 * If we're already shuting down someone else will flush and close
	 * the vnode.
	 */
	if (ald_rem(alq) != 0)
		return;

	/*
	 * Drain all pending IO.
	 */
	alq_shutdown(alq);

	mtx_destroy(&alq->aq_mtx);
	free(alq->aq_first, M_ALD);
	free(alq->aq_entbuf, M_ALD);
	free(alq, M_ALD);
}
Beispiel #5
0
/*
 * Flush remaining data, close the file and free all resources.
 */
void
alq_close(struct alq *alq)
{
	/*
	 * If we're already shuting down someone else will flush and close
	 * the vnode.
	 */
	if (ald_rem(alq) != 0)
		return;

	/*
	 * Drain all pending IO.
	 */
	alq_shutdown(alq);

	/* XXX drop module refcnt */

	kfree(alq->aq_first);
	kfree(alq->aq_entbuf);
	kfree(alq);
}