diff options
| author | Mateusz Guzik <mjg@FreeBSD.org> | 2020-09-01 21:45:08 +0000 |
|---|---|---|
| committer | Mateusz Guzik <mjg@FreeBSD.org> | 2020-09-01 21:45:08 +0000 |
| commit | 6c7cae4a73b883ec0410e882bb56622c3090592c (patch) | |
| tree | fcbe350f4b410e8a551e330576053454e79c4ddf /sys/dev/xen/blkback | |
| parent | 6831ac28dcecc6015d61098c8173261bfbdba280 (diff) | |
Notes
Diffstat (limited to 'sys/dev/xen/blkback')
| -rw-r--r-- | sys/dev/xen/blkback/blkback.c | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/sys/dev/xen/blkback/blkback.c b/sys/dev/xen/blkback/blkback.c index bbb2b04f3d73..db73bb315cd4 100644 --- a/sys/dev/xen/blkback/blkback.c +++ b/sys/dev/xen/blkback/blkback.c @@ -256,7 +256,6 @@ struct xbb_xen_reqlist { */ uint64_t gnt_base; - #ifdef XBB_USE_BOUNCE_BUFFERS /** * Pre-allocated domain local memory used to proxy remote @@ -545,7 +544,6 @@ typedef int (*xbb_dispatch_t)(struct xbb_softc *xbb, * Per-instance configuration data. */ struct xbb_softc { - /** * Task-queue used to process I/O requests. */ @@ -1029,7 +1027,6 @@ xbb_get_kva(struct xbb_softc *xbb, int nr_pages) * to satisfy the request. */ if (++num_clear == nr_pages) { - bit_nset(xbb->kva_free, first_clear, first_clear + nr_pages - 1); @@ -1093,7 +1090,6 @@ xbb_unmap_reqlist(struct xbb_xen_reqlist *reqlist) invcount = 0; for (i = 0; i < reqlist->nr_segments; i++) { - if (reqlist->gnt_handles[i] == GRANT_REF_INVALID) continue; @@ -1127,7 +1123,6 @@ xbb_get_reqlist(struct xbb_softc *xbb) mtx_assert(&xbb->lock, MA_OWNED); if ((reqlist = STAILQ_FIRST(&xbb->reqlist_free_stailq)) != NULL) { - STAILQ_REMOVE_HEAD(&xbb->reqlist_free_stailq, links); reqlist->flags = XBB_REQLIST_NONE; reqlist->kva = NULL; @@ -1366,7 +1361,6 @@ xbb_push_responses(struct xbb_softc *xbb, int *run_taskqueue, int *notify) RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&xbb->rings.common, *notify); if (xbb->rings.common.rsp_prod_pvt == xbb->rings.common.req_cons) { - /* * Tail check for pending requests. Allows frontend to avoid * notifications if requests are already in flight (lower @@ -1374,7 +1368,6 @@ xbb_push_responses(struct xbb_softc *xbb, int *run_taskqueue, int *notify) */ RING_FINAL_CHECK_FOR_REQUESTS(&xbb->rings.common, more_to_do); } else if (RING_HAS_UNCONSUMED_REQUESTS(&xbb->rings.common)) { - more_to_do = 1; } @@ -1505,7 +1498,6 @@ xbb_bio_done(struct bio *bio) if (bio->bio_error == ENXIO && xenbus_get_state(xbb->dev) == XenbusStateConnected) { - /* * Backend device has disappeared. Signal the * front-end that we (the device proxy) want to @@ -1744,7 +1736,6 @@ xbb_dispatch_io(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist) for (seg_idx = 0, map = xbb->maps; seg_idx < reqlist->nr_segments; seg_idx++, map++){ - if (__predict_false(map->status != 0)) { DPRINTF("invalid buffer -- could not remap " "it (%d)\n", map->status); @@ -1760,7 +1751,6 @@ xbb_dispatch_io(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist) } if (reqlist->starting_sector_number + total_sects > xbb->media_num_sectors) { - DPRINTF("%s of [%" PRIu64 ",%" PRIu64 "] " "extends past end of device %s\n", operation == BIO_READ ? "read" : "write", @@ -1831,7 +1821,6 @@ xbb_run_queue(void *context, int pending) int cur_operation; struct xbb_xen_reqlist *reqlist; - xbb = (struct xbb_softc *)context; rings = &xbb->rings; @@ -2121,7 +2110,6 @@ xbb_dispatch_dev(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, nseg = reqlist->nr_segments; for (seg_idx = 0; seg_idx < nseg; seg_idx++, xbb_sg++) { - /* * KVA will not be contiguous, so any additional * I/O will need to be represented in a new bio. @@ -2173,7 +2161,6 @@ xbb_dispatch_dev(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, bio_offset += xbb_sg->nsect << 9; if (xbb_sg->last_sect != (PAGE_SIZE - 512) >> 9) { - if ((bio->bio_length & (xbb->sector_size - 1)) != 0) { printf("%s: Discontiguous I/O request " "from domain %d ends on " @@ -2224,7 +2211,7 @@ xbb_dispatch_dev(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, fail_free_bios: for (bio_idx = 0; bio_idx < (nbio-1); bio_idx++) g_destroy_bio(bios[bio_idx]); - + return (error); } @@ -2302,7 +2289,6 @@ xbb_dispatch_file(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, nseg = reqlist->nr_segments; for (xiovec = NULL, seg_idx = 0; seg_idx < nseg; seg_idx++, xbb_sg++) { - /* * If the first sector is not 0, the KVA will * not be contiguous and we'll need to go on @@ -2354,7 +2340,6 @@ xbb_dispatch_file(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, for (seg_idx = 0, p_vaddr = file_data->xiovecs_vaddr, xiovec = xuio.uio_iov; seg_idx < xuio.uio_iovcnt; seg_idx++, xiovec++, p_vaddr++) { - memcpy(xiovec->iov_base, *p_vaddr, xiovec->iov_len); } } else { @@ -2448,12 +2433,10 @@ xbb_dispatch_file(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, #ifdef XBB_USE_BOUNCE_BUFFERS /* We only need to copy here for read operations */ if (operation == BIO_READ) { - for (seg_idx = 0, p_vaddr = file_data->xiovecs_vaddr, xiovec = file_data->saved_xiovecs; seg_idx < saved_uio_iovcnt; seg_idx++, xiovec++, p_vaddr++) { - /* * Note that we have to use the copy of the * io vector we made above. uiomove() modifies @@ -2563,7 +2546,6 @@ xbb_open_dev(struct xbb_softc *xbb) return (error); } - dev = xbb->vn->v_rdev; devsw = dev->si_devsw; if (!devsw->d_ioctl) { @@ -2814,11 +2796,10 @@ xbb_disconnect(struct xbb_softc *xbb) */ if (xbb->active_request_count != 0) return (EAGAIN); - + for (ring_idx = 0, op = ops; ring_idx < xbb->ring_config.ring_pages; ring_idx++, op++) { - op->host_addr = xbb->ring_config.gnt_addr + (ring_idx * PAGE_SIZE); op->dev_bus_addr = xbb->ring_config.bus_addr[ring_idx]; @@ -2895,7 +2876,6 @@ xbb_connect_ring(struct xbb_softc *xbb) for (ring_idx = 0, gnt = gnts; ring_idx < xbb->ring_config.ring_pages; ring_idx++, gnt++) { - gnt->host_addr = xbb->ring_config.gnt_addr + (ring_idx * PAGE_SIZE); gnt->flags = GNTMAP_host_map; @@ -3138,13 +3118,10 @@ xbb_collect_frontend_info(struct xbb_softc *xbb) */ xbb->abi = BLKIF_PROTOCOL_NATIVE; } else if (!strcmp(protocol_abi, XEN_IO_PROTO_ABI_X86_32)) { - xbb->abi = BLKIF_PROTOCOL_X86_32; } else if (!strcmp(protocol_abi, XEN_IO_PROTO_ABI_X86_64)) { - xbb->abi = BLKIF_PROTOCOL_X86_64; } else { - xenbus_dev_fatal(xbb->dev, EINVAL, "Unknown protocol ABI (%s) published by " "frontend. Unable to connect.", protocol_abi); @@ -3361,7 +3338,7 @@ xbb_connect(struct xbb_softc *xbb) /* Specific errors are reported by xbb_connect_ring(). */ return; } - + if (xbb_publish_backend_info(xbb) != 0) { /* * If we can't publish our data, we cannot participate @@ -3496,7 +3473,7 @@ xbb_attach_failed(struct xbb_softc *xbb, int err, const char *fmt, ...) static int xbb_probe(device_t dev) { - + if (!strcmp(xenbus_get_type(dev), "vbd")) { device_set_desc(dev, "Backend Virtual Block Device"); device_quiet(dev); @@ -3517,7 +3494,7 @@ xbb_setup_sysctl(struct xbb_softc *xbb) { struct sysctl_ctx_list *sysctl_ctx = NULL; struct sysctl_oid *sysctl_tree = NULL; - + sysctl_ctx = device_get_sysctl_ctx(xbb->dev); if (sysctl_ctx == NULL) return; @@ -3930,7 +3907,6 @@ static device_method_t xbb_methods[] = { /* Xenbus interface */ DEVMETHOD(xenbus_otherend_changed, xbb_frontend_changed), - { 0, 0 } }; |
