diff options
author | NeilBrown <neilb@suse.de> | 2015-03-23 17:36:38 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2015-04-22 08:00:40 +1000 |
commit | 50c37b136a3807eda44afe16529b5af701ec49f5 (patch) | |
tree | 2248b7342bdd5c1ceb5c1a991e04ab3c30149cd4 /drivers/md | |
parent | d51e4fe6d68098d4361a6b6d41d8da727b1f1af4 (diff) | |
download | linux-50c37b136a3807eda44afe16529b5af701ec49f5.tar.gz linux-50c37b136a3807eda44afe16529b5af701ec49f5.tar.bz2 linux-50c37b136a3807eda44afe16529b5af701ec49f5.zip |
md: don't require sync_min to be a multiple of chunk_size.
There is really no need for sync_min to be a multiple of
chunk_size, and values read from here often aren't.
That means you cannot read a value and expect to be able
to write it back later.
So remove the chunk_size check, and round down to a multiple
of 4K, to be sure everything works with 4K-sector devices.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 0d8968535976..3724a29eaf0e 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4427,7 +4427,6 @@ min_sync_store(struct mddev *mddev, const char *buf, size_t len) { unsigned long long min; int err; - int chunk; if (kstrtoull(buf, 10, &min)) return -EINVAL; @@ -4441,16 +4440,8 @@ min_sync_store(struct mddev *mddev, const char *buf, size_t len) if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) goto out_unlock; - /* Must be a multiple of chunk_size */ - chunk = mddev->chunk_sectors; - if (chunk) { - sector_t temp = min; - - err = -EINVAL; - if (sector_div(temp, chunk)) - goto out_unlock; - } - mddev->resync_min = min; + /* Round down to multiple of 4K for safety */ + mddev->resync_min = round_down(min, 8); err = 0; out_unlock: |