From owner-svn-src-head@FreeBSD.ORG Fri Jun 19 22:40:59 2015 Return-Path: Delivered-To: svn-src-head@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7B935213; Fri, 19 Jun 2015 22:40:59 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FC24759; Fri, 19 Jun 2015 22:40:59 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5JMexGJ006166; Fri, 19 Jun 2015 22:40:59 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5JMexLw006165; Fri, 19 Jun 2015 22:40:59 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201506192240.t5JMexLw006165@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Fri, 19 Jun 2015 22:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284615 - head/sys/dev/xen/blkfront X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2015 22:40:59 -0000 Author: cperciva Date: Fri Jun 19 22:40:58 2015 New Revision: 284615 URL: https://svnweb.freebsd.org/changeset/base/284615 Log: 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. Modified: head/sys/dev/xen/blkfront/blkfront.c Modified: head/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- head/sys/dev/xen/blkfront/blkfront.c Fri Jun 19 22:24:58 2015 (r284614) +++ head/sys/dev/xen/blkfront/blkfront.c Fri Jun 19 22:40:58 2015 (r284615) @@ -168,7 +168,6 @@ xbd_queue_cb(void *arg, bus_dma_segment_ 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_ 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_ 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_ sg++; sg_ref++; segs++; - nsegs--; } if (cm->cm_operation == BLKIF_OP_READ)