linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: async writes in raid1
@ 2003-04-14 21:27 Chuck Ebbert
  2003-04-15 13:50 ` Paul Clements
  0 siblings, 1 reply; 7+ messages in thread
From: Chuck Ebbert @ 2003-04-14 21:27 UTC (permalink / raw)
  To: ptb@it.uc3m.es; +Cc: linux-raid

ptb wrote:


> I've done a few million async writes and haven't died yet. Of course I
> don't know if this procedure works always.


 What happens if the system crashes before all the writes complete?

 

--
 Chuck

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: async writes in raid1
@ 2003-04-14 19:32 Peter T. Breuer
  2003-04-15 18:08 ` Paul Clements
  0 siblings, 1 reply; 7+ messages in thread
From: Peter T. Breuer @ 2003-04-14 19:32 UTC (permalink / raw)
  To: ptb; +Cc: Paul Clements, linux-raid

"A month of sundays ago ptb wrote:"
> > Actually, I think you want to make sure, in the async case, that the
> > write to the _primary_ disk completes, as opposed to just the first
> > write...I think you could get the I/O completing out of order, right?
> 
> Hmm .. that's a point. It's not a question of out of order, so much as
> we want to give the maximum chance of getting one successful write and

Ooops .. I looked up the wrong bit of code in my reply. I looked at the
final end_req, instead of the mirrored i/o end_req. Yes, don't worry,
it's already done right. The ack happens early only if there is success
to report ("uptodate" is set)..


        /*
         * WRITE:
         *
         * Let's see if all mirrored write operations have finished 
         * already.
         *
         * In any case, do the end io early on the master bh if we are
         * uptodate, and AsyncIO is set on the bh. We set AsyncPhase
         * when this happens, so we don't do it twice, inadvertently.
         */

        if (uptodate
        &&  test_bit(R1BH_AsyncIO, &r1_bh->state)
        && !test_and_set_bit(R1BH_AsyncPhase, &r1_bh->state)) {

                struct buffer_head *mbh = r1_bh->master_bh;

                raid1_conf_t *conf = mddev_to_conf(r1_bh->mddev);

                PRINTK(KERN_DEBUG "raid1: async end i/o on sectors %lu-%lu\n",
                        mbh->b_rsector, mbh->b_rsector + (mbh->b_size >> 9) - 1);

                io_request_done(mbh->b_rsector, conf,
                        test_bit(R1BH_SyncPhase, &r1_bh->state));
                mbh->b_end_io(mbh, uptodate);
        }

Peter

^ permalink raw reply	[flat|nested] 7+ messages in thread
* async writes in raid1
@ 2003-04-14 14:58 Peter T. Breuer
  0 siblings, 0 replies; 7+ messages in thread
From: Peter T. Breuer @ 2003-04-14 14:58 UTC (permalink / raw)
  To: Paul.Clements; +Cc: neilb, linux-raid


I simply went ahead and implemented async writes by

 1) in make_request:
    duplicating the bh->b_data from the original request into a local
    buffer obtained via kmalloc (if kmalloc fails, don't set the flag
    in the rh1_bh for async writes). Then point all the mirrored bh's
    mbh->b_data at this.

 2) in the mirrored bh's end_request:
    if we're the first mbh and async flag is set, ack the original bh.
    if we're the last  mbh and async flag is set, kfree the mbh->b_data
    that we kmalloc'ed earlier.

I've done a few million async writes and haven't died yet. Of course I
don't know if this procedure works always.

Doubts: do I have to point mbh->b_page at something new too? There are
occasional tests scattered in the code (on read, as far as I can see)
to make sure it corresponds correctly to the b_data field.

This is all in the fr1 driver.

  ftp://oboe.it.uc3m.es/pub/Programs/fr1-2.14.tgz

fr1.o needs to be loaded with async=1 to activate async writes.

There's still a couple of debugging printks, but you can kill them
yourself.

  raid1: async end i/o on sectors 3956-3957
  raid1: async end i/o on sectors 3958-3959
  raid1: async end i/o on sectors 3960-3961
  raid1: async end i/o on sectors 3962-3963
  raid1: async end i/o on sectors 3964-3965
  raid1: async end i/o on sectors 3966-3967
  bitmap: free page enters with page count 6
  bitmap: free page exits with page count 7

Async writes "can work" because of the bitmap support architecture in
fr1.  The bitmap is marked before the async write and cleared when the
last mirrored bh completes.

It all degrades nicely in out of memory conditions.

Peter

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-04-15 18:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <3E9B00F6.6C46EBBC@SteelEye.com>
2003-04-14 19:24 ` async writes in raid1 Peter T. Breuer
2003-04-15 18:14   ` Paul Clements
2003-04-14 21:27 Chuck Ebbert
2003-04-15 13:50 ` Paul Clements
  -- strict thread matches above, loose matches on Subject: below --
2003-04-14 19:32 Peter T. Breuer
2003-04-15 18:08 ` Paul Clements
2003-04-14 14:58 Peter T. Breuer

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).