• A
    rbd: rework calculation of new rbd id's · 1ddbe94e
    Alex Elder 提交于
    In order to select a new unique identifier for an added rbd device,
    the list of all existing ones is searched and a value one greater
    than the highest id is used.
    
    The list search can be avoided by using an atomic variable that
    keeps track of the current highest id.  Using a get/put model for
    id's we can limit the boundless growth of id numbers a bit by
    arranging to reuse the current highest id once it gets released.
    Add these calls to "put" the id when an rbd is getting removed.
    
    Note that this changes the pattern of device id's used--new values
    will never be below the highest one seen so far (even if there
    exists an unused lower one).  I assert this is OK because the key
    property of an rbd id is its uniqueness, not its magnitude.
    
    Regardless, a follow-on patch will restore the old way of doing
    things, I just think this commit just makes the incremental change
    to atomics a little easier to understand.
    Signed-off-by: NAlex Elder <elder@dreamhost.com>
    Signed-off-by: NSage Weil <sage@newdream.net>
    1ddbe94e
rbd.c 54.0 KB