• Qu Wenruo's avatar
    btrfs: subpage: make reader lock utilize bitmap · 8e7e9c67
    Qu Wenruo authored
    Currently btrfs_subpage utilizes its atomic member @reader to manage the
    reader counter.  However it is only utilized to prevent the page to be
    released/unlocked when we still have reads underway.
    
    In that use case, we don't really allow multiple readers on the same
    subpage sector.  So here we can introduce a new locked bitmap to
    represent exactly which subpage range is locked for read.
    
    In theory we can remove btrfs_subpage::reader as it's just the set bits
    of the new locked bitmap.  But unfortunately bitmap doesn't provide such
    handy API yet, so we still keep the reader counter.
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    8e7e9c67
subpage.h 5.78 KB