• N
    [PATCH] md: support BIO_RW_BARRIER for md/raid1 · a9701a30
    NeilBrown 提交于
    We can only accept BARRIER requests if all slaves handle
    barriers, and that can, of course, change with time....
    
    So we keep track of whether the whole array seems safe for barriers,
    and also whether each individual rdev handles barriers.
    
    We initially assumes barriers are OK.
    
    When writing the superblock we try a barrier, and if that fails, we flag
    things for no-barriers.  This will usually clear the flags fairly quickly.
    
    If writing the superblock finds that BIO_RW_BARRIER is -ENOTSUPP, we need to
    resubmit, so introduce function "md_super_wait" which waits for requests to
    finish, and retries ENOTSUPP requests without the barrier flag.
    
    When writing the real raid1, write requests which were BIO_RW_BARRIER but
    which aresn't supported need to be retried.  So raid1d is enhanced to do this,
    and when any bio write completes (i.e.  no retry needed) we remove it from the
    r1bio, so that devices needing retry are easy to find.
    
    We should hardly ever get -ENOTSUPP errors when writing data to the raid.
    It should only happen if:
      1/ the device used to support BARRIER, but now doesn't.  Few devices
         change like this, though raid1 can!
    or
      2/ the array has no persistent superblock, so there was no opportunity to
         pre-test for barriers when writing the superblock.
    Signed-off-by: NNeil Brown <neilb@cse.unsw.edu.au>
    Signed-off-by: NNeil Brown <neilb@suse.de>
    Signed-off-by: NAndrew Morton <akpm@osdl.org>
    Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
    a9701a30
md.c 108.2 KB