d->rttavg += n >> 2;
}
- diskstats(struct gendisk *disk, struct bio *bio, ulong duration)
+static struct aoetgt *
+gettgt(struct aoedev *d, char *addr)
+{
+ struct aoetgt **t, **e;
+
+ t = d->targets;
+ e = t + NTARGETS;
+ for (; t < e && *t; t++)
+ if (memcmp((*t)->addr, addr, sizeof((*t)->addr)) == 0)
+ return *t;
+ return NULL;
+}
+
+static inline void
- disk_stat_inc(disk, ios[rw]);
- disk_stat_add(disk, ticks[rw], duration);
- disk_stat_add(disk, sectors[rw], n_sect);
- disk_stat_add(disk, io_ticks, duration);
++diskstats(struct gendisk *disk, struct bio *bio, ulong duration, sector_t sector)
+{
+ unsigned long n_sect = bio->bi_size >> 9;
+ const int rw = bio_data_dir(bio);
+
++ all_stat_inc(disk, ios[rw], sector);
++ all_stat_add(disk, ticks[rw], duration, sector);
++ all_stat_add(disk, sectors[rw], n_sect, sector);
++ all_stat_add(disk, io_ticks, duration, sector);
+}
+
void
aoecmd_ata_rsp(struct sk_buff *skb)
{
}
}
- if (buf) {
- buf->nframesout -= 1;
- if (buf->nframesout == 0 && buf->resid == 0) {
- unsigned long duration = jiffies - buf->start_time;
- unsigned long n_sect = buf->bio->bi_size >> 9;
- struct gendisk *disk = d->gd;
- const int rw = bio_data_dir(buf->bio);
-
- all_stat_inc(disk, ios[rw], buf->sector);
- all_stat_add(disk, ticks[rw], duration, buf->sector);
- all_stat_add(disk, sectors[rw], n_sect, buf->sector);
- all_stat_add(disk, io_ticks, duration, buf->sector);
- n = (buf->flags & BUFFL_FAIL) ? -EIO : 0;
- bio_endio(buf->bio, n);
- mempool_free(buf, d->bufpool);
- }
+ if (buf && --buf->nframesout == 0 && buf->resid == 0) {
- diskstats(d->gd, buf->bio, jiffies - buf->stime);
++ diskstats(d->gd, buf->bio, jiffies - buf->stime, buf->sector);
+ n = (buf->flags & BUFFL_FAIL) ? -EIO : 0;
+ bio_endio(buf->bio, n);
+ mempool_free(buf, d->bufpool);
}
f->buf = NULL;