vblade-20 endianess fix

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

 



hi there


I've found and fixed a vblade (v20) bug which manifests itself in the following 
situation:

- vblade host uses a big-endian processor (in our case, a POWER4).
- exported volume has > 128GB (requires LBA48).

The AoE client (in our case, Linux 2.6.32) ignores/gets_confused_with the 
LBA48 data and considers the LBA28 only, cropping the volume size to 
MAXLBA28SIZE-1. Some erratic behavior may happen: some partitions do not 
appear, unable to access root device etc.

dmesg under Linux returns something like this:

[5278516.938160] aoe: 00a1b0691845 e4.4 v4014 has 268435455 sectors
[5278516.938216]  etherd/e4.4: p1 p2 < >
[5278516.938995] etherd/e4.4: p1 size 273874944 exceeds device capacity, 
limited to end of disk
[5278516.939018] etherd/e4.4: p2 ignored, start 273879038 is behind the end of 
the disk


.dan

Following, the patch against vblade-20:

---------------------------------------
diff -Nurp vblade-20/ata.c vblade-20_fixed_for_MSB_arch//ata.c
--- vblade-20/ata.c     2009-08-14 15:33:09.000000000 -0300
+++ vblade-20_fixed_for_MSB_arch//ata.c 2013-03-04 17:39:44.000000000 -0300
@@ -23,16 +23,7 @@ enum {
        ERR =   1<<0,
 };
 
-static ushort ident[256] = {
-       [47] 0x8000,
-       [49] 0x0200,
-       [50] 0x4000,
-       [83] 0x5400,
-       [84] 0x4000,
-       [86] 0x1400,
-       [87] 0x4000,
-       [93] 0x400b,
-};
+static ushort ident[256];
 
 static void
 setfld(ushort *a, int idx, int len, char *str) // set field in ident
@@ -79,6 +70,16 @@ setlba48(ushort *ident, vlong lba)
        *cp++ = lba >>= 8;
        *cp++ = lba >>= 8;
 }
+
+static void
+setushort(ushort *a, int idx, ushort x)
+{
+       uchar *cp;
+
+       cp = (uchar *)(a+idx);
+       *cp++ = x & 0xff;
+       *cp++ = x >> 8;
+}
 
 void
 atainit(void)
@@ -89,6 +90,15 @@ atainit(void)
        sprintf(buf, "V%d", VBLADE_VERSION);
        setfld(ident, 23, 8, buf);
        setfld(ident, 10, 20, serial);
+
+       setushort(ident, 47, 0x8000);
+       setushort(ident, 49, 0x0200);
+       setushort(ident, 50, 0x4000);
+       setushort(ident, 83, 0x5400);
+       setushort(ident, 84, 0x4000);
+       setushort(ident, 86, 0x1400);
+       setushort(ident, 87, 0x4000);
+       setushort(ident, 93, 0x400b);
 }
---------------------------------------


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Aoetools-discuss mailing list
Aoetools-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/aoetools-discuss


[Index of Archives]     [Linux ARM Kernel]     [Linux SCSI]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux