aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index ae654466dc23..f1ac356e656d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -670,6 +670,7 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev)
670 670
671 if (mddev->level != LEVEL_MULTIPATH) { 671 if (mddev->level != LEVEL_MULTIPATH) {
672 rdev->faulty = 0; 672 rdev->faulty = 0;
673 rdev->flags = 0;
673 desc = sb->disks + rdev->desc_nr; 674 desc = sb->disks + rdev->desc_nr;
674 675
675 if (desc->state & (1<<MD_DISK_FAULTY)) 676 if (desc->state & (1<<MD_DISK_FAULTY))
@@ -679,6 +680,8 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev)
679 rdev->in_sync = 1; 680 rdev->in_sync = 1;
680 rdev->raid_disk = desc->raid_disk; 681 rdev->raid_disk = desc->raid_disk;
681 } 682 }
683 if (desc->state & (1<<MD_DISK_WRITEMOSTLY))
684 set_bit(WriteMostly, &rdev->flags);
682 } else /* MULTIPATH are always insync */ 685 } else /* MULTIPATH are always insync */
683 rdev->in_sync = 1; 686 rdev->in_sync = 1;
684 return 0; 687 return 0;
@@ -777,6 +780,8 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
777 spare++; 780 spare++;
778 working++; 781 working++;
779 } 782 }
783 if (test_bit(WriteMostly, &rdev2->flags))
784 d->state |= (1<<MD_DISK_WRITEMOSTLY);
780 } 785 }
781 786
782 /* now set the "removed" and "faulty" bits on any missing devices */ 787 /* now set the "removed" and "faulty" bits on any missing devices */
@@ -990,6 +995,9 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
990 rdev->raid_disk = role; 995 rdev->raid_disk = role;
991 break; 996 break;
992 } 997 }
998 rdev->flags = 0;
999 if (sb->devflags & WriteMostly1)
1000 set_bit(WriteMostly, &rdev->flags);
993 } else /* MULTIPATH are always insync */ 1001 } else /* MULTIPATH are always insync */
994 rdev->in_sync = 1; 1002 rdev->in_sync = 1;
995 1003
@@ -2152,6 +2160,8 @@ static int get_disk_info(mddev_t * mddev, void __user * arg)
2152 info.state |= (1<<MD_DISK_ACTIVE); 2160 info.state |= (1<<MD_DISK_ACTIVE);
2153 info.state |= (1<<MD_DISK_SYNC); 2161 info.state |= (1<<MD_DISK_SYNC);
2154 } 2162 }
2163 if (test_bit(WriteMostly, &rdev->flags))
2164 info.state |= (1<<MD_DISK_WRITEMOSTLY);
2155 } else { 2165 } else {
2156 info.major = info.minor = 0; 2166 info.major = info.minor = 0;
2157 info.raid_disk = -1; 2167 info.raid_disk = -1;
@@ -2237,6 +2247,9 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
2237 rdev->saved_raid_disk = rdev->raid_disk; 2247 rdev->saved_raid_disk = rdev->raid_disk;
2238 2248
2239 rdev->in_sync = 0; /* just to be sure */ 2249 rdev->in_sync = 0; /* just to be sure */
2250 if (info->state & (1<<MD_DISK_WRITEMOSTLY))
2251 set_bit(WriteMostly, &rdev->flags);
2252
2240 rdev->raid_disk = -1; 2253 rdev->raid_disk = -1;
2241 err = bind_rdev_to_array(rdev, mddev); 2254 err = bind_rdev_to_array(rdev, mddev);
2242 if (err) 2255 if (err)
@@ -2277,6 +2290,9 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
2277 else 2290 else
2278 rdev->in_sync = 0; 2291 rdev->in_sync = 0;
2279 2292
2293 if (info->state & (1<<MD_DISK_WRITEMOSTLY))
2294 set_bit(WriteMostly, &rdev->flags);
2295
2280 err = bind_rdev_to_array(rdev, mddev); 2296 err = bind_rdev_to_array(rdev, mddev);
2281 if (err) { 2297 if (err) {
2282 export_rdev(rdev); 2298 export_rdev(rdev);
@@ -3329,6 +3345,8 @@ static int md_seq_show(struct seq_file *seq, void *v)
3329 char b[BDEVNAME_SIZE]; 3345 char b[BDEVNAME_SIZE];
3330 seq_printf(seq, " %s[%d]", 3346 seq_printf(seq, " %s[%d]",
3331 bdevname(rdev->bdev,b), rdev->desc_nr); 3347 bdevname(rdev->bdev,b), rdev->desc_nr);
3348 if (test_bit(WriteMostly, &rdev->flags))
3349 seq_printf(seq, "(W)");
3332 if (rdev->faulty) { 3350 if (rdev->faulty) {
3333 seq_printf(seq, "(F)"); 3351 seq_printf(seq, "(F)");
3334 continue; 3352 continue;