dm integrity: fix inefficient allocation of journal space
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 19 Jul 2017 15:23:40 +0000 (11:23 -0400)
committerMike Snitzer <snitzer@redhat.com>
Wed, 19 Jul 2017 22:44:18 +0000 (18:44 -0400)
commit9dd59727dbc21d33a9add4c5b308a5775cd5a6ef
treed0ff52601eb09c36f0bd7d4fe02d01f90e0b0768
parent5771a8c08880cdca3bfb4a3fc6d309d6bba20877
dm integrity: fix inefficient allocation of journal space

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: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Fixes: 7eada909bfd7 ("dm: add integrity target")
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-integrity.c