virtio_blk: add block topology support
Allow reading various alignment values from the config page. This allows the guest to much better align I/O requests depending on the storage topology. Note that the formats for the config values appear a bit messed up, but we follow the formats used by ATA and SCSI so they are expected in the storage world. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Rusty Russell
parent
d57ed95da4
commit
69740c8ba8
@@ -15,6 +15,7 @@
|
||||
#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
|
||||
#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
|
||||
#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */
|
||||
#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */
|
||||
|
||||
struct virtio_blk_config {
|
||||
/* The capacity (in 512-byte sectors). */
|
||||
@@ -29,8 +30,20 @@ struct virtio_blk_config {
|
||||
__u8 heads;
|
||||
__u8 sectors;
|
||||
} geometry;
|
||||
|
||||
/* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
|
||||
__u32 blk_size;
|
||||
|
||||
/* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY */
|
||||
/* exponent for physical block per logical block. */
|
||||
__u8 physical_block_exp;
|
||||
/* alignment offset in logical blocks. */
|
||||
__u8 alignment_offset;
|
||||
/* minimum I/O size without performance penalty in logical blocks. */
|
||||
__u16 min_io_size;
|
||||
/* optimal sustained I/O size in logical blocks. */
|
||||
__u32 opt_io_size;
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user