• Alex Elder's avatar
    rbd: update in-core header directly · 662518b1
    Alex Elder authored
    Now that rbd_header_from_disk() only fills in one-time fields once,
    we can extend it slightly so it releases the other fields before
    replacing their values.  This way there's no need to pass a
    temporary buffer and then copy all the results in.  Just use the rbd
    device header structure in rbd_header_from_disk() so its values get
    updated directly.
    
    Note that this means we need to take the header semaphore at the
    point we update things.  So pass the rbd_dev rather than the address
    of its header as its first argument to rbd_header_from_disk(), and
    have it return an error code.
    
    As a result, rbd_dev_v1_header_read() does all the work,
    rbd_read_header() becomes unnecessary, and rbd_dev_v1_refresh()
    becomes a very simple wrapper.
    Signed-off-by: default avatarAlex Elder <elder@inktank.com>
    Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
    662518b1
rbd.c 129 KB