Adding Christoph to CC who know much more then me about how block layer works in qemu and linux.
On Sun, May 16, 2010 at 11:17:42AM -0400, Kevin O'Connor wrote:
On Sun, May 16, 2010 at 11:08:57AM +0300, Gleb Natapov wrote:
On Sat, May 15, 2010 at 05:17:31PM +0200, Sebastian Herbszt wrote:
What the BIOS should do or not doesn't seem to be defined anywhere (yet). Current drives with physical sector size > 512 bytes report a logical sector size of 512 bytes and do the emulation on their own. The BIOS doesn't need to be modified so far to support those drives. If drives with logical sector size > 512 bytes appear this situation might change. Doing a read emulation
Isn't it chicken n' egg situation. If BIOSes will not add 4K block support drives will never be able to use 4K logical blocks.
It was my understanding that new drives will start up in an emulation mode which uses 512 byte sectors. Later on the OS can activate the native sector size.
I am not sure disk can change its topology like that. The meaning of LBA will change depending on what mode the disk is currently in.
This also raises a possibility for virtio - maybe a new command or flag could be added to temporarily support 512 byte reads. Thus the main OS wont be penalized, and the bios wont have to emulate the reads (the host will do it instead). That said, I'm not against a patch which generalizes the SeaBIOS cdemu block conversion code for virtio if you wish to do that. (It will reserve more memory, but I doubt anyone using virtio will care.)
As far as I understand if physical disk qemu image resides on has 4K logical block size we cannot access it from inside a guest using 512 byte i/o (disk image is opened with O_DIRECT and each i/o has to be sector size aligned). So even if theoretically emulating 512 byte access on top of 4K physical disk sector size inside virtio-blk in qemu is possible it looks more complicated then just switching logical block size during VM runtime. Christoph what do you think?
-- Gleb.