Beispiel #1
0
void
alq_flush(struct alq *alq)
{
    int needwakeup = 0;

    ALD_LOCK();
    ALQ_LOCK(alq);

    /*
     * Pull the lever iff there is data to flush and we're
     * not already in the middle of a flush operation.
     */
    if (HAS_PENDING_DATA(alq) && !(alq->aq_flags & AQ_FLUSHING)) {
        if (alq->aq_flags & AQ_ACTIVE)
            ald_deactivate(alq);

        ALD_UNLOCK();
        needwakeup = alq_doio(alq);
    } else
        ALD_UNLOCK();

    ALQ_UNLOCK(alq);

    if (needwakeup)
        wakeup_one(alq);
}
Beispiel #2
0
static int
ald_daemon(void *arg)
{
	int needwakeup;
	struct alq *alq;

	daemonize("ALQ Daemon");
	allow_signal(SIGKILL);

	ALD_LOCK();

	for (;;) {
		if ((alq = LIST_FIRST(&ald_active)) == NULL)
			ALD_WAIT((alq = LIST_FIRST(&ald_active)) != NULL);

		if (signal_pending(current))
			break;

		spin_lock_irq(&alq->aq_lock);
		ald_deactivate(alq);
		ALD_UNLOCK();
		needwakeup = alq_doio(alq);
		spin_unlock_irq(&alq->aq_lock);
		if (needwakeup)
			wake_up_interruptible(&alq->aq_waitq);
		ALD_LOCK();
	}

	ALD_UNLOCK();

	return 0;
}
static void
ald_daemon(void)
{
	int needwakeup;
	struct alq *alq;

	ald_thread = FIRST_THREAD_IN_PROC(ald_proc);

	EVENTHANDLER_REGISTER(shutdown_pre_sync, ald_shutdown, NULL,
	    SHUTDOWN_PRI_FIRST);

	ALD_LOCK();

	for (;;) {
		while ((alq = LIST_FIRST(&ald_active)) == NULL)
			msleep(&ald_active, &ald_mtx, PWAIT, "aldslp", 0);

		ALQ_LOCK(alq);
		ald_deactivate(alq);
		ALD_UNLOCK();
		needwakeup = alq_doio(alq);
		ALQ_UNLOCK(alq);
		if (needwakeup)
			wakeup(alq);
		ALD_LOCK();
	}
}
Beispiel #4
0
void
alq_flush(struct alq *alq)
{
	int needwakeup = 0;

	ALD_LOCK();
	spin_lock_irq(&alq->aq_lock);
	if (alq->aq_flags & AQ_ACTIVE) {
		ald_deactivate(alq);
		ALD_UNLOCK();
		needwakeup = alq_doio(alq);
	} else
		ALD_UNLOCK();
	spin_unlock_irq(&alq->aq_lock);

	if (needwakeup)
		wake_up_interruptible(&alq->aq_waitq);
}
void
alq_flush(struct alq *alq)
{
	int needwakeup = 0;

	ALD_LOCK();
	ALQ_LOCK(alq);
	if (alq->aq_flags & AQ_ACTIVE) {
		ald_deactivate(alq);
		ALD_UNLOCK();
		needwakeup = alq_doio(alq);
	} else
		ALD_UNLOCK();
	ALQ_UNLOCK(alq);

	if (needwakeup)
		wakeup(alq);
}
Beispiel #6
0
static void
ald_daemon(void)
{
    int needwakeup;
    struct alq *alq;

    ald_thread = FIRST_THREAD_IN_PROC(ald_proc);

    alq_eventhandler_tag = EVENTHANDLER_REGISTER(shutdown_pre_sync,
                           ald_shutdown, NULL, SHUTDOWN_PRI_FIRST);

    ALD_LOCK();

    for (;;) {
        while ((alq = BSD_LIST_FIRST(&ald_active)) == NULL &&
                !ald_shutingdown)
            mtx_sleep(&ald_active, &ald_mtx, PWAIT, "aldslp", 0);

        /* Don't shutdown until all active ALQs are flushed. */
        if (ald_shutingdown && alq == NULL) {
            ALD_UNLOCK();
            break;
        }

        ALQ_LOCK(alq);
        ald_deactivate(alq);
        ALD_UNLOCK();
        needwakeup = alq_doio(alq);
        ALQ_UNLOCK(alq);
        if (needwakeup)
            wakeup_one(alq);
        ALD_LOCK();
    }

    kproc_exit(0);
}