]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: Remove unnecessary optimization
authorJes Sorensen <jes@wobbly.dhcp.thefacebook.com>
Thu, 30 Mar 2017 14:39:29 +0000 (10:39 -0400)
committerJes Sorensen <Jes.Sorensen@gmail.com>
Thu, 30 Mar 2017 14:44:36 +0000 (10:44 -0400)
Per explanation by Neil, this optimization of writing "size" to the
attribute of each device, however when reducing the size of devices,
the size change isn't permitted until the array has been shrunk, so
this will fail anyway.

This effectively reverts 65a9798b58b4e4de0157043e2b30a738c27eff43

Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Grow.c

diff --git a/Grow.c b/Grow.c
index af8d5205848007dbd5fca12ce2e7dc85bb90d3e6..0d551ce0785c7771969d3c41d32a21b288ff42ce 100755 (executable)
--- a/Grow.c
+++ b/Grow.c
@@ -1982,15 +1982,7 @@ int Grow_reshape(char *devname, int fd,
                 * understands '0' to mean 'max'.
                 */
                min_csize = 0;
-               rv = 0;
                for (mdi = sra->devs; mdi; mdi = mdi->next) {
-                       if (sysfs_set_num(sra, mdi, "size",
-                                         s->size == MAX_SIZE ? 0 : s->size) < 0) {
-                               /* Probably kernel refusing to let us
-                                * reduce the size - not an error.
-                                */
-                               break;
-                       }
                        if (array.not_persistent == 0 &&
                            array.major_version == 0 &&
                            get_linux_version() < 3001000) {
@@ -2005,10 +1997,6 @@ int Grow_reshape(char *devname, int fd,
                                }
                        }
                }
-               if (rv) {
-                       pr_err("Cannot set size on array members.\n");
-                       goto size_change_error;
-               }
                if (min_csize && s->size > min_csize) {
                        pr_err("Cannot safely make this array use more than 2TB per device on this kernel.\n");
                        rv = 1;