Re: md/raid1:If r1bio->sectors % 8 != 0,then the memcmp and latermemcpy will omit the last bio_vec.

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


On Thu, 5 Apr 2012 14:12:25 +0800 "kedacomkernel" <kedacomkernel@xxxxxxxxx>
wrote:

> I readed your patch and found it wrong.My patch had two point
> 1:memcmp probem.You patch can correct it.
> 2:omit the last bio_vec.You patch did not correct it.
> If r1bio->sectors %8 != 0,supposed sectors = 18,then bio cover three pages. 
> But:
> 	>>int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9); vcnt=2
> then
>     >>for (j = vcnt; j-- ; )  
>       j = 1, 0
> 

Ahhh, yes of course.
Thanks.

> > @@ -1711,7 +1711,7 @@ static int process_checks(struct r1bio *r1_bio)
> >  	struct mddev *mddev = r1_bio->mddev;
> >  	struct r1conf *conf = mddev->private;
> >  	int primary;
> > -	int i;
> > +	int i, vcnt;
> >  
> >  	for (primary = 0; primary < conf->raid_disks * 2; primary++)
> >  		if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&
> > @@ -1721,9 +1721,9 @@ static int process_checks(struct r1bio *r1_bio)
> >  			break;
> >  		}
> >  	r1_bio->read_disk = primary;
> > +	vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9);
> >  	for (i = 0; i < conf->raid_disks * 2; i++) {
> >  		int j;
> > -		int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9);
> >  		struct bio *pbio = r1_bio->bios[primary];
> >  		struct bio *sbio = r1_bio->bios[i];
> >  		int size;

This bit.

I'll make sure that gets applied.

Thanks,
NeilBrown


Attachment: signature.asc
Description: PGP signature


[ATA RAID]     [Linux SCSI Target Infrastructure]     [Managing RAID on Linux]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device-Mapper]     [Kernel]     [Linux Books]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Photos]     [Yosemite Photos]     [Yosemite News]     [AMD 64]     [Linux Networking]

Add to Google Powered by Linux