kern/89511: VIA 6420 SATA RAID0 array size is that of a single disk

Marcin Simonides marcin at studio4plus.com
Thu Nov 24 23:20:18 GMT 2005


>Number:         89511
>Category:       kern
>Synopsis:       VIA 6420 SATA RAID0 array size is that of a single disk
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 24 23:20:09 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Marcin Simonides
>Release:        6.0-STABLE
>Organization:
>Environment:
FreeBSD simon 6.0-STABLE FreeBSD 6.0-STABLE #2: Thu Nov 10 17:51:18 CET 2005
cinek at simon:/usr/obj/usr/src/sys/CUSTOM  i386

>Description:
Size of RAID 0 array is set to the size of one of disks that comprise the array instead of the sum of disks:

atapci0: <VIA 6420 SATA150 controller> port 0xec00-0xec07,0xe800-0xe803,0xe400-0xe407,0xe000-0xe003,0xdc00-0xdc0f,0xd800-0xd8ff irq 20 at device 15.0 on pci0
[...]
ad0: 29314MB <IBM DTLA-307030 TX4OA60A> at ata0-master UDMA100
ad4: 76319MB <WDC WD800JD-00HKA0 13.03G13> at ata2-master SATA150
ad6: 76319MB <WDC WD800JD-00HKA0 13.03G13> at ata3-master SATA150
ar0: 76319MB <VIA Tech V-RAID RAID0 (stripe 16 KB)> status: READY
ar0: disk0 READY using ad4 at ata2-master
ar0: disk1 READY using ad6 at ata3-master 

The size of ar0 should be 152638MB.
Partitions starting beyond the first half of array are inaccessible.
>How-To-Repeat:
Just create a RAID 0 array in BIOS, the size reported by FreeBSD for respective ar device will be equal to the size of a single disk.
>Fix:
Go to src/sys/dev/ata/ata-raid.c and in function ata_raid_via_read_meta() change one line, here's a diff:

--- ata-raid.c.orig     Thu Nov 24 21:57:31 2005
+++ ata-raid.c  Thu Nov 24 21:58:03 2005
@@ -3022,7 +3022,7 @@
        case VIA_T_RAID0:
            raid->type = AR_T_RAID0;
            raid->width = meta->stripe_layout & VIA_L_MASK;
-           raid->total_sectors = meta->total_sectors;
+           raid->total_sectors = meta->total_sectors * raid->width;
            break;
 
        case VIA_T_RAID1:

to multiply the number of total_sectors by the number of disks (I guess that's what raid->width stands for).
Recompile and install the new kernel (but keep the old :).

It has worked for me for a week now (data has been copied to and from a FAT slice near the end of array, both with FreeBSD and Windows), but I'm no expert, perhaps this "fix" may break something.
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list