Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346479
b: refs/heads/master
c: 3fc9b03
h: refs/heads/master
i:
  346477: 223db41
  346475: be35456
  346471: a14444f
  346463: 8639cda
v: v3
  • Loading branch information
Ed Cashin authored and Linus Torvalds committed Dec 18, 2012
1 parent 39c425b commit 900da9c
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5f0c9c48e7265039c3f945aaf44a1c6ae8adbd01
refs/heads/master: 3fc9b032489d365957ce531d32e225b2d0b3ed11
1 change: 1 addition & 0 deletions trunk/drivers/block/aoe/aoe.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ struct frame {
struct timeval sent; /* high-res time packet was sent */
u32 sent_jiffs; /* low-res jiffies-based sent time */
ulong waited;
ulong waited_total;
struct aoetgt *t; /* parent target I belong to */
sector_t lba;
struct sk_buff *skb; /* command skb freed on module exit */
Expand Down
75 changes: 53 additions & 22 deletions trunk/drivers/block/aoe/aoecmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ aoecmd_ata_rw(struct aoedev *d)
fhash(f);
t->nout++;
f->waited = 0;
f->waited_total = 0;
f->buf = buf;
f->bcnt = bcnt;
f->lba = buf->sector;
Expand Down Expand Up @@ -556,46 +557,69 @@ ejectif(struct aoetgt *t, struct aoeif *ifp)
dev_put(nd);
}

static struct frame *
reassign_frame(struct list_head *pos)
{
struct frame *f;
struct frame *nf;
struct sk_buff *skb;

f = list_entry(pos, struct frame, head);
nf = newframe(f->t->d);
if (!nf)
return NULL;

list_del(pos);

skb = nf->skb;
nf->skb = f->skb;
nf->buf = f->buf;
nf->bcnt = f->bcnt;
nf->lba = f->lba;
nf->bv = f->bv;
nf->bv_off = f->bv_off;
nf->waited = 0;
nf->waited_total = f->waited_total;
nf->sent = f->sent;
f->skb = skb;
aoe_freetframe(f);
f->t->nout--;
nf->t->nout++;

return nf;
}

static int
sthtith(struct aoedev *d)
{
struct frame *f, *nf;
struct list_head *nx, *pos, *head;
struct sk_buff *skb;
struct aoetgt *ht = d->htgt;
int i;

/* look through the active and pending retransmit frames */
for (i = 0; i < NFACTIVE; i++) {
head = &d->factive[i];
list_for_each_safe(pos, nx, head) {
f = list_entry(pos, struct frame, head);
if (f->t != ht)
continue;

nf = newframe(d);
nf = reassign_frame(pos);
if (!nf)
return 0;

/* remove frame from active list */
list_del(pos);

/* reassign all pertinent bits to new outbound frame */
skb = nf->skb;
nf->skb = f->skb;
nf->buf = f->buf;
nf->bcnt = f->bcnt;
nf->lba = f->lba;
nf->bv = f->bv;
nf->bv_off = f->bv_off;
nf->waited = 0;
nf->sent_jiffs = f->sent_jiffs;
f->skb = skb;
aoe_freetframe(f);
ht->nout--;
nf->t->nout++;
resend(d, nf);
}
}
head = &d->rexmitq;
list_for_each_safe(pos, nx, head) {
f = list_entry(pos, struct frame, head);
if (f->t != ht)
continue;
nf = reassign_frame(pos);
if (!nf)
return 0;
resend(d, nf);
}
/* We've cleaned up the outstanding so take away his
* interfaces so he won't be used. We should remove him from
* the target array here, but cleaning up a target is
Expand All @@ -612,6 +636,7 @@ rexmit_deferred(struct aoedev *d)
struct aoetgt *t;
struct frame *f;
struct list_head *pos, *nx, *head;
int since;

head = &d->rexmitq;
list_for_each_safe(pos, nx, head) {
Expand All @@ -621,6 +646,9 @@ rexmit_deferred(struct aoedev *d)
continue;
list_del(pos);
t->nout++;
since = tsince_hr(f);
f->waited += since;
f->waited_total += since;
resend(d, f);
}
}
Expand All @@ -637,6 +665,7 @@ rexmit_timer(ulong vp)
register long timeout;
ulong flags, n;
int i;
int since;

d = (struct aoedev *) vp;

Expand Down Expand Up @@ -669,7 +698,8 @@ rexmit_timer(ulong vp)
while (!list_empty(&flist)) {
pos = flist.next;
f = list_entry(pos, struct frame, head);
n = f->waited += tsince_hr(f);
since = tsince_hr(f);
n = f->waited_total + since;
n /= USEC_PER_SEC;
if (n > aoe_deadsecs) {
/* Waited too long. Device failure.
Expand Down Expand Up @@ -1301,6 +1331,7 @@ aoecmd_ata_id(struct aoedev *d)
fhash(f);
t->nout++;
f->waited = 0;
f->waited_total = 0;

/* set up ata header */
ah->scnt = 1;
Expand Down
32 changes: 21 additions & 11 deletions trunk/drivers/block/aoe/aoedev.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,30 +170,40 @@ aoe_failip(struct aoedev *d)
aoe_end_request(d, rq, 0);
}

static void
downdev_frame(struct list_head *pos)
{
struct frame *f;

f = list_entry(pos, struct frame, head);
list_del(pos);
if (f->buf) {
f->buf->nframesout--;
aoe_failbuf(f->t->d, f->buf);
}
aoe_freetframe(f);
}

void
aoedev_downdev(struct aoedev *d)
{
struct aoetgt *t, **tt, **te;
struct frame *f;
struct list_head *head, *pos, *nx;
struct request *rq;
int i;

d->flags &= ~DEVFL_UP;

/* clean out active buffers */
/* 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) {
f = list_entry(pos, struct frame, head);
list_del(pos);
if (f->buf) {
f->buf->nframesout--;
aoe_failbuf(d, f->buf);
}
aoe_freetframe(f);
}
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 + NTARGETS;
Expand Down

0 comments on commit 900da9c

Please sign in to comment.