- }
- /* Check status and move request to flush_queue */
- switch (cqr->status) {
- case DASD_CQR_IN_IO:
- rc = device->discipline->term_IO(cqr);
- if (rc) {
- /* unable to terminate requeust */
- DEV_MESSAGE(KERN_ERR, device,
- "dasd flush ccw_queue is unable "
- " to terminate request %p",
- cqr);
- /* stop flush processing */
- goto finished;
- }
- break;
- case DASD_CQR_QUEUED:
- case DASD_CQR_ERROR:
- /* set request to FAILED */
- cqr->stopclk = get_clock();
- cqr->status = DASD_CQR_FAILED;
- break;
- default: /* do not touch the others */
- break;
- }
- /* Rechain request (including erp chain) */
- for (i = 0; cqr != NULL; cqr = cqr->refers, i++) {
- cqr->endclk = get_clock();
- list_move_tail(&cqr->list, &flush_queue);
- }
- if (i > 1)
- /* moved more than one request - need to restart */
- goto restart;
- }
-
-finished:
- spin_unlock_irq(get_ccwdev_lock(device->cdev));
- /* Now call the callback function of flushed requests */
-restart_cb:
- list_for_each_entry_safe(cqr, n, &flush_queue, list) {
- if (cqr->status == DASD_CQR_CLEAR) {
- /* wait for clear interrupt! */
- wait_event(dasd_flush_wq, _wait_for_clear(cqr));
+ if (cqr->status == DASD_CQR_IN_IO)
+ device->discipline->term_IO(cqr);
+ if (cqr->status != DASD_CQR_DONE ||
+ cqr->status != DASD_CQR_FAILED) {