Home | History | Annotate | Download | only in blktrace

Lines Matching refs:iop

1484 static int net_sendfile(struct io_info *iop)
1488 ret = sendfile(iop->ofd, iop->ifd, NULL, iop->ready);
1492 } else if (ret < (int)iop->ready) {
1494 ret, iop->ready);
1501 static inline int net_sendfile_data(struct tracer *tp, struct io_info *iop)
1503 struct devpath *dpp = iop->dpp;
1505 if (net_send_header(iop->ofd, tp->cpu, dpp->buts_name, iop->ready))
1507 return net_sendfile(iop);
1554 static int set_vbuf(struct io_info *iop, int mode, size_t size)
1556 iop->obuf = malloc(size);
1557 if (setvbuf(iop->ofp, iop->obuf, mode, size) < 0) {
1559 iop->dpp->path, (int)size, errno,
1561 free(iop->obuf);
1568 static int iop_open(struct io_info *iop, int cpu)
1572 iop->ofd = -1;
1574 struct cl_conn *nc = iop->nc;
1580 gmtime(&iop->dpp->cl_connect_time));
1585 if (fill_ofname(iop->ofn, sizeof(iop->ofn), hostdir,
1586 iop->dpp->buts_name, cpu))
1589 iop->ofp = my_fopen(iop->ofn, "w+");
1590 if (iop->ofp == NULL) {
1592 iop->ofn, errno, strerror(errno));
1596 if (set_vbuf(iop, _IOLBF, FILE_VBUF_SIZE)) {
1598 iop->ofn, errno, strerror(errno));
1599 fclose(iop->ofp);
1603 iop->ofd = fileno(iop->ofp);
1607 static void close_iop(struct io_info *iop)
1609 struct mmap_info *mip = &iop->mmap_info;
1615 if (ftruncate(fileno(iop->ofp), mip->fs_size) < 0) {
1618 iop->ofn, errno, strerror(errno));
1622 if (iop->ofp)
1623 fclose(iop->ofp);
1624 if (iop->obuf)
1625 free(iop->obuf);
1631 struct io_info *iop = &tp->ios[--tp->nios];
1633 iop->dpp->drops = get_drops(iop->dpp);
1634 if (iop->ifd >= 0)
1635 close(iop->ifd);
1637 if (iop->ofp)
1638 close_iop(iop);
1639 else if (iop->ofd >= 0) {
1640 struct devpath *dpp = iop->dpp;
1642 net_send_close(iop->ofd, dpp->buts_name, dpp->drops);
1643 net_close_connection(&iop->ofd);
1654 struct io_info *iop;
1664 iop = tp->ios;
1669 iop->dpp = dpp;
1670 iop->ofd = -1;
1671 snprintf(iop->ifn, sizeof(iop->ifn), "%s/block/%s/trace%d",
1674 iop->ifd = my_open(iop->ifn, O_RDONLY | O_NONBLOCK);
1675 if (iop->ifd < 0) {
1677 tp->cpu, iop->ifn, errno, strerror(errno));
1681 init_mmap_info(&iop->mmap_info);
1683 pfd->fd = iop->ifd;
1689 iop->ofd = net_setup_client();
1690 if (iop->ofd < 0)
1692 net_send_open(iop->ofd, tp->cpu, dpp->buts_name);
1694 if (iop_open(iop, tp->cpu))
1705 iop++;
1712 close(iop->ifd); /* tp->nios _not_ bumped */
1722 struct io_info *iop = tp->ios;
1724 for (i = 0; nevs > 0 && i < ndevs; i++, pfd++, iop++) {
1726 mip = &iop->mmap_info;
1728 ret = setup_mmap(iop->ofd, buf_size, mip, tp);
1734 ret = read(iop->ifd, mip->fs_buf + mip->fs_off,
1737 pdc_dr_update(iop->dpp, tp->cpu, ret);
1749 read_err(tp->cpu, iop->ifn);
1765 struct io_info *iop = tp->ios;
1767 for (i = 0; i < ndevs; i++, pfd++, iop++) {
1769 if (fstat(iop->ifd, &sb) < 0) {
1770 perror(iop->ifn);
1772 } else if (sb.st_size > (off_t)iop->data_queued) {
1773 iop->ready = sb.st_size - iop->data_queued;
1774 iop->data_queued = sb.st_size;
1776 if (!net_sendfile_data(tp, iop)) {
1777 pdc_dr_update(iop->dpp, tp->cpu,
1778 iop->ready);
1799 struct io_info *iop = tp->ios;
1802 for (i = 0; i < ndevs; i++, pfd++, iop++) {
1804 tbp->len = read(iop->ifd, tbp->buf, buf_size);
1806 pdc_dr_update(iop->dpp, tp->cpu, tbp->len);
1807 add_trace_buf(iop->dpp, tp->cpu, &tbp);
1817 read_err(tp->cpu, iop->ifn);
2343 struct io_info *iop;
2345 for (cpu = 0, iop = dpp->ios; cpu < ncpus; cpu++, iop++)
2346 close_iop(iop);
2403 struct io_info *iop;
2422 dpp->ios = calloc(nc->ncpus, sizeof(*iop));
2423 memset(dpp->ios, 0, ndevs * sizeof(*iop));
2425 for (cpu = 0, iop = dpp->ios; cpu < nc->ncpus; cpu++, iop++) {
2426 iop->dpp = dpp;
2427 iop->nc = nc;
2428 init_mmap_info(&iop->mmap_info);
2430 if (iop_open(iop, cpu))
2470 struct io_info *iop = &dpp->ios[bnh->cpu];
2471 struct mmap_info *mip = &iop->mmap_info;
2473 if (setup_mmap(iop->ofd, bnh->len, &iop->mmap_info, NULL)) {