linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: IDE/ATA development list <linux-ide@vger.kernel.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	"Rafael J. Wysocki" <rjw@sisk.pl>
Subject: [PATCH #upstream-fixes 2/2] pata_it821x: use raw nbytes in check_atapi_dma
Date: Tue, 18 Mar 2008 17:56:12 +0900	[thread overview]
Message-ID: <47DF83AC.40606@gmail.com> (raw)
In-Reply-To: <47DF81AF.7080000@gmail.com>

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

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
---
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 */

  reply	other threads:[~2008-03-18  8:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-11  2:35 [PATCH #upstream-fixes] libata: use atapi_cmd_type() to determine cmd type instead of transfer size Tejun Heo
2008-03-11 12:50 ` Rafael J. Wysocki
2008-03-12 13:18 ` Alan Cox
2008-03-17 12:27 ` Jeff Garzik
2008-03-18  8:47   ` [PATCH #upstream-fixes 1/2] libata: implement ata_qc_raw_nbytes() Tejun Heo
2008-03-18  8:56     ` Tejun Heo [this message]
2008-03-25  2:26     ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47DF83AC.40606@gmail.com \
    --to=htejun@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).