Re: [PATCH 1/3] md: add 'size' as a personality method

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

 



On Fri, Mar 6, 2009 at 9:15 AM, Andre Noll <maan@xxxxxxxxxxxxxxx> wrote:
> 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.
>

This is a leftover from an earlier version of the patch where I was
allowing chunk_size to specified.  Since we do not support chunk_size
reshaping I dropped the extra argument, will clean this up as well.

>> +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?
>

Yes.

Thanks,
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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