• Neil Brown's avatar
    [PATCH] md 13 of 22 - First step to tidying mddev recounting and locking. · a9d0889a
    Neil Brown authored
    First step to tidying mddev recounting and locking.
    
    This patches introduces
      mddev_get   which incs the refcount on an mddev
      mddev_put   which decs it and, if it becomes unused, frees it
      mddev_find  which finds or allocated an mddev for a given minor
                  This is mostly the old alloc_mddev
    
    
    free_mddev no longer actually frees it.  It just disconnects all drives
    so that mddev_put will do the free.
    
    Now the test for "does an mddev exist" is not "mddev != NULL"
    but involves checking if the mddev has disks or a superblock
    attached.
    
    This makes the semantics of do_md_stop a bit cleaner.  Previously
    if do_md_stop succeed for a real stop (not a read-only stop) then
    you didn't have to unlock the mddev, otherwise you did.  Now
    you always unlock the mddev after do_md_stop.
    a9d0889a
md.c 84.4 KB