diff options
author | cperciva <cperciva@FreeBSD.org> | 2015-06-19 22:40:58 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2015-06-19 22:40:58 +0000 |
commit | 87997fdb5d90f3d2d16579b9fb8b3f6efd8f5fe0 (patch) | |
tree | 874960ee1201b87ef905202f9f60b6f2c477ff82 | |
parent | 200a3fb3721aaba084023572ebe9d53bff39946d (diff) | |
download | FreeBSD-src-87997fdb5d90f3d2d16579b9fb8b3f6efd8f5fe0.zip FreeBSD-src-87997fdb5d90f3d2d16579b9fb8b3f6efd8f5fe0.tar.gz |
Minor clean up to xbd_queue_cb:
* nsegs must be at most BLKIF_MAX_SEGMENTS_PER_REQUEST (since we specify
that limit to bus_dma_tag_create), so KASSERT that rather than silently
adjusting the request.
* block_segs is now a synonym for nsegs, so garbage collect that variable.
* nsegs is never read during or after the while loop, so remove the dead
decrement from the loop.
These were all left behind from the pre-r284296 support for a "segment
block" extension.
-rw-r--r-- | sys/dev/xen/blkfront/blkfront.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/xen/blkfront/blkfront.c b/sys/dev/xen/blkfront/blkfront.c index a71251d..eeb4fee 100644 --- a/sys/dev/xen/blkfront/blkfront.c +++ b/sys/dev/xen/blkfront/blkfront.c @@ -168,7 +168,6 @@ xbd_queue_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) uint64_t fsect, lsect; int ref; int op; - int block_segs; cm = arg; sc = cm->cm_sc; @@ -180,6 +179,9 @@ xbd_queue_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) return; } + KASSERT(nsegs <= BLKIF_MAX_SEGMENTS_PER_REQUEST, + ("Too many segments in a blkfront I/O")); + /* Fill out a communications ring structure. */ ring_req = RING_GET_REQUEST(&sc->xbd_ring, sc->xbd_ring.req_prod_pvt); sc->xbd_ring.req_prod_pvt++; @@ -190,9 +192,8 @@ xbd_queue_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) ring_req->nr_segments = nsegs; cm->cm_nseg = nsegs; - block_segs = MIN(nsegs, BLKIF_MAX_SEGMENTS_PER_REQUEST); sg = ring_req->seg; - last_block_sg = sg + block_segs; + last_block_sg = sg + nsegs; sg_ref = cm->cm_sg_refs; while (sg < last_block_sg) { @@ -227,7 +228,6 @@ xbd_queue_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) sg++; sg_ref++; segs++; - nsegs--; } if (cm->cm_operation == BLKIF_OP_READ) |