[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [BLK] Expand number of fake-SCSI VBD volumes supported to 120.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID b1a68f065fbd2aa76496bb2ac8c0556e5f220972
# Parent  eea9247ad5a06965dc46cbcab236402dd8f7431b
[BLK] Expand number of fake-SCSI VBD volumes supported to 120.

Signed-off-by: Takanori Kasai <Kasai.Takanori@xxxxxxxxxxxxxx>
Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>
Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c |   46 +++++++++++++++++-------
 tools/python/xen/util/blkif.py                  |   11 ++++-
 2 files changed, 43 insertions(+), 14 deletions(-)

diff -r eea9247ad5a0 -r b1a68f065fbd 
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Thu Nov 09 11:47:42 
2006 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Thu Nov 09 12:07:28 
2006 +0000
@@ -50,7 +50,7 @@
  */
 
 #define NUM_IDE_MAJORS 10
-#define NUM_SCSI_MAJORS 9
+#define NUM_SCSI_MAJORS 17
 #define NUM_VBD_MAJORS 1
 
 static struct xlbd_type_info xlbd_ide_type = {
@@ -165,8 +165,11 @@ xlbd_get_major_info(int vdevice)
        case SCSI_DISK1_MAJOR ... SCSI_DISK7_MAJOR:
                index = 11 + major - SCSI_DISK1_MAJOR;
                break;
-       case SCSI_CDROM_MAJOR: index = 18; break;
-       default: index = 19; break;
+        case SCSI_DISK8_MAJOR ... SCSI_DISK15_MAJOR:
+                index = 18 + major - SCSI_DISK8_MAJOR;
+                break;
+        case SCSI_CDROM_MAJOR: index = 26; break;
+        default: index = 27; break;
        }
 
        mi = ((major_info[index] != NULL) ? major_info[index] :
@@ -227,6 +230,7 @@ xlvbd_alloc_gendisk(int minor, blkif_sec
        struct xlbd_major_info *mi;
        int nr_minors = 1;
        int err = -ENODEV;
+       unsigned int offset;
 
        BUG_ON(info->gd != NULL);
        BUG_ON(info->mi != NULL);
@@ -244,15 +248,33 @@ xlvbd_alloc_gendisk(int minor, blkif_sec
        if (gd == NULL)
                goto out;
 
-       if (nr_minors > 1)
-               sprintf(gd->disk_name, "%s%c", mi->type->diskname,
-                       'a' + mi->index * mi->type->disks_per_major +
-                       (minor >> mi->type->partn_shift));
-       else
-               sprintf(gd->disk_name, "%s%c%d", mi->type->diskname,
-                       'a' + mi->index * mi->type->disks_per_major +
-                       (minor >> mi->type->partn_shift),
-                       minor & ((1 << mi->type->partn_shift) - 1));
+       offset =  mi->index * mi->type->disks_per_major +
+                       (minor >> mi->type->partn_shift);
+       if (nr_minors > 1) {
+               if (offset < 26) {
+                       sprintf(gd->disk_name, "%s%c",
+                                mi->type->diskname, 'a' + offset );
+               }
+               else {
+                       sprintf(gd->disk_name, "%s%c%c",
+                               mi->type->diskname,
+                               'a' + ((offset/26)-1), 'a' + (offset%26) );
+               }
+       }
+       else {
+               if (offset < 26) {
+                       sprintf(gd->disk_name, "%s%c%d",
+                               mi->type->diskname,
+                               'a' + offset,
+                               minor & ((1 << mi->type->partn_shift) - 1));
+               }
+               else {
+                       sprintf(gd->disk_name, "%s%c%c%d",
+                               mi->type->diskname,
+                               'a' + ((offset/26)-1), 'a' + (offset%26),
+                               minor & ((1 << mi->type->partn_shift) - 1));
+               }
+       }
 
        gd->major = mi->major;
        gd->first_minor = minor;
diff -r eea9247ad5a0 -r b1a68f065fbd tools/python/xen/util/blkif.py
--- a/tools/python/xen/util/blkif.py    Thu Nov 09 11:47:42 2006 +0000
+++ b/tools/python/xen/util/blkif.py    Thu Nov 09 12:07:28 2006 +0000
@@ -23,8 +23,15 @@ def blkdev_name_to_number(name):
     except Exception, ex:
         pass
 
-    if re.match( '/dev/sd[a-p]([1-9]|1[0-5])?', n):
-        return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:] or 0)
+    scsi_major = [ 8, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, 132, 
133, 134, 135 ]
+    if re.match( '/dev/sd[a-z]([1-9]|1[0-5])?$', n):
+        major = scsi_major[(ord(n[7:8]) - ord('a')) / 16]
+        minor = ((ord(n[7:8]) - ord('a')) % 16) * 16 + int(n[8:] or 0)
+        return major * 256 + minor
+    if re.match( '/dev/sd[a-i][a-z]([1-9]|1[0-5])?$', n):
+        major = scsi_major[((ord(n[7:8]) - ord('a') + 1) * 26 + (ord(n[8:9]) - 
ord('a'))) / 16 ]
+        minor = (((ord(n[7:8]) - ord('a') + 1 ) * 26 + (ord(n[8:9]) - 
ord('a'))) % 16) * 16 + int(n[9:] or 0)
+        return major * 256 + minor
 
     if re.match( '/dev/hd[a-t]([1-9]|[1-5][0-9]|6[0-3])?', n):
         ide_majors = [ 3, 22, 33, 34, 56, 57, 88, 89, 90, 91 ]

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.