--- linux-2.6.11.6/drivers/md/raid1.c.orig Sat Mar 26 04:28:21 2005 +++ linux-2.6.11.6/drivers/md/raid1.c Sun Jun 12 00:32:54 2005 @@ -589,13 +792,45 @@ !conf->mirrors[i].rdev->faulty) { atomic_inc(&conf->mirrors[i].rdev->nr_pending); r1_bio->bios[i] = bio; - } else + } else { +#ifdef CONFIG_MD_FR1 + sum_bios++; +#endif /* CONFIG_MD_FR1 */ r1_bio->bios[i] = NULL; - } +#ifdef CONFIG_MD_FR1 + sum_nobios++; +#endif /* CONFIG_MD_FR1 */ + } + /* zero the bad disk count on the r1bio by default */ + } +#ifdef CONFIG_MD_FR1 + r1_bio->nonoperational = 0; +#endif /* CONFIG_MD_FR1 */ rcu_read_unlock(); +#ifdef CONFIG_MD_FR1 + /* mark the bitmap before write, just in case */ + if (bitmap->active(bitmap)) { + bitmap->setbits(bitmap, r1_bio->sector >> 1, + r1_bio->sectors >> 1); + } +#endif /* CONFIG_MD_FR1 */ + atomic_set(&r1_bio->remaining, 1); md_write_start(mddev); +#ifdef CONFIG_MD_FR1 + /* count inactive disks, note bitmap dirty if didn't know before */ + if (sum_nobios > 0) { + /* mark bitmap as dirty if it wasn't so marked */ + spin_lock_irq(&conf->device_lock); + if (!conf->bitmap_dirty && bitmap->active(bitmap)) { + conf->bitmap_dirty = 1; + mddev->bitmap_events = mddev->events; + } + spin_unlock_irq(&conf->device_lock); + } + r1_bio->nonoperational = sum_nobios; +#endif /* CONFIG_MD_FR1 */ for (i = 0; i < disks; i++) { struct bio *mbio; if (!r1_bio->bios[i])