Example #1
0
static void kaio_complete_io_state(struct ploop_request * preq)
{
    struct ploop_device * plo   = preq->plo;
    unsigned long flags;
    int post_fsync = 0;

    if (preq->error || !(preq->req_rw & REQ_FUA) ||
            preq->eng_state == PLOOP_E_INDEX_READ ||
            preq->eng_state == PLOOP_E_TRANS_INDEX_READ ||
            preq->eng_state == PLOOP_E_DELTA_READ ||
            preq->eng_state == PLOOP_E_TRANS_DELTA_READ) {
        ploop_complete_io_state(preq);
        return;
    }

    preq->req_rw &= ~REQ_FUA;

    /* Convert requested fua to fsync */
    if (test_and_clear_bit(PLOOP_REQ_FORCE_FUA, &preq->state) ||
            test_and_clear_bit(PLOOP_REQ_KAIO_FSYNC, &preq->state))
        post_fsync = 1;

    if (!post_fsync &&
            !ploop_req_delay_fua_possible(preq->req_rw, preq) &&
            (preq->req_rw & REQ_FUA))
        post_fsync = 1;

    preq->req_rw &= ~REQ_FUA;

    if (post_fsync) {
        spin_lock_irqsave(&plo->lock, flags);
        kaio_queue_fsync_req(preq);
        plo->st.bio_syncwait++;
        spin_unlock_irqrestore(&plo->lock, flags);
    } else {
        ploop_complete_io_state(preq);
    }
}
Example #2
0
static void kaio_complete_io_state(struct ploop_request * preq)
{
	struct ploop_device * plo   = preq->plo;
	unsigned long flags;

	if (preq->error || !(preq->req_rw & BIO_FUA) ||
	    preq->eng_state == PLOOP_E_INDEX_READ ||
	    preq->eng_state == PLOOP_E_TRANS_INDEX_READ ||
	    preq->eng_state == PLOOP_E_DELTA_READ ||
	    preq->eng_state == PLOOP_E_TRANS_DELTA_READ) {
		ploop_complete_io_state(preq);
		return;
	}

	preq->req_rw &= ~BIO_FUA;

	spin_lock_irqsave(&plo->lock, flags);
	kaio_queue_fsync_req(preq);
	plo->st.bio_syncwait++;
	spin_unlock_irqrestore(&plo->lock, flags);
}