• Qu Wenruo's avatar
    btrfs: tests: enhance extent buffer bitmap tests · 257deed2
    Qu Wenruo authored
    Enhance extent bitmap tests for the following aspects:
    
    - Remove unnecessary @len from __test_eb_bitmaps()
      We can fetch the length from extent buffer
    
    - Explicitly distinguish bit and byte length
      Now every start/len inside bitmap tests would have either "byte_" or
      "bit_" prefix to make it more explicit.
    
    - Better error reporting
    
      If we have mismatch bits, the error report would dump the following
      contents:
    
      * start bytenr
      * bit number
      * the full byte from bitmap
      * the full byte from the extent
    
      This is to save developers time so obvious problem can be found
      immediately
    
    - Extract bitmap set/clear and check operation into two helpers
      This is to save some code lines, as we will have more tests to do.
    
    - Add new tests
    
      The following tests are added, mostly for the incoming extent bitmap
      accessor refactoring:
    
      * Set bits inside the same byte
      * Clear bits inside the same byte
      * Cross byte boundary set
      * Cross byte boundary clear
      * Cross multi-byte boundary set
      * Cross multi-byte boundary clear
    
      Those new tests have already saved my backend for the incoming extent
      buffer bitmap refactoring.
    Reviewed-by: default avatarSweet Tea Dorminy <sweettea-kernel@dorminy.me>
    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>
    257deed2
extent-io-tests.c 16.8 KB