md/bitmap: use sector_div for sector_t divisions
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 3 Mar 2015 02:35:31 +0000 (13:35 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 4 Mar 2015 02:08:16 +0000 (13:08 +1100)
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>
drivers/md/bitmap.c

index 03e0752af99f9bcf7f689c18d5b54ccd1db1b76a..ac79fef681434938ce872fb6b9ce54548853da65 100644 (file)
@@ -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);