Lines Matching refs:reqlist

327 	struct xbb_xen_reqlist  *reqlist;  member
488 struct xbb_xen_reqlist *reqlist, int operation,
836 xbb_reqlist_vaddr(struct xbb_xen_reqlist *reqlist, int pagenr, int sector) in xbb_reqlist_vaddr() argument
838 return (reqlist->kva + (PAGE_SIZE * pagenr) + (sector << 9)); in xbb_reqlist_vaddr()
858 xbb_reqlist_ioaddr(struct xbb_xen_reqlist *reqlist, int pagenr, int sector) in xbb_reqlist_ioaddr() argument
860 return (xbb_reqlist_vaddr(reqlist, pagenr, sector)); in xbb_reqlist_ioaddr()
881 xbb_get_gntaddr(struct xbb_xen_reqlist *reqlist, int pagenr, int sector) in xbb_get_gntaddr() argument
885 xbb = reqlist->xbb; in xbb_get_gntaddr()
888 (uintptr_t)(reqlist->kva - xbb->kva) + in xbb_get_gntaddr()
1009 xbb_unmap_reqlist(struct xbb_xen_reqlist *reqlist) in xbb_unmap_reqlist() argument
1017 for (i = 0; i < reqlist->nr_segments; i++) { in xbb_unmap_reqlist()
1018 if (reqlist->gnt_handles[i] == GRANT_REF_INVALID) in xbb_unmap_reqlist()
1021 unmap[invcount].host_addr = xbb_get_gntaddr(reqlist, i, 0); in xbb_unmap_reqlist()
1023 unmap[invcount].handle = reqlist->gnt_handles[i]; in xbb_unmap_reqlist()
1024 reqlist->gnt_handles[i] = GRANT_REF_INVALID; in xbb_unmap_reqlist()
1044 struct xbb_xen_reqlist *reqlist; in xbb_get_reqlist() local
1046 reqlist = NULL; in xbb_get_reqlist()
1050 if ((reqlist = STAILQ_FIRST(&xbb->reqlist_free_stailq)) != NULL) { in xbb_get_reqlist()
1052 reqlist->flags = XBB_REQLIST_NONE; in xbb_get_reqlist()
1053 reqlist->kva = NULL; in xbb_get_reqlist()
1054 reqlist->status = BLKIF_RSP_OKAY; in xbb_get_reqlist()
1055 reqlist->residual_512b_sectors = 0; in xbb_get_reqlist()
1056 reqlist->num_children = 0; in xbb_get_reqlist()
1057 reqlist->nr_segments = 0; in xbb_get_reqlist()
1058 STAILQ_INIT(&reqlist->contig_req_list); in xbb_get_reqlist()
1061 return (reqlist); in xbb_get_reqlist()
1073 xbb_release_reqlist(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, in xbb_release_reqlist() argument
1084 if (reqlist->kva != NULL) in xbb_release_reqlist()
1085 xbb_free_kva(xbb, reqlist->kva, reqlist->nr_segments); in xbb_release_reqlist()
1087 xbb_release_reqs(xbb, &reqlist->contig_req_list, reqlist->num_children); in xbb_release_reqlist()
1089 STAILQ_INSERT_TAIL(&xbb->reqlist_free_stailq, reqlist, links); in xbb_release_reqlist()
1116 xbb_get_resources(struct xbb_softc *xbb, struct xbb_xen_reqlist **reqlist, in xbb_get_resources() argument
1139 if (*reqlist == NULL) { in xbb_get_resources()
1152 if (*reqlist == NULL) { in xbb_get_resources()
1153 *reqlist = nreqlist; in xbb_get_resources()
1162 nreq->reqlist = *reqlist; in xbb_get_resources()
1176 STAILQ_INSERT_TAIL(&(*reqlist)->contig_req_list, nreq, links); in xbb_get_resources()
1177 (*reqlist)->num_children++; in xbb_get_resources()
1178 (*reqlist)->nr_segments += ring_req->nr_segments; in xbb_get_resources()
1314 xbb_complete_reqlist(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist) in xbb_complete_reqlist() argument
1322 if (reqlist->flags & XBB_REQLIST_MAPPED) in xbb_complete_reqlist()
1323 xbb_unmap_reqlist(reqlist); in xbb_complete_reqlist()
1336 STAILQ_FOREACH(nreq, &reqlist->contig_req_list, links) { in xbb_complete_reqlist()
1340 xbb_queue_response(xbb, nreq, reqlist->status); in xbb_complete_reqlist()
1343 if (reqlist->status == BLKIF_RSP_OKAY) in xbb_complete_reqlist()
1352 reqlist->ds_tag_type, in xbb_complete_reqlist()
1353 reqlist->ds_trans_type, in xbb_complete_reqlist()
1363 sectors_sent -= reqlist->residual_512b_sectors; in xbb_complete_reqlist()
1369 reqlist->ds_tag_type, in xbb_complete_reqlist()
1370 reqlist->ds_trans_type, in xbb_complete_reqlist()
1372 /*then*/&reqlist->ds_t0); in xbb_complete_reqlist()
1374 xbb_release_reqlist(xbb, reqlist, /*wakeup*/ 1); in xbb_complete_reqlist()
1398 struct xbb_xen_reqlist *reqlist; in xbb_bio_done() local
1400 reqlist = bio->bio_caller1; in xbb_bio_done()
1401 xbb = reqlist->xbb; in xbb_bio_done()
1403 reqlist->residual_512b_sectors += bio->bio_resid >> 9; in xbb_bio_done()
1424 reqlist->status = BLKIF_RSP_ERROR; in xbb_bio_done()
1441 if (atomic_fetchadd_int(&reqlist->pendcnt, -1) == 1) in xbb_bio_done()
1442 xbb_complete_reqlist(xbb, reqlist); in xbb_bio_done()
1462 xbb_dispatch_io(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist) in xbb_dispatch_io() argument
1478 reqlist->ds_tag_type = DEVSTAT_TAG_SIMPLE; in xbb_dispatch_io()
1488 reqlist->kva = NULL; in xbb_dispatch_io()
1489 if (reqlist->nr_segments != 0) { in xbb_dispatch_io()
1490 reqlist->kva = xbb_get_kva(xbb, reqlist->nr_segments); in xbb_dispatch_io()
1491 if (reqlist->kva == NULL) { in xbb_dispatch_io()
1499 binuptime(&reqlist->ds_t0); in xbb_dispatch_io()
1500 devstat_start_transaction(xbb->xbb_stats, &reqlist->ds_t0); in xbb_dispatch_io()
1502 switch (reqlist->operation) { in xbb_dispatch_io()
1505 reqlist->ds_tag_type = DEVSTAT_TAG_ORDERED; in xbb_dispatch_io()
1509 reqlist->ds_trans_type = DEVSTAT_WRITE; in xbb_dispatch_io()
1513 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1519 reqlist->ds_trans_type = DEVSTAT_READ; in xbb_dispatch_io()
1545 reqlist->ds_tag_type = DEVSTAT_TAG_ORDERED; in xbb_dispatch_io()
1546 reqlist->ds_trans_type = DEVSTAT_NO_DATA; in xbb_dispatch_io()
1551 reqlist->operation); in xbb_dispatch_io()
1552 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1556 reqlist->xbb = xbb; in xbb_dispatch_io()
1561 STAILQ_FOREACH(nreq, &reqlist->contig_req_list, links) { in xbb_dispatch_io()
1576 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1599 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1604 map->host_addr = xbb_get_gntaddr(reqlist, in xbb_dispatch_io()
1636 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1642 xbb->maps, reqlist->nr_segments); in xbb_dispatch_io()
1646 reqlist->flags |= XBB_REQLIST_MAPPED; in xbb_dispatch_io()
1648 for (seg_idx = 0, map = xbb->maps; seg_idx < reqlist->nr_segments; in xbb_dispatch_io()
1657 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1661 reqlist->gnt_handles[seg_idx] = map->handle; in xbb_dispatch_io()
1663 if (reqlist->starting_sector_number + total_sects > in xbb_dispatch_io()
1668 reqlist->starting_sector_number, in xbb_dispatch_io()
1669 reqlist->starting_sector_number + total_sects, in xbb_dispatch_io()
1671 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1678 reqlist, in xbb_dispatch_io()
1683 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_io()
1691 xbb_complete_reqlist(xbb, reqlist); in xbb_dispatch_io()
1733 struct xbb_xen_reqlist *reqlist; in xbb_run_queue() local
1757 reqlist = STAILQ_LAST(&xbb->reqlist_pending_stailq, in xbb_run_queue()
1759 if (reqlist != NULL) { in xbb_run_queue()
1760 cur_sector = reqlist->next_contig_sector; in xbb_run_queue()
1761 cur_operation = reqlist->operation; in xbb_run_queue()
1832 if ((reqlist != NULL) in xbb_run_queue()
1837 || ((ring_req->nr_segments + reqlist->nr_segments) > in xbb_run_queue()
1839 reqlist = NULL; in xbb_run_queue()
1848 retval = xbb_get_resources(xbb, &reqlist, ring_req, in xbb_run_queue()
1877 reqlist->next_contig_sector = cur_sector; in xbb_run_queue()
1882 reqlist = STAILQ_FIRST(&xbb->reqlist_pending_stailq); in xbb_run_queue()
1883 if (reqlist == NULL) { in xbb_run_queue()
1897 retval = xbb_dispatch_io(xbb, reqlist); in xbb_run_queue()
1907 reqlist, links); in xbb_run_queue()
1921 reqlist = STAILQ_FIRST(&xbb->reqlist_pending_stailq); in xbb_run_queue()
1923 if (reqlist != NULL) in xbb_run_queue()
1971 xbb_dispatch_dev(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, in xbb_dispatch_dev() argument
1986 bio_offset = (off_t)reqlist->starting_sector_number in xbb_dispatch_dev()
2006 bio->bio_caller1 = reqlist; in xbb_dispatch_dev()
2009 reqlist->pendcnt = 1; in xbb_dispatch_dev()
2021 nseg = reqlist->nr_segments; in xbb_dispatch_dev()
2063 bio->bio_data = xbb_reqlist_ioaddr(reqlist, seg_idx, in xbb_dispatch_dev()
2066 bio->bio_caller1 = reqlist; in xbb_dispatch_dev()
2091 reqlist->pendcnt = nbio; in xbb_dispatch_dev()
2136 xbb_dispatch_file(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, in xbb_dispatch_file() argument
2179 xuio.uio_offset = (vm_offset_t)reqlist->starting_sector_number in xbb_dispatch_file()
2185 nseg = reqlist->nr_segments; in xbb_dispatch_file()
2198 xiovec->iov_base = xbb_reqlist_ioaddr(reqlist, in xbb_dispatch_file()
2298 reqlist->status = BLKIF_RSP_ERROR; in xbb_dispatch_file()
2300 xbb_complete_reqlist(xbb, reqlist); in xbb_dispatch_file()
2667 struct xbb_xen_reqlist *reqlist; in xbb_disconnect() local
2671 for (i = 0, reqlist = xbb->request_lists; in xbb_disconnect()
2672 i < xbb->max_requests; i++, reqlist++){ in xbb_disconnect()
2673 if (reqlist->gnt_handles != NULL) { in xbb_disconnect()
2674 free(reqlist->gnt_handles, M_XENBLOCKBACK); in xbb_disconnect()
2675 reqlist->gnt_handles = NULL; in xbb_disconnect()
3027 struct xbb_xen_reqlist *reqlist; in xbb_alloc_request_lists() local
3047 reqlist = &xbb->request_lists[i]; in xbb_alloc_request_lists()
3049 reqlist->xbb = xbb; in xbb_alloc_request_lists()
3051 reqlist->gnt_handles = malloc(xbb->max_reqlist_segments * in xbb_alloc_request_lists()
3052 sizeof(*reqlist->gnt_handles), in xbb_alloc_request_lists()
3054 if (reqlist->gnt_handles == NULL) { in xbb_alloc_request_lists()
3062 reqlist->gnt_handles[seg] = GRANT_REF_INVALID; in xbb_alloc_request_lists()
3064 STAILQ_INSERT_TAIL(&xbb->reqlist_free_stailq, reqlist, links); in xbb_alloc_request_lists()