summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorZhao Heming <heming.zhao@suse.com>2020-10-05 19:00:23 +0300
committerSong Liu <songliubraving@fb.com>2020-10-09 08:31:29 +0300
commita913096decbf4101271e7d87b9affb1454bb7676 (patch)
tree7bac2ad259872d46457d3fb351ddbe75f79e55a2 /drivers/md
parentd7a1c483f797fb92c091e66b6a6e941f766b84e0 (diff)
downloadlinux-a913096decbf4101271e7d87b9affb1454bb7676.tar.xz
md/bitmap: md_bitmap_read_sb uses wrong bitmap blocks
The patched code is used to get chunks number, should use round-up div to replace current sector_div. The same code is in md_bitmap_resize(): ``` chunks = DIV_ROUND_UP_SECTOR_T(blocks, 1 << chunkshift); ``` Signed-off-by: Zhao Heming <heming.zhao@suse.com> Signed-off-by: Song Liu <songliubraving@fb.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md-bitmap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 55b757a223a4..cd9a12ca281d 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -606,8 +606,8 @@ re_read:
if (bitmap->cluster_slot >= 0) {
sector_t bm_blocks = bitmap->mddev->resync_max_sectors;
- sector_div(bm_blocks,
- bitmap->mddev->bitmap_info.chunksize >> 9);
+ bm_blocks = DIV_ROUND_UP_SECTOR_T(bm_blocks,
+ (bitmap->mddev->bitmap_info.chunksize >> 9));
/* bits to bytes */
bm_blocks = ((bm_blocks+7) >> 3) + sizeof(bitmap_super_t);
/* to 4k blocks */