linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: unsik Kim <donari75@gmail.com>
Cc: tj@kernel.org, linux-kernel@vger.kernel.org,
	Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH] mg_disk: Add missing ready status check on mg_write()
Date: Fri, 24 Jul 2009 12:41:42 +0200	[thread overview]
Message-ID: <200907241241.42842.bzolnier@gmail.com> (raw)
In-Reply-To: <1248322878-3804-1-git-send-email-donari75@gmail.com>

On Thursday 23 July 2009 06:21:18 unsik Kim wrote:
> When last sector is written, ready bit of status register should be
> checked.
> 
> Signed-off-by: unsik Kim <donari75@gmail.com>

Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

[ It is on top of my patch (http://lkml.org/lkml/2009/6/28/237), right?

  I assume that both patches were verified with hardware and are ready
  to be merged upstream now? ]

> ---
>  drivers/block/mg_disk.c |   32 +++++++++++++++-----------------
>  1 files changed, 15 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
> index f8149db..64f90f5 100644
> --- a/drivers/block/mg_disk.c
> +++ b/drivers/block/mg_disk.c
> @@ -516,16 +516,16 @@ static void mg_write_one(struct mg_host *host, struct request *req)
>  static void mg_write(struct request *req)
>  {
>  	struct mg_host *host = req->rq_disk->private_data;
> -	bool rem;
> +	unsigned int rem = blk_rq_sectors(req);
>  
> -	if (mg_out(host, blk_rq_pos(req), blk_rq_sectors(req),
> +	if (mg_out(host, blk_rq_pos(req), rem,
>  		   MG_CMD_WR, NULL) != MG_ERR_NONE) {
>  		mg_bad_rw_intr(host);
>  		return;
>  	}
>  
>  	MG_DBG("requested %d sects (from %ld), buffer=0x%p\n",
> -	       blk_rq_sectors(req), blk_rq_pos(req), req->buffer);
> +	       rem, blk_rq_pos(req), req->buffer);
>  
>  	if (mg_wait(host, ATA_DRQ,
>  		    MG_TMAX_WAIT_WR_DRQ) != MG_ERR_NONE) {
> @@ -533,25 +533,23 @@ static void mg_write(struct request *req)
>  		return;
>  	}
>  
> -	mg_write_one(host, req);
> +	do {
> +		mg_write_one(host, req);
>  
> -	outb(MG_CMD_WR_CONF, (unsigned long)host->dev_base + MG_REG_COMMAND);
> +		outb(MG_CMD_WR_CONF, (unsigned long)host->dev_base +
> +				MG_REG_COMMAND);
>  
> -	do {
> -		if (blk_rq_sectors(req) > 1 &&
> -		     mg_wait(host, ATA_DRQ,
> -			     MG_TMAX_WAIT_WR_DRQ) != MG_ERR_NONE) {
> +		rem--;
> +		if (rem > 1 && mg_wait(host, ATA_DRQ,
> +					MG_TMAX_WAIT_WR_DRQ) != MG_ERR_NONE) {
> +			mg_bad_rw_intr(host);
> +			return;
> +		} else if (mg_wait(host, MG_STAT_READY,
> +					MG_TMAX_WAIT_WR_DRQ) != MG_ERR_NONE) {
>  			mg_bad_rw_intr(host);
>  			return;
>  		}
> -
> -		rem = mg_end_request(host, 0, MG_SECTOR_SIZE);
> -		if (rem)
> -			mg_write_one(host, req);
> -
> -		outb(MG_CMD_WR_CONF,
> -		     (unsigned long)host->dev_base + MG_REG_COMMAND);
> -	} while (rem);
> +	} while (mg_end_request(host, 0, MG_SECTOR_SIZE));
>  }
>  
>  static void mg_read_intr(struct mg_host *host)

  reply	other threads:[~2009-07-23 10:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-28 18:14 [PATCH][RESEND] mg_disk: fix issue with data integrity on error in mg_write() Bartlomiej Zolnierkiewicz
2009-07-03  1:50 ` unsik Kim
2009-07-03 13:16   ` Bartlomiej Zolnierkiewicz
2009-07-23  4:21     ` [PATCH] mg_disk: Add missing ready status check on mg_write() unsik Kim
2009-07-24 10:41       ` Bartlomiej Zolnierkiewicz [this message]
2009-07-23 11:15         ` unsik Kim
2009-07-27 20:48       ` Jens Axboe

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=200907241241.42842.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=donari75@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.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 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).