• Home
  • Raw
  • Download

Lines Matching refs:iop

1439 static int net_sendfile(struct io_info *iop)  in net_sendfile()  argument
1443 ret = sendfile(iop->ofd, iop->ifd, NULL, iop->ready); in net_sendfile()
1447 } else if (ret < (int)iop->ready) { in net_sendfile()
1449 ret, iop->ready); in net_sendfile()
1456 static inline int net_sendfile_data(struct tracer *tp, struct io_info *iop) in net_sendfile_data() argument
1458 struct devpath *dpp = iop->dpp; in net_sendfile_data()
1460 if (net_send_header(iop->ofd, tp->cpu, dpp->buts_name, iop->ready)) in net_sendfile_data()
1462 return net_sendfile(iop); in net_sendfile_data()
1465 static int fill_ofname(struct io_info *iop, int cpu) in fill_ofname() argument
1469 char *dst = iop->ofn; in fill_ofname()
1472 len = snprintf(iop->ofn, sizeof(iop->ofn), "%s/", output_dir); in fill_ofname()
1474 len = snprintf(iop->ofn, sizeof(iop->ofn), "./"); in fill_ofname()
1477 struct cl_conn *nc = iop->nc; in fill_ofname()
1481 gmtime(&iop->dpp->cl_connect_time)); in fill_ofname()
1484 if (stat(iop->ofn, &sb) < 0) { in fill_ofname()
1488 iop->ofn, errno, strerror(errno)); in fill_ofname()
1496 if (mkdir(iop->ofn, 0755) < 0 && errno != EEXIST) { in fill_ofname()
1499 iop->ofn, errno, strerror(errno)); in fill_ofname()
1505 snprintf(iop->ofn + len, sizeof(iop->ofn), "%s.blktrace.%d", in fill_ofname()
1508 snprintf(iop->ofn + len, sizeof(iop->ofn), "%s.blktrace.%d", in fill_ofname()
1509 iop->dpp->buts_name, cpu); in fill_ofname()
1514 static int set_vbuf(struct io_info *iop, int mode, size_t size) in set_vbuf() argument
1516 iop->obuf = malloc(size); in set_vbuf()
1517 if (setvbuf(iop->ofp, iop->obuf, mode, size) < 0) { in set_vbuf()
1519 iop->dpp->path, (int)size, errno, in set_vbuf()
1521 free(iop->obuf); in set_vbuf()
1528 static int iop_open(struct io_info *iop, int cpu) in iop_open() argument
1530 iop->ofd = -1; in iop_open()
1531 if (fill_ofname(iop, cpu)) in iop_open()
1534 iop->ofp = my_fopen(iop->ofn, "w+"); in iop_open()
1535 if (iop->ofp == NULL) { in iop_open()
1537 iop->ofn, errno, strerror(errno)); in iop_open()
1541 if (set_vbuf(iop, _IOLBF, FILE_VBUF_SIZE)) { in iop_open()
1543 iop->ofn, errno, strerror(errno)); in iop_open()
1544 fclose(iop->ofp); in iop_open()
1548 iop->ofd = fileno(iop->ofp); in iop_open()
1552 static void close_iop(struct io_info *iop) in close_iop() argument
1554 struct mmap_info *mip = &iop->mmap_info; in close_iop()
1560 if (ftruncate(fileno(iop->ofp), mip->fs_size) < 0) { in close_iop()
1563 iop->ofn, errno, strerror(errno)); in close_iop()
1567 if (iop->ofp) in close_iop()
1568 fclose(iop->ofp); in close_iop()
1569 if (iop->obuf) in close_iop()
1570 free(iop->obuf); in close_iop()
1576 struct io_info *iop = &tp->ios[--tp->nios]; in close_ios() local
1578 iop->dpp->drops = get_drops(iop->dpp); in close_ios()
1579 if (iop->ifd >= 0) in close_ios()
1580 close(iop->ifd); in close_ios()
1582 if (iop->ofp) in close_ios()
1583 close_iop(iop); in close_ios()
1584 else if (iop->ofd >= 0) { in close_ios()
1585 struct devpath *dpp = iop->dpp; in close_ios()
1587 net_send_close(iop->ofd, dpp->buts_name, dpp->drops); in close_ios()
1588 net_close_connection(&iop->ofd); in close_ios()
1599 struct io_info *iop; in open_ios() local
1609 iop = tp->ios; in open_ios()
1614 iop->dpp = dpp; in open_ios()
1615 iop->ofd = -1; in open_ios()
1616 snprintf(iop->ifn, sizeof(iop->ifn), "%s/block/%s/trace%d", in open_ios()
1619 iop->ifd = my_open(iop->ifn, O_RDONLY | O_NONBLOCK); in open_ios()
1620 if (iop->ifd < 0) { in open_ios()
1622 tp->cpu, iop->ifn, errno, strerror(errno)); in open_ios()
1626 init_mmap_info(&iop->mmap_info); in open_ios()
1628 pfd->fd = iop->ifd; in open_ios()
1634 iop->ofd = net_setup_client(); in open_ios()
1635 if (iop->ofd < 0) in open_ios()
1637 net_send_open(iop->ofd, tp->cpu, dpp->buts_name); in open_ios()
1639 if (iop_open(iop, tp->cpu)) in open_ios()
1650 iop++; in open_ios()
1657 close(iop->ifd); /* tp->nios _not_ bumped */ in open_ios()
1667 struct io_info *iop = tp->ios; in handle_pfds_file() local
1669 for (i = 0; nevs > 0 && i < ndevs; i++, pfd++, iop++) { in handle_pfds_file()
1671 mip = &iop->mmap_info; in handle_pfds_file()
1673 ret = setup_mmap(iop->ofd, buf_size, mip); in handle_pfds_file()
1679 ret = read(iop->ifd, mip->fs_buf + mip->fs_off, in handle_pfds_file()
1682 pdc_dr_update(iop->dpp, tp->cpu, ret); in handle_pfds_file()
1694 read_err(tp->cpu, iop->ifn); in handle_pfds_file()
1711 struct io_info *iop = tp->ios; in handle_pfds_netclient() local
1713 for (i = 0; i < ndevs; i++, pfd++, iop++, sp++) { in handle_pfds_netclient()
1715 if (fstat(iop->ifd, &sb) < 0) { in handle_pfds_netclient()
1716 perror(iop->ifn); in handle_pfds_netclient()
1718 } else if (sb.st_size > (off_t)iop->data_queued) { in handle_pfds_netclient()
1719 iop->ready = sb.st_size - iop->data_queued; in handle_pfds_netclient()
1720 iop->data_queued = sb.st_size; in handle_pfds_netclient()
1722 if (!net_sendfile_data(tp, iop)) { in handle_pfds_netclient()
1723 pdc_dr_update(iop->dpp, tp->cpu, in handle_pfds_netclient()
1724 iop->ready); in handle_pfds_netclient()
1745 struct io_info *iop = tp->ios; in handle_pfds_entries() local
1748 for (i = 0; i < ndevs; i++, pfd++, iop++) { in handle_pfds_entries()
1750 tbp->len = read(iop->ifd, tbp->buf, buf_size); in handle_pfds_entries()
1752 pdc_dr_update(iop->dpp, tp->cpu, tbp->len); in handle_pfds_entries()
1753 add_trace_buf(iop->dpp, tp->cpu, &tbp); in handle_pfds_entries()
1763 read_err(tp->cpu, iop->ifn); in handle_pfds_entries()
2241 struct io_info *iop; in device_done() local
2243 for (cpu = 0, iop = dpp->ios; cpu < ncpus; cpu++, iop++) in device_done()
2244 close_iop(iop); in device_done()
2301 struct io_info *iop; in nc_add_dpp() local
2320 dpp->ios = calloc(nc->ncpus, sizeof(*iop)); in nc_add_dpp()
2321 memset(dpp->ios, 0, ndevs * sizeof(*iop)); in nc_add_dpp()
2323 for (cpu = 0, iop = dpp->ios; cpu < nc->ncpus; cpu++, iop++) { in nc_add_dpp()
2324 iop->dpp = dpp; in nc_add_dpp()
2325 iop->nc = nc; in nc_add_dpp()
2326 init_mmap_info(&iop->mmap_info); in nc_add_dpp()
2328 if (iop_open(iop, cpu)) in nc_add_dpp()
2368 struct io_info *iop = &dpp->ios[bnh->cpu]; in net_client_read_data() local
2369 struct mmap_info *mip = &iop->mmap_info; in net_client_read_data()
2371 if (setup_mmap(iop->ofd, bnh->len, &iop->mmap_info)) { in net_client_read_data()