linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ide write barrier support
Date: Mon, 13 Oct 2003 17:37:02 +0200	[thread overview]
Message-ID: <20031013153702.GA1107@suse.de> (raw)
In-Reply-To: <20031013153503.GZ1107@suse.de>

On Mon, Oct 13 2003, Jens Axboe wrote:
> On Mon, Oct 13 2003, Jeff Garzik wrote:
> > On Mon, Oct 13, 2003 at 04:08:58PM +0200, Jens Axboe wrote:
> > > +/*
> > > + * preempt pending requests, and store this cache flush for immediate
> > > + * execution
> > > + */
> > > +static struct request *ide_queue_flush_cmd(ide_drive_t *drive,
> > > +					   struct request *rq, int post)
> > > +{
> > > +	struct request *flush_rq = &HWGROUP(drive)->wrq;
> > > +
> > > +	blkdev_dequeue_request(rq);
> > > +
> > > +	memset(drive->special_buf, 0, sizeof(drive->special_buf));
> > > +
> > > +	ide_init_drive_cmd(flush_rq);
> > > +
> > > +	flush_rq->buffer = drive->special_buf;
> > > +	flush_rq->special = rq;
> > > +	flush_rq->buffer[0] = WIN_FLUSH_CACHE;
> > > +
> > > +	if (drive->id->cfs_enable_2 & 0x2400)
> > > +		flush_rq->buffer[0] = WIN_FLUSH_CACHE_EXT;
> > > +
> > > +	if (!post) {
> > > +		drive->doing_barrier = 1;
> > > +		flush_rq->flags |= REQ_BAR_PREFLUSH;
> > > +	} else
> > > +		flush_rq->flags |= REQ_BAR_POSTFLUSH;
> > > +
> > > +	flush_rq->flags |= REQ_STARTED;
> > > +	list_add(&flush_rq->queuelist, &drive->queue->queue_head);
> > > +	return flush_rq;
> > > +}
> > 
> > AFAICS you're missing some code that could be a major data corrupter:
> > 
> > FLUSH CACHE [EXT] may return before it's complete.  You need to create
> > an issue loop, that does FLUSH CACHE [EXT] and reads the result.  If the
> > result indicates the flush cache was partial, then you need to re-issue
> > the flush.  Lather, rinse, repeat until flush cache indicates all data
> > is really flushed.
> 
> It looks like you are right, at least the wording has changed since ata5
> that states that BSY must remain set until all data has been flushed out
> (or error occurs). Which seems sane.
> 
> Only in the error case can I see this making sense, with partial
> flushes. It needs fixing (the error case too), but I'd hardly call that
> a major data corrupter. Not for the general case, we'd have to do really
> badly to risk corrupting data when compared to how 2.4 and 2.6 with
> journalling works now.

Newer ata (6, to be precise, the newest I have handy) have the same
wording. Only in error recovery should I take care.

So it's not a major issue, it's a corner case. The error handling isn't
quite complete yet, that's is a known issue.

-- 
Jens Axboe


  reply	other threads:[~2003-10-13 15:37 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-13 14:08 [PATCH] ide write barrier support Jens Axboe
2003-10-13 15:23 ` Jeff Garzik
2003-10-13 15:35   ` Jens Axboe
2003-10-13 15:37     ` Jens Axboe [this message]
2003-10-13 22:39 ` Matthias Andree
2003-10-14  0:16   ` Jeff Garzik
2003-10-16 10:36     ` Jens Axboe
2003-10-16 10:46       ` Jeff Garzik
2003-10-16 10:48         ` Jens Axboe
2003-10-13 23:07 ` Andrew Morton
2003-10-14  6:48   ` Jens Axboe
2003-10-15  3:40 ` Greg Stark
2003-10-16  7:10   ` Jens Axboe
2003-10-20 17:10 ` Daniel Phillips
2003-10-20 19:56   ` Jens Axboe
2003-10-20 23:46     ` Daniel Phillips
2003-10-21  5:40       ` Jens Axboe
2003-10-23 16:22         ` Daniel Phillips
2003-10-23 16:23           ` Jens Axboe
2003-10-23 17:20             ` Daniel Phillips
2003-10-23 23:21               ` Nick Piggin
2003-10-26 21:06                 ` Daniel Phillips
2003-10-27 10:29                   ` Lars Marowsky-Bree
2003-10-27 21:35                     ` Daniel Phillips
2003-10-24  9:36               ` Helge Hafting
2003-10-26 15:38                 ` Daniel Phillips
  -- strict thread matches above, loose matches on Subject: below --
2003-10-16 16:51 Mudama, Eric
2003-10-16 20:43 ` Greg Stark
2003-10-17  6:44   ` Jens Axboe
2003-10-17  6:46 ` Jens Axboe
2003-10-16 20:51 Mudama, Eric
2003-10-17  6:48 ` Jens Axboe
2003-10-17 16:07 Mudama, Eric
2003-10-17 18:08 ` Jens Axboe
2003-10-17 17:59 Manfred Spraul
2003-10-17 18:06 ` Jens Axboe
2003-10-21  0:47   ` Matthias Andree
2003-10-17 18:42 Mudama, Eric
     [not found] <IXzh.61g.5@gated-at.bofh.it>
2003-10-21 19:24 ` Anton Ertl

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=20031013153702.GA1107@suse.de \
    --to=axboe@suse.de \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.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).