Re: [PATCH] md: Use new topology calls to indicate alignment and I/O sizes

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

 



On Tue, June 9, 2009 2:31 pm, Martin K. Petersen wrote:
>
> Switch MD over to the new disk_stack_limits() function which checks for
> aligment and adjusts preferred I/O sizes when stacking.
>
> Also indicate preferred I/O sizes where applicable.
>
> Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
>
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index ae12cea..dfd18df 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -2044,7 +2044,7 @@ raid10_size(mddev_t *mddev, sector_t sectors, int
> raid_disks)
>  static int run(mddev_t *mddev)
>  {
>  	conf_t *conf;
> -	int i, disk_idx;
> +	int i, disk_idx, chunk_size;
>  	mirror_info_t *disk;
>  	mdk_rdev_t *rdev;
>  	int nc, fc, fo;
> @@ -2130,6 +2130,10 @@ static int run(mddev_t *mddev)
>  	spin_lock_init(&conf->device_lock);
>  	mddev->queue->queue_lock = &conf->device_lock;
>
> +	chunk_size = mddev->chunk_sectors << 9;
> +	blk_queue_io_min(mddev->queue, chunk_size);
> +	blk_queue_io_opt(mddev->queue, chunk_size * (mddev->raid_disks >> 1));

 ">> 1" is wrong.  A raid10 may have more than 2 copies for each block.
This calculation needs to be a bit more subtle and take about of the
particular layout (near, offset, or far).


> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 41dc36e..ea8d3fd 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -4451,7 +4451,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev)
>  static int run(mddev_t *mddev)
>  {
>  	raid5_conf_t *conf;
> -	int working_disks = 0;
> +	int working_disks = 0, chunk_size;
>  	mdk_rdev_t *rdev;
>
>  	if (mddev->recovery_cp != MaxSector)
> @@ -4606,6 +4606,19 @@ static int run(mddev_t *mddev)
>  	md_set_array_sectors(mddev, raid5_size(mddev, 0, 0));
>
>  	blk_queue_merge_bvec(mddev->queue, raid5_mergeable_bvec);
> +	chunk_size = mddev->chunk_sectors << 9;
> +	blk_queue_io_min(mddev->queue, chunk_size);
> +
> +	if (mddev->level == 5)
> +		blk_queue_io_opt(mddev->queue,
> +				 chunk_size * (mddev->raid_disks - 1));
> +	else
> +		blk_queue_io_opt(mddev->queue,
> +				 chunk_size * (mddev->raid_disks - 2));
> +

You seem to be treating raid4 like raid6 :-)
probably what you want is
     blk_queue_io_opt(mddev->queue,
                      chunk_size * (conf->raid_disks - conf->max_degraded));

I'll be a closer look at the patch in the next day or two.

Thanks,
NeilBrown

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