• Mikulas Patocka's avatar
    dm integrity: fix inefficient allocation of journal space · d2df849c
    Mikulas Patocka authored
    commit 9dd59727 upstream.
    
    When using a block size greater than 512 bytes, the dm-integrity target
    allocates journal space inefficiently.  It allocates one journal entry
    for each 512-byte chunk of data, fills an entry for each block of data
    and leaves the remaining entries unused.
    
    This issue doesn't cause data corruption, but all the unused journal
    entries degrade performance severely.
    
    For example, with 4k blocks and an 8k bio, it would allocate 16 journal
    entries but only use 2 entries.  The remaining 14 entries were left
    unused.
    
    Fix this by adding the missing 'log2_sectors_per_block' shifts that are
    required to have each journal entry map to a full block.
    Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
    Fixes: 7eada909 ("dm: add integrity target")
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    d2df849c
dm-integrity.c 90.6 KB