Re: [PATCH 3/4] md: Make mddev->array_size sector-based.

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

 



On 20:29, Neil Brown wrote:
> On Friday July 18, maan@xxxxxxxxxxxxxxx wrote:
> > index 8f4c70a..1e1a217 100644
> > --- a/drivers/md/raid5.c
> > +++ b/drivers/md/raid5.c
> > @@ -4413,8 +4413,8 @@ static int raid5_resize(mddev_t *mddev, sector_t sectors)
> >  	raid5_conf_t *conf = mddev_to_conf(mddev);
> >  
> >  	sectors &= ~((sector_t)mddev->chunk_size/512 - 1);
> > -	mddev->array_size = (sectors * (mddev->raid_disks-conf->max_degraded))>>1;
> > -	set_capacity(mddev->gendisk, mddev->array_size << 1);
> > +	mddev->array_sectors = sectors * mddev->raid_disks-conf->max_degraded;
> > +	set_capacity(mddev->gendisk, mddev->array_sectors);
> >  	mddev->changed = 1;
> >  	if (sectors/2  > mddev->size && mddev->recovery_cp == MaxSector) {
> >  		mddev->recovery_cp = mddev->size << 1;
> 
> Can you spot the bug in this chunk?
> 
> There is a subtraction in there which is no longer inside parentheses,
> so the multiplication takes precedence.

Uhuhu.. Such bugs are hard to spot for the human eye.

> I've fixed it and put spaces around the '-' to make it more obvious.

Thanks.

> The rest are OK.

Glad to hear that.

> For future patches, could you please:
> 
> 1/ run ./scripts/checkpatch.pl on them and fix the warnings, mostly
>    line length issues in this case.
> 2/ run the mdadm test suite on a kernel with the patches applied.

Will do that before sending the next batch (probably tomorrow).

Thanks
Andre
-- 
The only person who always got his work done by Friday was Robinson Crusoe

Attachment: signature.asc
Description: Digital signature


[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