All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: FUJITA Tomonori <tomof@acm.org>
Cc: linux-scsi@vger.kernel.org, jgarzik@pobox.com,
	James.Bottomley@SteelEye.com, fujita.tomonori@lab.ntt.co.jp,
	akpm@linux-foundation.org
Subject: Re: [PATCH] libata sg chaining support fix
Date: Mon, 20 Aug 2007 09:06:12 +0200	[thread overview]
Message-ID: <20070820070610.GN23758@kernel.dk> (raw)
In-Reply-To: <200708180947.l7I9lw82005487@mbox.iij4u.or.jp>

On Sat, Aug 18 2007, FUJITA Tomonori wrote:
> This fixes 'trailing data' bug in the sglist libata patch in Jens'
> block git tree.
> 
> Aug 18 16:03:03 tulip kernel: ata1.00: 36 bytes trailing data
> Aug 18 16:03:03 tulip kernel: scsi scan: INQUIRY result too short (5), using 36
> 
> 
> With the patch, sglist could be sent to -mm (I guess that Andrew hit
> this bug). But I'm still not sure about the sglist libata patch
> (especially about the padding path). It would be better to drop the
> sglist libata patch with my use_sg_chaining option patch and send
> sglist to -mm, I think.
> 
> http://marc.info/?l=linux-scsi&m=118728307617958&w=2
> 
> I guess that it would be better to leave sglist libata conversion in
> the maintainers' hands.
> 
> ---
> From 86d7a796417bde84fc3cbe6ac6ebaaa524266092 Mon Sep 17 00:00:00 2001
> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Date: Sat, 18 Aug 2007 18:27:36 +0900
> Subject: [PATCH] libata sg chaining support fix
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> ---
>  drivers/ata/libata-core.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index f37eecc..52f75c3 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -4648,16 +4648,18 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
>  {
>  	int do_write = (qc->tf.flags & ATA_TFLAG_WRITE);
>  	struct scatterlist *sg = qc->__sg;
> +	struct scatterlist *lsg = sg_last(qc->__sg, qc->n_elem);
>  	struct ata_port *ap = qc->ap;
>  	struct page *page;
>  	unsigned char *buf;
>  	unsigned int offset, count;
> +	int no_more_sg = 0;
>  
>  	if (qc->curbytes + bytes >= qc->nbytes)
>  		ap->hsm_task_state = HSM_ST_LAST;
>  
>  next_sg:
> -	if (unlikely(qc->cursg == sg_last(qc->__sg, qc->n_elem))) {
> +	if (unlikely(no_more_sg)) {
>  		/*
>  		 * The end of qc->sg is reached and the device expects
>  		 * more data to transfer. In order not to overrun qc->sg
> @@ -4719,6 +4721,9 @@ next_sg:
>  	qc->cursg_ofs += count;
>  
>  	if (qc->cursg_ofs == sg->length) {
> +		if (qc->cursg == lsg)
> +			no_more_sg = 1;
> +
>  		qc->cursg = sg_next(qc->cursg);
>  		qc->cursg_ofs = 0;
>  	}

Tomo, this looks promising! Andrew, I have updated #for-akpm with the
sglist bits so it's enabled for the next -mm in the hope that this fixes
the issue.

-- 
Jens Axboe


      reply	other threads:[~2007-08-20  7:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-18  9:47 [PATCH] libata sg chaining support fix FUJITA Tomonori
2007-08-20  7:06 ` Jens Axboe [this message]

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=20070820070610.GN23758@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=akpm@linux-foundation.org \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=jgarzik@pobox.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tomof@acm.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.