Commit 124eb761 authored by Goldwyn Rodrigues's avatar Goldwyn Rodrigues Committed by NeilBrown

md: Fix bitmap offset calculations

The calculations of bitmap offset is incorrect with respect to bits to bytes
conversion.

Also, remove an irrelevant duplicate message.
Signed-off-by: default avatarGoldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 09dd1af2
...@@ -575,7 +575,9 @@ static int bitmap_read_sb(struct bitmap *bitmap) ...@@ -575,7 +575,9 @@ static int bitmap_read_sb(struct bitmap *bitmap)
sector_div(bm_blocks, sector_div(bm_blocks,
bitmap->mddev->bitmap_info.chunksize >> 9); bitmap->mddev->bitmap_info.chunksize >> 9);
bm_blocks = bm_blocks << 3; /* bits to bytes */
bm_blocks = ((bm_blocks+7) >> 3) + sizeof(bitmap_super_t);
/* to 4k blocks */
bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks, 4096); bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks, 4096);
bitmap->mddev->bitmap_info.offset += bitmap->cluster_slot * (bm_blocks << 3); bitmap->mddev->bitmap_info.offset += bitmap->cluster_slot * (bm_blocks << 3);
pr_info("%s:%d bm slot: %d offset: %llu\n", __func__, __LINE__, pr_info("%s:%d bm slot: %d offset: %llu\n", __func__, __LINE__,
...@@ -672,9 +674,6 @@ static int bitmap_read_sb(struct bitmap *bitmap) ...@@ -672,9 +674,6 @@ static int bitmap_read_sb(struct bitmap *bitmap)
goto out_no_sb; goto out_no_sb;
} }
bitmap->cluster_slot = md_cluster_ops->slot_number(bitmap->mddev); bitmap->cluster_slot = md_cluster_ops->slot_number(bitmap->mddev);
pr_info("%s:%d bm slot: %d offset: %llu\n", __func__, __LINE__,
bitmap->cluster_slot,
(unsigned long long)bitmap->mddev->bitmap_info.offset);
goto re_read; goto re_read;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment