aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bitmap.c
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.de>2015-03-24 12:29:05 -0400
committerNeilBrown <neilb@suse.de>2015-03-24 22:07:55 -0400
commit124eb761edfdee13c02e48815b05d9bed7666d4c (patch)
tree4bcfdac47a47a12a5b15c8d4b86a3bc91403e6eb /drivers/md/bitmap.c
parent09dd1af2e011a13adce65b74425dfe31e1985e64 (diff)
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: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r--drivers/md/bitmap.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index ac79fef68143..e98db04eb4f9 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -575,7 +575,9 @@ re_read:
575 575
576 sector_div(bm_blocks, 576 sector_div(bm_blocks,
577 bitmap->mddev->bitmap_info.chunksize >> 9); 577 bitmap->mddev->bitmap_info.chunksize >> 9);
578 bm_blocks = bm_blocks << 3; 578 /* bits to bytes */
579 bm_blocks = ((bm_blocks+7) >> 3) + sizeof(bitmap_super_t);
580 /* to 4k blocks */
579 bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks, 4096); 581 bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks, 4096);
580 bitmap->mddev->bitmap_info.offset += bitmap->cluster_slot * (bm_blocks << 3); 582 bitmap->mddev->bitmap_info.offset += bitmap->cluster_slot * (bm_blocks << 3);
581 pr_info("%s:%d bm slot: %d offset: %llu\n", __func__, __LINE__, 583 pr_info("%s:%d bm slot: %d offset: %llu\n", __func__, __LINE__,
@@ -672,9 +674,6 @@ out:
672 goto out_no_sb; 674 goto out_no_sb;
673 } 675 }
674 bitmap->cluster_slot = md_cluster_ops->slot_number(bitmap->mddev); 676 bitmap->cluster_slot = md_cluster_ops->slot_number(bitmap->mddev);
675 pr_info("%s:%d bm slot: %d offset: %llu\n", __func__, __LINE__,
676 bitmap->cluster_slot,
677 (unsigned long long)bitmap->mddev->bitmap_info.offset);
678 goto re_read; 677 goto re_read;
679 } 678 }
680 679