From: Mikulas Patocka Date: Thu, 24 Apr 2008 20:41:50 +0000 (+0100) Subject: dm snapshot: fix chunksize sector conversion X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=924362629bf5645aee5f49f8a0d0d5b193e65997;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git dm snapshot: fix chunksize sector conversion 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 Signed-off-by: Milan Broz Signed-off-by: Alasdair G Kergon Cc: stable@kernel.org --- diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c index 5bbce29f143a..c7d305bfd838 100644 --- a/drivers/md/dm-exception-store.c +++ b/drivers/md/dm-exception-store.c @@ -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)