Thread (4 messages) 4 messages, 2 authors, 2020-10-05

Re: [PATCH 1/2] [md/bitmap] md_bitmap_read_sb use wrong bitmap blocks

From: heming.zhao@suse.com <hidden>
Date: 2020-10-03 16:26:33

very sorry for my mistake.

the patch should be change from:
-		sector_div(bm_blocks,
+		DIV_ROUND_UP_SECTOR_T(bm_blocks,
   			   bitmap->mddev->bitmap_info.chunksize >> 9);
to
-               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));
If my patch would be accepted, I will send v2 patch including above lines.


On 10/4/20 12:11 AM, Zhao Heming wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
  drivers/md/md-bitmap.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 593fe15..1efd2b4 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -605,7 +605,7 @@ static int md_bitmap_read_sb(struct bitmap *bitmap)
  	if (bitmap->cluster_slot >= 0) {
  		sector_t bm_blocks = bitmap->mddev->resync_max_sectors;
  
-		sector_div(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);
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help