• NeilBrown's avatar
    md/bitmap: optimise scanning of empty bitmaps. · ef425673
    NeilBrown authored
    A bitmap is stored as one page per 2048 bits.
    If none of the bits are set, the page is not allocated.
    
    When bitmap_get_counter finds that a page isn't allocate,
    it just reports that one bit work of space isn't flagged,
    rather than reporting that 2048 bits worth of space are
    unflagged.
    This can cause searches for flagged bits (e.g. bitmap_close_sync)
    to do more work than is really necessary.
    
    So change bitmap_get_counter (when creating) to report a number of
    blocks that more accurately reports the range of the device for which
    no counter currently exists.
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    ef425673
bitmap.c 52.6 KB