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