[PATCH #upstream-fixes 2/2] pata_it821x: use raw nbytes in check_atapi_dma

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

 



pata_it821x needs to look at raw request size in check_atapi_dma().

Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>
Cc: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>
---
This should restore the original behavior.  However, there's a catch.
Alan, you said DMA behavior on pata_it821x genuinely depends on
transfer size, right?  Then, it can be one of the following two.

1. It depends on the size of the buffer handed to the controller, in
   which case qc->nbytes is the right value to look at.  For pata_ali,
   this definitely wasn't the case as small DMA transfers failed even
   though large aligned buffer was supplied.

2. It depends on the size of the data the drive transfers in response
   of the command.  In this case, checking raw or any size on host
   size is useless as the drive may transfer any number of bytes.  In
   this case, we should use command type to determine whether DMA can
   be used or not as we can guarantee certain transfer sizes for
   certain commands.  pata_ali fell into this category.

All in all, I think discerning #1 from #2 is hair-splitting for not
enough benefit (heh.. yeah, I'm going there again) and applying #1 for
controllers which fall in #2 is dangerous while the other way is fine.
I think it's better to just implement atapi_check_dma_rw_only() and
use it for these controllers.

Anyways, this patch restores the old behavior and should be fine for
2.6.25.

Thanks.

 drivers/ata/pata_it821x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: work/drivers/ata/pata_it821x.c
===================================================================
--- work.orig/drivers/ata/pata_it821x.c
+++ work/drivers/ata/pata_it821x.c
@@ -564,7 +564,7 @@ static int it821x_check_atapi_dma(struct
 	struct it821x_dev *itdev = ap->private_data;
 
 	/* Only use dma for transfers to/from the media. */
-	if (qc->nbytes < 2048)
+	if (ata_qc_raw_nbytes(qc) < 2048)
 		return -EOPNOTSUPP;
 
 	/* No ATAPI DMA in smart mode */
--
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