On 17:24, Dan Williams wrote: > +raid10_size(mddev_t *mddev, sector_t sectors, int raid_disks) > +{ > + sector_t size; > + int chunk_shift; > + conf_t *conf = mddev_to_conf(mddev); > + int chunk_size = mddev->chunk_size; > + > + if (!raid_disks) > + raid_disks = mddev->raid_disks; > + if (!sectors) > + sectors = mddev->dev_sectors; > + > + chunk_shift = ffz(~chunk_size) - 9; > + size = sectors >> chunk_shift; > + sector_div(size, conf->far_copies); > + size = size * raid_disks; > + sector_div(size, conf->near_copies); > + > + return size << chunk_shift; > +} Is there a reason you are recomputing chunk_shift instead of using conf->chunk_shift. > +static sector_t > +raid5_size(mddev_t *mddev, sector_t sectors, int raid_disks) > +{ > + raid5_conf_t *conf = mddev_to_conf(mddev); > + int chunk_size = mddev->chunk_size; > + > + if (!sectors) > + sectors = mddev->dev_sectors; > + if (!raid_disks) > + raid_disks = conf->previous_raid_disks; > + > + sectors &= ~(chunk_size / 512 - 1); Don't we need a cast to sector_t here? Andre -- The only person who always got his work done by Friday was Robinson Crusoe
Attachment:
signature.asc
Description: Digital signature