diff options
author | NeilBrown <neilb@suse.de> | 2008-10-25 09:20:49 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-10-25 09:20:49 +0200 |
commit | b3d3195538e315b3863235731112eee7398d4340 (patch) | |
tree | 7decf7dd32fe805c1206efc93e54fea1f23af378 /Manage.c | |
parent | Remove .UR .UE macros from man page because the don't do what we want. (diff) | |
download | mdadm-b3d3195538e315b3863235731112eee7398d4340.tar.xz mdadm-b3d3195538e315b3863235731112eee7398d4340.zip |
Allow WRITEMOSTLY to be cleared on --readd using --readwrite.
Previously it was possible to set the WRITEMOSTLY flag when
adding a device to an array, but not to clear the flag when re-adding.
This is now possible with --readwrite.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Manage.c')
-rw-r--r-- | Manage.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -413,8 +413,10 @@ int Manage_subdevs(char *devname, int fd, disc.number = mdi.disk.number; disc.raid_disk = mdi.disk.raid_disk; disc.state = mdi.disk.state; - if (dv->writemostly) + if (dv->writemostly == 1) disc.state |= 1 << MD_DISK_WRITEMOSTLY; + if (dv->writemostly == 2) + disc.state &= ~(1 << MD_DISK_WRITEMOSTLY); if (ioctl(fd, ADD_NEW_DISK, &disc) == 0) { if (verbose >= 0) fprintf(stderr, Name ": re-added %s\n", dv->devname); @@ -452,7 +454,7 @@ int Manage_subdevs(char *devname, int fd, disc.number =j; disc.state = 0; if (array.not_persistent==0) { - if (dv->writemostly) + if (dv->writemostly == 1) disc.state |= 1 << MD_DISK_WRITEMOSTLY; tst->ss->add_to_super(tst, &disc); if (tst->ss->write_init_super(tst, &disc, @@ -487,7 +489,7 @@ int Manage_subdevs(char *devname, int fd, break; } } - if (dv->writemostly) + if (dv->writemostly == 1) disc.state |= (1 << MD_DISK_WRITEMOSTLY); if (ioctl(fd,ADD_NEW_DISK, &disc)) { fprintf(stderr, Name ": add new device failed for %s as %d: %s\n", |