From: Mikulas Patocka Date: Thu, 24 Apr 2008 20:41:50 +0000 (+0100) Subject: dm snapshot: fix chunksize sector conversion X-Git-Tag: v2.6.26-rc1~1064^2~23 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=924362629bf5645aee5f49f8a0d0d5b193e65997;p=linux-2.6-omap-h63xx.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 5bbce29f143..c7d305bfd83 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)