aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2015-03-02 21:35:31 -0500
committerNeilBrown <neilb@suse.de>2015-03-03 21:08:16 -0500
commit3b0e6aacbfe04fa144c4732f269b09ce91177566 (patch)
tree8ebbb494eec91dd732fd6e8b923b212da09f9740
parent935f3d4fc62c1f4d99cd13344762e766cd3bf115 (diff)
md/bitmap: use sector_div for sector_t divisions
neilb: modified to not corrupt ->resync_max_sectors. sector_div usage fixed by Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--drivers/md/bitmap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 03e0752af99f..ac79fef68143 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -571,9 +571,10 @@ static int bitmap_read_sb(struct bitmap *bitmap)
571re_read: 571re_read:
572 /* If cluster_slot is set, the cluster is setup */ 572 /* If cluster_slot is set, the cluster is setup */
573 if (bitmap->cluster_slot >= 0) { 573 if (bitmap->cluster_slot >= 0) {
574 sector_t bm_blocks; 574 sector_t bm_blocks = bitmap->mddev->resync_max_sectors;
575 575
576 bm_blocks = bitmap->mddev->resync_max_sectors / (bitmap->mddev->bitmap_info.chunksize >> 9); 576 sector_div(bm_blocks,
577 bitmap->mddev->bitmap_info.chunksize >> 9);
577 bm_blocks = bm_blocks << 3; 578 bm_blocks = bm_blocks << 3;
578 bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks, 4096); 579 bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks, 4096);
579 bitmap->mddev->bitmap_info.offset += bitmap->cluster_slot * (bm_blocks << 3); 580 bitmap->mddev->bitmap_info.offset += bitmap->cluster_slot * (bm_blocks << 3);