• Alex Elder's avatar
    rbd: defer registering snapshot devices · 304f6808
    Alex Elder authored
    When a new snapshot is found in an rbd device's updated snapshot
    context, __rbd_add_snap_dev() is called to create and insert an
    entry in the rbd devices list of snapshots.  In addition, a Linux
    device is registered to represent the snapshot.
    
    For version 2 rbd images, it will be undesirable to initialize the
    device right away.  So in anticipation of that, this patch separates
    the insertion of a snapshot entry in the snaps list from the
    creation of devices for those snapshots.
    
    To do this, create a new function rbd_dev_snaps_register() which
    traverses the list of snapshots and calls rbd_register_snap_dev()
    on any that have not yet been registered.
    
    Rename rbd_dev_snap_devs_update() to be rbd_dev_snaps_update()
    to better reflect that only the entry in the snaps list and not
    the snapshot's device is affected by the function.
    
    For now, call rbd_dev_snaps_register() immediately after each
    call to rbd_dev_snaps_update().
    Signed-off-by: default avatarAlex Elder <elder@inktank.com>
    Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
    304f6808
rbd.c 65.4 KB