Date: Tue, 29 Jan 2013 07:36:32 +0000 (UTC) From: Bryan Venteicher <bryanv@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r246062 - projects/virtio/sys/dev/virtio/block Message-ID: <201301290736.r0T7aWM5007999@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301290736.r0T7aWM5007999>