md/bitmap: fix calculation of 'chunks' - missing shift.

commit 61a0d80c "md/bitmap: discard CHUNK_BLOCK_SHIFT macro"
replaced CHUNK_BLOCK_RATIO() by the same text that was
replacing CHUNK_BLOCK_SHIFT() - which is clearly wrong.

The result is that 'chunks' is often too small by 1,
which can sometimes result in a crash (not sure how).

So use the correct replacement, and get rid of CHUNK_BLOCK_RATIO
which is no longe used.

Reported-by: Karl Newman <siliconfiend@gmail.com>
Tested-by: Karl Newman <siliconfiend@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>

NeilBrown b16b1b6c 69964ea4

+1 -5
+1 -2
drivers/md/bitmap.c
··· 1727 1727 bitmap->chunkshift = (ffz(~mddev->bitmap_info.chunksize) 1728 1728 - BITMAP_BLOCK_SHIFT); 1729 1729 1730 - /* now that chunksize and chunkshift are set, we can use these macros */ 1731 - chunks = (blocks + bitmap->chunkshift - 1) >> 1730 + chunks = (blocks + (1 << bitmap->chunkshift) - 1) >> 1732 1731 bitmap->chunkshift; 1733 1732 pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; 1734 1733
-3
drivers/md/bitmap.h
··· 101 101 102 102 #define BITMAP_BLOCK_SHIFT 9 103 103 104 - /* how many blocks per chunk? (this is variable) */ 105 - #define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->mddev->bitmap_info.chunksize >> BITMAP_BLOCK_SHIFT) 106 - 107 104 #endif 108 105 109 106 /*