From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:46917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QReXa-0002GD-U7 for qemu-devel@nongnu.org; Wed, 01 Jun 2011 02:04:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QReXZ-0000Jm-O4 for qemu-devel@nongnu.org; Wed, 01 Jun 2011 02:04:26 -0400 Received: from mail-iw0-f173.google.com ([209.85.214.173]:57008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QReXZ-0000Jd-L7 for qemu-devel@nongnu.org; Wed, 01 Jun 2011 02:04:25 -0400 Received: by iwl42 with SMTP id 42so5742399iwl.4 for ; Tue, 31 May 2011 23:04:24 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Wei Liu Date: Wed, 1 Jun 2011 14:03:54 +0800 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] Question on virtio disk maximum index and maximum partition List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, Stefano Stabellini Stefano Stabellini CC'ed On Wed, Jun 1, 2011 at 12:56 PM, Stefan Hajnoczi wrote: > On Wed, Jun 1, 2011 at 2:06 AM, Wei Liu wrote: >> I'm programming for virtio disk support in Xen tool stack. I would >> like to know the limitation of virtio disk. > > I'm interested what you are implementing - a virtio-blk backend for > Xen (which would basically mean vhost-blk)? > No, I'm not implementing any backends. I am just writing patch for Xen's tool stack -- libxl. We are about to switch to upstream QEMU entirely. So the actual "backend" for virtio devices is QEMU. For disks to be added to virtual machines, we need to validate the disk before adding. For those Xen-specific disks supported by blkback, we have the checking conceptually like: int device_virtdisk_matches(const char *virtpath, const char *devtype, int *index_r, int max_index, int *partition_r, int max_partition) The max_index means "how many disks are supported by this controller" (to my understanding, correct me if I'm wrong). The max_partition means "the largest possible partition number supported by this device". So, for a IDE disk, we would invoke the function as: device_virtdisk_matches(virtpath, "hd", &disk, 3, &partition, 63) I was trying to apply the same checking for virtio disk, just don't know what parameters to be filled in for max_index and max_partition. >> That is, what's the maximum number of disks supported through virtio >> bus, and what's the maximum number of partitions supported per disk. > > virtio-blk as used by KVM is exposed as a virtio PCI adapter. There > is a 1:1 mapping between virtio-blk, PCI adapters, and block devices > being presented by QEMU: > > 1 virtio-blk device in guest == 1 virtio-pci adapter in guest == 1 > block device in QEMU > > The maximum number is really limited by the PCI bus, not virtio. In > terms of coding, you should try not to impose a hard limit at all. > > Partitions are not at the virtio-blk level. The guest operating > system will see the virtio-blk disk and scan its partition table to > determine which partitions are available. The limit then depends on > the partitioning scheme that you use (legacy boot record, GPT, etc). > That's exactly what I'm seeing... Maybe I should modify the checking and make a exception for virtio disk? Stefano, what would you say? >> If I'm posting to the wrong list, please point me the right direction. > > You might also be interested in > for general virtio > discussion. > Thanks. > Stefan > -- Best regards Wei Liu Twitter: @iliuw Site: http://liuw.name