From: Chris Lalancette <clalance@redhat.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH 3/3]: Blkfront greater than 16 vbd fixes
Date: Wed, 09 Jul 2008 02:26:09 +0200 [thread overview]
Message-ID: <487405A1.3020306@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 508 bytes --]
While reading through the code again, I realized that if you did something like:
block-attach xvdb
block-attach xvdq
block-attach xvdc
The extended blkfront code would allocate the wrong device for xvdc, since we
had changed mi->type along the way. To fix this, have a separate "major_info"
entry for the extended block devices, even though it isn't technically a
different major number. With these fixes in place, the above sequence works for me.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
[-- Attachment #2: xen-unstable-blkfront-attach-fixes.patch --]
[-- Type: text/x-patch, Size: 2490 bytes --]
diff -r db4f08203b8a drivers/xen/blkfront/vbd.c
--- a/drivers/xen/blkfront/vbd.c Tue Jul 08 09:31:24 2008 +0100
+++ b/drivers/xen/blkfront/vbd.c Wed Jul 09 02:13:37 2008 +0200
@@ -56,7 +56,7 @@
#define NUM_IDE_MAJORS 10
#define NUM_SCSI_MAJORS 17
-#define NUM_VBD_MAJORS 1
+#define NUM_VBD_MAJORS 2
static struct xlbd_type_info xlbd_ide_type = {
.partn_shift = 6,
@@ -114,12 +114,14 @@
xlbd_alloc_major_info(int major, int minor, int index)
{
struct xlbd_major_info *ptr;
+ int do_register;
ptr = kzalloc(sizeof(struct xlbd_major_info), GFP_KERNEL);
if (ptr == NULL)
return NULL;
ptr->major = major;
+ do_register = 1;
switch (index) {
case XLBD_MAJOR_IDE_RANGE:
@@ -131,23 +133,36 @@
ptr->index = index - XLBD_MAJOR_SCSI_START;
break;
case XLBD_MAJOR_VBD_RANGE:
- ptr->type = &xlbd_vbd_type;
- ptr->index = index - XLBD_MAJOR_VBD_START;
+ ptr->index = 0;
+ if ((index - XLBD_MAJOR_VBD_START) == 0)
+ ptr->type = &xlbd_vbd_type;
+ else
+ ptr->type = &xlbd_vbd_type_ext;
+
+ /*
+ * if someone already registered block major 202,
+ * don't try to register it again
+ */
+ if (major_info[XLBD_MAJOR_VBD_START] != NULL)
+ do_register = 0;
break;
}
- if (register_blkdev(ptr->major, ptr->type->devname)) {
- kfree(ptr);
- return NULL;
+ if (do_register) {
+ if (register_blkdev(ptr->major, ptr->type->devname)) {
+ kfree(ptr);
+ return NULL;
+ }
+
+ printk("xen-vbd: registered block device major %i\n", ptr->major);
}
- printk("xen-vbd: registered block device major %i\n", ptr->major);
major_info[index] = ptr;
return ptr;
}
static struct xlbd_major_info *
-xlbd_get_major_info(int major, int minor)
+xlbd_get_major_info(int major, int minor, int vdevice)
{
struct xlbd_major_info *mi;
int index;
@@ -171,7 +186,12 @@
index = 18 + major - SCSI_DISK8_MAJOR;
break;
case SCSI_CDROM_MAJOR: index = 26; break;
- default: index = 27; break;
+ default:
+ if (!VDEV_IS_EXTENDED(vdevice))
+ index = 27;
+ else
+ index = 28;
+ break;
}
mi = ((major_info[index] != NULL) ? major_info[index] :
@@ -241,11 +261,9 @@
BUG_ON(info->mi != NULL);
BUG_ON(info->rq != NULL);
- mi = xlbd_get_major_info(major, minor);
+ mi = xlbd_get_major_info(major, minor, vdevice);
if (mi == NULL)
goto out;
- if (VDEV_IS_EXTENDED(vdevice))
- mi->type = &xlbd_vbd_type_ext;
info->mi = mi;
if ((minor & ((1 << mi->type->partn_shift) - 1)) == 0)
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2008-07-09 0:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=487405A1.3020306@redhat.com \
--to=clalance@redhat.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.