• Mikulas Patocka's avatar
    dm bufio: make the parameter "retain_bytes" unsigned long · da6d8dbb
    Mikulas Patocka authored
    [ Upstream commit 13840d38 ]
    
    Change the type of the parameter "retain_bytes" from unsigned to
    unsigned long, so that on 64-bit machines the user can set more than
    4GiB of data to be retained.
    
    Also, change the type of the variable "count" in the function
    "__evict_old_buffers" to unsigned long.  The assignment
    "count = c->n_buffers[LIST_CLEAN] + c->n_buffers[LIST_DIRTY];"
    could result in unsigned long to unsigned overflow and that could result
    in buffers not being freed when they should.
    
    While at it, avoid division in get_retain_buffers().  Division is slow,
    we can change it to shift because we have precalculated the log2 of
    block size.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
    da6d8dbb
dm-bufio.c 46.4 KB