Request for testing: ata(4) MFC

Antony Mawer fbsd-stable at
Thu Oct 16 22:28:43 UTC 2008

Jeremy Chadwick wrote:
> On Fri, Oct 10, 2008 at 04:58:55AM -0700, Jeremy Chadwick wrote:
>> On Sun, Oct 05, 2008 at 10:12:11PM -0700, Jeremy Chadwick wrote:
>>> On Mon, Oct 06, 2008 at 09:03:20AM +0400, Andrey V. Elsukov wrote:
>>>> Jeremy Chadwick wrote:
>>>>> Also, does your patch include any fixes (intentional or inadvertent) for
>>>>> Intel MatrixRAID?  This has been a sore spot for FreeBSD for quite
>>>>> some time, and I'm curious to know if that has been fixed.
>>>> There is only one fix for Intel Matrix RAID:
>>> Ahh, yeah, I've seen that one as well.  I'll apply the patch and let you
>>> know if the behaviour documented in the PR happens.
>> I'm sorry I haven't gotten around to testing this -- my day (night) job
>> has kept me incredibly busy, and I've had hardly any time at home to
>> work on personal projects.  It sucks.
>> I'll try to make time for testing either today or tomorrow.
> Other items:
> - Could someone provide an explanation of the 48-bit LBA addressing
>   changes (see lines 988-1003 in the patch)?  I'd like to know what they
>   do, and if further QA/testing is needed with this.

This is probably more a question for Søren...

I started looking at the moment, as the original 28->48bit crossover bug 
was in the same function not so long ago (ata-all.c rev1.280). The 
48-bit LBA changes are introduced from ata-all.c rev1.282, which was the 
port multiplier changes. The logic just doesn't seem quite right to it 
to me, but

I'm not an expert on the code or on ATA, so all of this could just be 
amateur mis-interpretation. From my reading of it, the code does this:

  * Check to see if we need to use a 48-bit command in place of the
  * standard 28-bit command, and if so, substitute as appropriate
IF ((request_lba_addr + lba_count) >= max addressable by 28-bit LBA
     or lba_count > 256) and device supports 48-bit LBA THEN
          * The request either:
          *    - extends past the 28-bit boundary
          *    - is for more than 256 sectors
          * which necessitates the use of 48-bit LBA. Translate commands
          * into their 48-bit equivalents.
ELSEIF the device supports 48-bit lba:
          * We prefer (need?) to use the 48-bit equivalents of these
          * commands regardless of what the LBA address of the reqest is

In rev 1.282, the ATA_READ_NATIVE_MAX_ADDRESS was moved down to the 
"ELSE" case of the IF statement. In otherwords, when the request is 
beyond the 28-bit boundary, OR it's > 256 sectors, 
ATA_READ_NATIVE_MAX_ADDRESS won't be translated...

Søren, is this change intentional, or should it be also added to the 
switch statement in the top half of the IF block?

The ATA code appears to be very lightly commented, which no doubt is 
something of a barrier to entry to those who are not familiar with 
issues such as the above... would any volunteers be helpful to help 
comment and/or document some of the code? We would likely need to confer 
with Søren and others to ensure that our interpretation was accurate, 
but it would certainly make tracking down issues easier for those 
unfamiliar with the code...


More information about the freebsd-stable mailing list