WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH 3/3] xen-blkfront: Fix minor offset calculation f

To: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 3/3] xen-blkfront: Fix minor offset calculation for emulated IDE disks
From: Stefan Bader <stefan.bader@xxxxxxxxxxxxx>
Date: Fri, 15 Jul 2011 08:23:20 +0200
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 14 Jul 2011 23:24:01 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.1107141820070.12963@kaball-desktop>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4E1EEEA1.9050102@xxxxxxxxxxxxx> <1310650247-7366-1-git-send-email-stefan.bader@xxxxxxxxxxxxx> <alpine.DEB.2.00.1107141820070.12963@kaball-desktop>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b2 Thunderbird/3.1.10
On 14.07.2011 19:34, Stefano Stabellini wrote:
> On Thu, 14 Jul 2011, Stefan Bader wrote:
>> Before this a block device defined as hda1 in the configuration files
>> would be mapped to hda, as well as hda2.
>>
> 
> Don't you mean xvda and xvda2?
> 
Bah, yes, you are right. I had a "hda1" in a PVM guests definition and within
the guest it had become "xvda". Basically it seems that the current code would
map any minor number between 0-63 to 0.

> Besides hda1 doesn't mean anything for an HVM guest, it is not an
> allowed disk configuration.
> It is also a bug in the toolstack that propagates such nonsense to
> xenstore so I would rather fix xend and/or libxenlight.
>
Which seems actually to be something that could be intentional for HVM guests.
As you say, "hdaX" does make no sense there... Unfortunately this is shared for
PVM and HVM. So my change may make sense with the first but not the latter... :(

> 
>> Signed-off-by: Stefan Bader <stefan.bader@xxxxxxxxxxxxx>
>> ---
>>  drivers/block/xen-blkfront.c |   12 +++++++-----
>>  1 files changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
>> index 6e46edb..77489f1 100644
>> --- a/drivers/block/xen-blkfront.c
>> +++ b/drivers/block/xen-blkfront.c
>> @@ -449,15 +449,17 @@ static int xen_translate_vdev(int vdevice, int *minor, 
>> unsigned int *offset)
>>      major = BLKIF_MAJOR(vdevice);
>>      *minor = BLKIF_MINOR(vdevice);
>>      switch (major) {
>> +            /* For IDE the assumption seems to be 64 partitions (including
>> +             * the whole device) per disk. */
>>              case XEN_IDE0_MAJOR:
>>                      *offset = (*minor / 64) + EMULATED_HD_DISK_NAME_OFFSET;
>> -                    *minor = ((*minor / 64) * PARTS_PER_DISK) +
>> -                            EMULATED_HD_DISK_MINOR_OFFSET;
>> +                    *minor = *minor + EMULATED_HD_DISK_MINOR_OFFSET;
>>                      break;
>>              case XEN_IDE1_MAJOR:
>> -                    *offset = (*minor / 64) + 2 + 
>> EMULATED_HD_DISK_NAME_OFFSET;
>> -                    *minor = (((*minor / 64) + 2) * PARTS_PER_DISK) +
>> -                            EMULATED_HD_DISK_MINOR_OFFSET;
>> +                    *offset = (*minor / 64) + 2 +
>> +                              EMULATED_HD_DISK_NAME_OFFSET;
>> +                    *minor = *minor + (2 * 64) +
>> +                             EMULATED_HD_DISK_MINOR_OFFSET;
>>                      break;
>>              case XEN_SCSI_DISK0_MAJOR:
>>                      *offset = (*minor / PARTS_PER_DISK) + 
>> EMULATED_SD_DISK_NAME_OFFSET;
>> -- 
>> 1.7.4.1
>>


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>