linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhao Heming <heming.zhao@suse.com>
To: linux-raid@vger.kernel.org, song@kernel.org
Cc: Zhao Heming <heming.zhao@suse.com>, guoqing.jiang@cloud.ionos.com
Subject: [PATCH v2 1/2] [md/bitmap] md_bitmap_read_sb uses wrong bitmap blocks
Date: Tue,  6 Oct 2020 00:00:23 +0800	[thread overview]
Message-ID: <1601913624-27840-1-git-send-email-heming.zhao@suse.com> (raw)

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>
---
v2:
- change grammar mistake in patch Subject
- fix code syntax error 

---
 drivers/md/md-bitmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index b10c51988c8e..553b6406ba1c 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -605,8 +605,8 @@ 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,
-			   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 */
-- 
2.27.0


             reply	other threads:[~2020-10-05 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 16:00 Zhao Heming [this message]
2020-10-05 16:00 ` [PATCH v2 2/2] [md/bitmap] md_bitmap_get_counter returns wrong blocks Zhao Heming
2020-10-08  6:35 ` [PATCH v2 1/2] [md/bitmap] md_bitmap_read_sb uses wrong bitmap blocks Song Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1601913624-27840-1-git-send-email-heming.zhao@suse.com \
    --to=heming.zhao@suse.com \
    --cc=guoqing.jiang@cloud.ionos.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).