]> git.baikalelectronics.ru Git - kernel.git/commit
virtio_blk: print capacity at probe time
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 3 Jan 2018 16:03:39 +0000 (16:03 +0000)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 1 Feb 2018 14:26:43 +0000 (16:26 +0200)
commitb4459779e551a648d4b5140a6d6cc557a9c6741f
treea20bf8cde132c8f256ad3b03b35f9d0cd8162cc6
parentecaad483d3a1648d8215acbf634b73e18a0bf6cd
virtio_blk: print capacity at probe time

Print the capacity of the block device when the driver is probed.  Many
users expect this since SCSI disks (sd) do it.  Moreover, kernel dmesg
output is the primary source of troubleshooting information so it's
helpful to include the disk size there.

The capacity is already printed by virtio_blk when a resize event
occurs.  Extract the code and reuse it from virtblk_probe().

This patch also adds the block device name to the message so it can be
correlated with a specific device:

  virtio_blk virtio0: [vda] 20971520 512-byte logical blocks (10.7 GB/10.0 GiB)

Cc: Rodrigo A B Freire <rfreire@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/block/virtio_blk.c