void aoedev_downdev(struct aoedev *d) { struct aoetgt *t, **tt, **te; struct list_head *head, *pos, *nx; struct request *rq; int i; d->flags &= ~DEVFL_UP; /* clean out active and to-be-retransmitted buffers */ for (i = 0; i < NFACTIVE; i++) { head = &d->factive[i]; list_for_each_safe(pos, nx, head) downdev_frame(pos); } head = &d->rexmitq; list_for_each_safe(pos, nx, head) downdev_frame(pos); /* reset window dressings */ tt = d->targets; te = tt + d->ntargets; for (; tt < te && (t = *tt); tt++) { aoecmd_wreset(t); t->nout = 0; } /* clean out the in-process request (if any) */ aoe_failip(d); /* fast fail all pending I/O */ if (d->blkq) { while ((rq = blk_peek_request(d->blkq))) { blk_start_request(rq); aoe_end_request(d, rq, 1); } } if (d->gd) set_capacity(d->gd, 0); }
static void aoeblk_request(struct request_queue *q) { struct aoedev *d; struct request *rq; d = q->queuedata; if ((d->flags & DEVFL_UP) == 0) { printk(KERN_INFO "aoe: device %ld.%d is not up\n", d->aoemajor, d->aoeminor); while ((rq = blk_peek_request(q))) { blk_start_request(rq); aoe_end_request(d, rq, 1); } return; } aoecmd_work(d); return; }
static void aoe_failip(struct aoedev *d) { struct request *rq; struct bio *bio; unsigned long n; aoe_failbuf(d, d->ip.buf); rq = d->ip.rq; if (rq == NULL) return; while ((bio = d->ip.nxbio)) { clear_bit(BIO_UPTODATE, &bio->bi_flags); d->ip.nxbio = bio->bi_next; n = (unsigned long) rq->special; rq->special = (void *) --n; } if ((unsigned long) rq->special == 0) aoe_end_request(d, rq, 0); }