Skip to content

Commit

Permalink
dm snapshot: fix chunksize sector conversion
Browse files Browse the repository at this point in the history
If a snapshot has a smaller chunksize than the page size the
conversion to pages currently returns 0 instead of 1, causing:
kernel BUG in mempool_resize.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: stable@kernel.org
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed Apr 25, 2008
1 parent b69d398 commit 9243626
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/dm-exception-store.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct pstore {

static unsigned sectors_to_pages(unsigned sectors)
{
return sectors / (PAGE_SIZE >> 9);
return DIV_ROUND_UP(sectors, PAGE_SIZE >> 9);
}

static int alloc_area(struct pstore *ps)
Expand Down

0 comments on commit 9243626

Please sign in to comment.