]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
md: don't require sync_min to be a multiple of chunk_size.
authorNeilBrown <neilb@suse.de>
Mon, 23 Mar 2015 06:36:38 +0000 (17:36 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 8 Apr 2015 02:57:50 +0000 (12:57 +1000)
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>
drivers/md/md.c

index e6c5ac2fb4be48e205071064801c055f7cd80e81..19ba9e5ca9117fa2e539085d138e7fb063c1a01f 100644 (file)
@@ -4378,7 +4378,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;
@@ -4392,16 +4391,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: