aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-06-26 03:28:01 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 12:58:40 -0400
commitf655675b3fe09c4d0506d357527fe07544623009 (patch)
tree969a798b6ba25b88f08b0f9cfe1aed323be81d3e /drivers/md
parenta94213b1fa7b26dcc271bf4b4f9eebf1f1af33a2 (diff)
[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.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 8603c0692eab..331b1bc95735 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1737,6 +1737,10 @@ state_show(mdk_rdev_t *rdev, char *page)
1737 len += sprintf(page+len, "%sin_sync",sep); 1737 len += sprintf(page+len, "%sin_sync",sep);
1738 sep = ","; 1738 sep = ",";
1739 } 1739 }
1740 if (test_bit(WriteMostly, &rdev->flags)) {
1741 len += sprintf(page+len, "%swrite_mostly",sep);
1742 sep = ",";
1743 }
1740 if (!test_bit(Faulty, &rdev->flags) && 1744 if (!test_bit(Faulty, &rdev->flags) &&
1741 !test_bit(In_sync, &rdev->flags)) { 1745 !test_bit(In_sync, &rdev->flags)) {
1742 len += sprintf(page+len, "%sspare", sep); 1746 len += sprintf(page+len, "%sspare", sep);
@@ -1751,6 +1755,8 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len)
1751 /* can write 1755 /* can write
1752 * faulty - simulates and error 1756 * faulty - simulates and error
1753 * remove - disconnects the device 1757 * remove - disconnects the device
1758 * writemostly - sets write_mostly
1759 * -writemostly - clears write_mostly
1754 */ 1760 */
1755 int err = -EINVAL; 1761 int err = -EINVAL;
1756 if (cmd_match(buf, "faulty") && rdev->mddev->pers) { 1762 if (cmd_match(buf, "faulty") && rdev->mddev->pers) {
@@ -1766,6 +1772,12 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len)
1766 md_new_event(mddev); 1772 md_new_event(mddev);
1767 err = 0; 1773 err = 0;
1768 } 1774 }
1775 } else if (cmd_match(buf, "writemostly")) {
1776 set_bit(WriteMostly, &rdev->flags);
1777 err = 0;
1778 } else if (cmd_match(buf, "-writemostly")) {
1779 clear_bit(WriteMostly, &rdev->flags);
1780 err = 0;
1769 } 1781 }
1770 return err ? err : len; 1782 return err ? err : len;
1771} 1783}