From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 3/3] xen-blkfront: Fix minor offset calculation for emulated IDE disks Date: Tue, 19 Jul 2011 09:22:59 -0400 Message-ID: <20110719132259.GA5191@dumpdata.com> References: <4E1EEEA1.9050102@canonical.com> <1310650247-7366-1-git-send-email-stefan.bader@canonical.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1310650247-7366-1-git-send-email-stefan.bader@canonical.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Stefan Bader Cc: xen-devel@lists.xensource.com, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Thu, Jul 14, 2011 at 03:30:47PM +0200, Stefan Bader wrote: > Before this a block device defined as hda1 in the configuration files > would be mapped to hda, as well as hda2. Pulled patch 1,2, and dropped this one. > > Signed-off-by: Stefan Bader > --- > 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@lists.xensource.com > http://lists.xensource.com/xen-devel