Re: [PATCH V3 2/4] md/raid10: extend r10bio devs to raid disks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 08/13/2020 04:14 PM, Xiao Ni wrote:
Now it allocs r10bio->devs[conf->copies]. Discard bio needs to submit
to all member disks and it needs to use r10bio. So extend to
r10bio->devs[geo.raid_disks].

Reviewed-by: Coly Li <colyli@xxxxxxx>
Signed-off-by: Xiao Ni <xni@xxxxxxxxxx>
---
  drivers/md/raid10.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index cefda2a..cef3cb8 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -91,7 +91,7 @@ static inline struct r10bio *get_resync_r10bio(struct bio *bio)
  static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data)
  {
  	struct r10conf *conf = data;
-	int size = offsetof(struct r10bio, devs[conf->copies]);
+	int size = offsetof(struct r10bio, devs[conf->geo.raid_disks]);
/* allocate a r10bio with room for raid_disks entries in the
  	 * bios array */
@@ -238,7 +238,7 @@ static void put_all_bios(struct r10conf *conf, struct r10bio *r10_bio)
  {
  	int i;
- for (i = 0; i < conf->copies; i++) {
+	for (i = 0; i < conf->geo.raid_disks; i++) {
  		struct bio **bio = & r10_bio->devs[i].bio;
  		if (!BIO_SPECIAL(*bio))
  			bio_put(*bio);
@@ -327,7 +327,7 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,
  	int slot;
  	int repl = 0;
- for (slot = 0; slot < conf->copies; slot++) {
+	for (slot = 0; slot < conf->geo.raid_disks; slot++) {
  		if (r10_bio->devs[slot].bio == bio)
  			break;
  		if (r10_bio->devs[slot].repl_bio == bio) {
@@ -336,7 +336,7 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,
  		}
  	}
- BUG_ON(slot == conf->copies);
+	BUG_ON(slot == conf->geo.raid_disks);
Hi Song

I'm trying to fix the warning messages for these patches. What's your suggestion for this kind of things?
Is it ok to remove BUG_ON from the code? Or change BUG_ON to WARN_ON?

Regards
Xiao




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux