• Mikulas Patocka's avatar
    dm integrity: only allocate recalculate buffer when needed · da8b4fc1
    Mikulas Patocka authored
    dm-integrity preallocated 8MiB buffer for recalculating in the
    constructor and freed it in the destructor. This wastes memory when
    the user has many dm-integrity devices.
    
    Fix dm-integrity so that the buffer is only allocated when
    recalculation is in progress; allocate the buffer at the beginning of
    integrity_recalc() and free it at the end.
    
    Note that integrity_recalc() doesn't hold any locks when allocating
    the buffer, so it shouldn't cause low-memory deadlock.
    Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
    da8b4fc1
dm-integrity.c 135 KB