2013-10-30 12:20:29

by Baldysiak, Pawel

[permalink] [raw]
Subject: [PATCH] raid0: Set discard_granularity to correct value after reshape.

In case of reshape of raid0 through raid4 a value of discard_granularity
will be set to stripe size. MD driver should re-set this value to correct
one when migration will be finished. Otherwise array will be left with
wrong value and discard operations will not work properly.

Signed-off-by: Pawel Baldysiak <[email protected]>
Cc: Shaohua Li <[email protected]>
---
drivers/md/raid0.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index c4d420b..807ca3a 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -266,6 +266,8 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
}
mddev->queue->backing_dev_info.congested_fn = raid0_congested;
mddev->queue->backing_dev_info.congested_data = mddev;
+ mddev->queue->limits.discard_granularity =
+ queue_logical_block_size(mddev->queue);

/*
* now since we have the hard sector sizes, we can make sure


2013-10-31 00:16:29

by NeilBrown

[permalink] [raw]
Subject: Re: [PATCH] raid0: Set discard_granularity to correct value after reshape.

On Wed, 30 Oct 2013 13:20:22 +0100 Pawel Baldysiak
<[email protected]> wrote:

> In case of reshape of raid0 through raid4 a value of discard_granularity
> will be set to stripe size. MD driver should re-set this value to correct
> one when migration will be finished. Otherwise array will be left with
> wrong value and discard operations will not work properly.
>
> Signed-off-by: Pawel Baldysiak <[email protected]>
> Cc: Shaohua Li <[email protected]>
> ---
> drivers/md/raid0.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
> index c4d420b..807ca3a 100644
> --- a/drivers/md/raid0.c
> +++ b/drivers/md/raid0.c
> @@ -266,6 +266,8 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
> }
> mddev->queue->backing_dev_info.congested_fn = raid0_congested;
> mddev->queue->backing_dev_info.congested_data = mddev;
> + mddev->queue->limits.discard_granularity =
> + queue_logical_block_size(mddev->queue);
>
> /*
> * now since we have the hard sector sizes, we can make sure

Thanks, but this doesn't seem like the right sort of fix. It is to specific
to the symptom rather than trying to address the underlying problem.

Maybe something like this? Can you review and test?

Thanks,
NeilBrown


diff --git a/drivers/md/md.c b/drivers/md/md.c
index 628cd529343f..740b6340f980 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3620,6 +3620,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
mddev->in_sync = 1;
del_timer_sync(&mddev->safemode_timer);
}
+ blk_set_stacking_limit(&mddev->queue->limits);
pers->run(mddev);
set_bit(MD_CHANGE_DEVS, &mddev->flags);
mddev_resume(mddev);


Attachments:
signature.asc (828.00 B)