From owner-svn-src-projects@FreeBSD.ORG Tue Jan 29 07:36:33 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 13D6A8E7; Tue, 29 Jan 2013 07:36:33 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E0E2DD11; Tue, 29 Jan 2013 07:36:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0T7aWqK008001; Tue, 29 Jan 2013 07:36:32 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0T7aWM5007999; Tue, 29 Jan 2013 07:36:32 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201301290736.r0T7aWM5007999@svn.freebsd.org> From: Bryan Venteicher Date: Tue, 29 Jan 2013 07:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r246062 - projects/virtio/sys/dev/virtio/block X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2013 07:36:33 -0000 Author: bryanv Date: Tue Jan 29 07:36:32 2013 New Revision: 246062 URL: http://svnweb.freebsd.org/changeset/base/246062 Log: virtio_blk: Use topology to set the stripe size/offset Also do some minor header file cleanup. Approved by: grehan (implicit) Modified: projects/virtio/sys/dev/virtio/block/virtio_blk.c projects/virtio/sys/dev/virtio/block/virtio_blk.h Modified: projects/virtio/sys/dev/virtio/block/virtio_blk.c ============================================================================== --- projects/virtio/sys/dev/virtio/block/virtio_blk.c Tue Jan 29 07:35:25 2013 (r246061) +++ projects/virtio/sys/dev/virtio/block/virtio_blk.c Tue Jan 29 07:36:32 2013 (r246062) @@ -685,6 +685,13 @@ vtblk_alloc_disk(struct vtblk_softc *sc, dp->d_fwheads = blkcfg->geometry.heads; } + if (virtio_with_feature(dev, VIRTIO_BLK_F_TOPOLOGY)) { + dp->d_stripesize = dp->d_sectorsize * + (1 << blkcfg->topology.physical_block_exp); + dp->d_stripeoffset = dp->d_sectorsize * + blkcfg->topology.alignment_offset; + } + if (virtio_with_feature(dev, VIRTIO_BLK_F_FLUSH)) dp->d_flags |= DISKFLAG_CANFLUSHCACHE; } Modified: projects/virtio/sys/dev/virtio/block/virtio_blk.h ============================================================================== --- projects/virtio/sys/dev/virtio/block/virtio_blk.h Tue Jan 29 07:35:25 2013 (r246061) +++ projects/virtio/sys/dev/virtio/block/virtio_blk.h Tue Jan 29 07:36:32 2013 (r246062) @@ -51,15 +51,24 @@ struct virtio_blk_config { uint32_t size_max; /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ uint32_t seg_max; - /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */ + /* Geometry of the device (if VIRTIO_BLK_F_GEOMETRY) */ struct virtio_blk_geometry { uint16_t cylinders; uint8_t heads; uint8_t sectors; } geometry; - /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ + /* Block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ uint32_t blk_size; + + /* Topology of the device (if VIRTIO_BLK_F_TOPOLOGY) */ + struct virtio_blk_topology { + uint8_t physical_block_exp; + uint8_t alignment_offset; + uint16_t min_io_size; + uint16_t opt_io_size; + } topology; + } __packed; /*