From: Stephen Rothwell Date: Tue, 3 Mar 2015 02:35:31 +0000 (+1100) Subject: md/bitmap: use sector_div for sector_t divisions X-Git-Tag: v5.15~15871^2~21^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b0e6aacbfe04fa144c4732f269b09ce91177566;p=platform%2Fkernel%2Flinux-starfive.git md/bitmap: use sector_div for sector_t divisions neilb: modified to not corrupt ->resync_max_sectors. sector_div usage fixed by Guoqing Jiang Signed-off-by: Stephen Rothwell Signed-off-by: NeilBrown --- diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 03e0752..ac79fef 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -571,9 +571,10 @@ static int bitmap_read_sb(struct bitmap *bitmap) re_read: /* If cluster_slot is set, the cluster is setup */ if (bitmap->cluster_slot >= 0) { - sector_t bm_blocks; + sector_t bm_blocks = bitmap->mddev->resync_max_sectors; - bm_blocks = bitmap->mddev->resync_max_sectors / (bitmap->mddev->bitmap_info.chunksize >> 9); + sector_div(bm_blocks, + bitmap->mddev->bitmap_info.chunksize >> 9); bm_blocks = bm_blocks << 3; bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks, 4096); bitmap->mddev->bitmap_info.offset += bitmap->cluster_slot * (bm_blocks << 3);