Re: [PATCH 05/13] libata: improve ATAPI draining

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

 



Albert Lee wrote:
> If the trailing data is odd-lengthed, normally the situation is that
> we have odd-lengthed real data before the trailing data. e.g. The real
> data is 9 bytes, but the drive returns 10 bytes (so, the trailing data
> is 1 byte).
> 
> In ata_data_xfer(), we have the following code:
> 
>     /* Transfer trailing 1 byte, if any. */
>     ... (for write case) ...
>     iowrite16(le16_to_cpu(align_buf[0]), ap->ioaddr.data_addr);  or
> 
>     ... (for read case) ...
>     ioread16(ap->ioaddr.data_addr)
> 
> The PATA bus is actually 16-bit wide. So, ata_data_xfer() actually
> implicitly transfers one more byte than we see if it's odd-lengthed.
> 
> That's why in atapi_pio_bytes(), the trailing length was round down
> instead round up.

Hmmm... it's tricky.  When draining a partial chunk because of
odd-length short buffer on even-length chunk, it needs to be rounded
down but on all other cases it needs to be rounded up, right?

This is basically because count isn't updated with actually consumed
number of bytes.  I'll fix it and post an updated patch.

Thanks.

-- 
tejun
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux