dm-snapshot: fix performance degradation due to small hash size
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 18 Sep 2013 23:40:42 +0000 (19:40 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2013 14:06:54 +0000 (07:06 -0700)
commit182410bd95348ef1ee5b1bccff8c2c75cec72b44
tree5b27d9df70d66cf8d3e44f4f1c57a3090d0135d7
parent594eaa187a86da35487f59b9f2913e0f28fc5826
dm-snapshot: fix performance degradation due to small hash size

commit 60e356f381954d79088d0455e357db48cfdd6857 upstream.

LVM2, since version 2.02.96, creates origin with zero size, then loads
the snapshot driver and then loads the origin.  Consequently, the
snapshot driver sees the origin size zero and sets the hash size to the
lower bound 64.  Such small hash table causes performance degradation.

This patch changes it so that the hash size is determined by the size of
snapshot volume, not minimum of origin and snapshot size.  It doesn't
make sense to set the snapshot size significantly larger than the origin
size, so we do not need to take origin size into account when
calculating the hash size.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-snap.c