diff options
author | NeilBrown <neilb@suse.de> | 2006-06-26 07:28:01 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 16:58:40 (GMT) |
commit | f655675b3fe09c4d0506d357527fe07544623009 (patch) | |
tree | 969a798b6ba25b88f08b0f9cfe1aed323be81d3e /drivers/md | |
parent | a94213b1fa7b26dcc271bf4b4f9eebf1f1af33a2 (diff) | |
download | linux-fsl-qoriq-f655675b3fe09c4d0506d357527fe07544623009.tar.xz |
[PATCH] md: Allow the write_mostly flag to be set via sysfs
It appears in /sys/mdX/md/dev-YYY/state
and can be set or cleared by writing 'writemostly' or '-writemostly'
respectively.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 8603c06..331b1bc 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1737,6 +1737,10 @@ state_show(mdk_rdev_t *rdev, char *page) len += sprintf(page+len, "%sin_sync",sep); sep = ","; } + if (test_bit(WriteMostly, &rdev->flags)) { + len += sprintf(page+len, "%swrite_mostly",sep); + sep = ","; + } if (!test_bit(Faulty, &rdev->flags) && !test_bit(In_sync, &rdev->flags)) { len += sprintf(page+len, "%sspare", sep); @@ -1751,6 +1755,8 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len) /* can write * faulty - simulates and error * remove - disconnects the device + * writemostly - sets write_mostly + * -writemostly - clears write_mostly */ int err = -EINVAL; if (cmd_match(buf, "faulty") && rdev->mddev->pers) { @@ -1766,6 +1772,12 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len) md_new_event(mddev); err = 0; } + } else if (cmd_match(buf, "writemostly")) { + set_bit(WriteMostly, &rdev->flags); + err = 0; + } else if (cmd_match(buf, "-writemostly")) { + clear_bit(WriteMostly, &rdev->flags); + err = 0; } return err ? err : len; } |