From 2b584959ed300ddff4acba0d7554becad5f274fd Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 10 Jul 2012 11:12:50 +0200 Subject: block: Geometry and translation hints are now useless, purge them There are two producers of these hints: drive_init() on behalf of -drive, and hd_geometry_guess(). The only consumer of the hint is hd_geometry_guess(). The callers of hd_geometry_guess() call it only when drive_init() didn't set the hints. Therefore, drive_init()'s hints are never used. Thus, hd_geometry_guess() only ever sees hints it produced itself in a prior call. Only the first call computes something, subsequent calls just repeat the first call's results. However, hd_geometry_guess() is never called more than once: the device models don't, and the block device is destroyed on unplug. Thus, dropping the repeat feature doesn't break anything now. If a block device wasn't destroyed on unplug and could be reused with a new device, then repeating old results would be wrong. Thus, dropping the repeat feature prevents future breakage. This renders the hints unused. Purge them from the block layer. Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- blockdev.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index 161985b1e5..06c997e864 100644 --- a/blockdev.c +++ b/blockdev.c @@ -7,8 +7,8 @@ * later. See the COPYING file in the top-level directory. */ -#include "block.h" #include "blockdev.h" +#include "hw/block-common.h" #include "monitor.h" #include "qerror.h" #include "qemu-option.h" @@ -551,17 +551,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) case IF_SCSI: case IF_XEN: case IF_NONE: - switch(media) { - case MEDIA_DISK: - if (cyls != 0) { - bdrv_set_geometry_hint(dinfo->bdrv, cyls, heads, secs); - bdrv_set_translation_hint(dinfo->bdrv, translation); - } - break; - case MEDIA_CDROM: - dinfo->media_cd = 1; - break; - } + dinfo->media_cd = media == MEDIA_CDROM; break; case IF_SD: case IF_FLOPPY: -- cgit v1.2.3