Skip to content

Commit a913096

Browse files
zhaohemliu-song-6
authored andcommitted
md/bitmap: md_bitmap_read_sb uses wrong bitmap blocks
The patched code is used to get chunks number, should use round-up div to replace current sector_div. The same code is in md_bitmap_resize(): ``` chunks = DIV_ROUND_UP_SECTOR_T(blocks, 1 << chunkshift); ``` Signed-off-by: Zhao Heming <heming.zhao@suse.com> Signed-off-by: Song Liu <songliubraving@fb.com>
1 parent d7a1c48 commit a913096

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/md/md-bitmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,8 @@ static int md_bitmap_read_sb(struct bitmap *bitmap)
606606
if (bitmap->cluster_slot >= 0) {
607607
sector_t bm_blocks = bitmap->mddev->resync_max_sectors;
608608

609-
sector_div(bm_blocks,
610-
bitmap->mddev->bitmap_info.chunksize >> 9);
609+
bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks,
610+
(bitmap->mddev->bitmap_info.chunksize >> 9));
611611
/* bits to bytes */
612612
bm_blocks = ((bm_blocks+7) >> 3) + sizeof(bitmap_super_t);
613613
/* to 4k blocks */

0 commit comments

Comments
 (0)