diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2009-12-10 18:52:04 -0500 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-12-10 18:52:04 -0500 |
commit | 0f398a8403e31c737b429fddc3850093d0bf58d0 (patch) | |
tree | 4acfeaf25e028f4700d88c8b685fa7e6d83e8b96 /drivers | |
parent | 04788507686d184d8166918b70ef52311bc36dcb (diff) |
dm raid1: use hold framework in do_failures
Use the hold framework in do_failures.
This patch doesn't change the bio processing logic, it just simplifies
failure handling and avoids periodically polling the failures list.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Takahiro Yasui <tyasui@redhat.com>
Tested-by: Takahiro Yasui <tyasui@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-raid1.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 895cce75eee9..0253130fa13a 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -745,20 +745,12 @@ static void do_failures(struct mirror_set *ms, struct bio_list *failures) | |||
745 | { | 745 | { |
746 | struct bio *bio; | 746 | struct bio *bio; |
747 | 747 | ||
748 | if (!failures->head) | 748 | if (likely(!failures->head)) |
749 | return; | 749 | return; |
750 | 750 | ||
751 | if (!ms->log_failure) { | ||
752 | while ((bio = bio_list_pop(failures))) { | ||
753 | ms->in_sync = 0; | ||
754 | dm_rh_mark_nosync(ms->rh, bio, bio->bi_size, 0); | ||
755 | } | ||
756 | return; | ||
757 | } | ||
758 | |||
759 | /* | 751 | /* |
760 | * If the log has failed, unattempted writes are being | 752 | * If the log has failed, unattempted writes are being |
761 | * put on the failures list. We can't issue those writes | 753 | * put on the holds list. We can't issue those writes |
762 | * until a log has been marked, so we must store them. | 754 | * until a log has been marked, so we must store them. |
763 | * | 755 | * |
764 | * If a 'noflush' suspend is in progress, we can requeue | 756 | * If a 'noflush' suspend is in progress, we can requeue |
@@ -773,23 +765,15 @@ static void do_failures(struct mirror_set *ms, struct bio_list *failures) | |||
773 | * for us to treat them the same and requeue them | 765 | * for us to treat them the same and requeue them |
774 | * as well. | 766 | * as well. |
775 | */ | 767 | */ |
776 | if (dm_noflush_suspending(ms->ti)) { | ||
777 | while ((bio = bio_list_pop(failures))) | ||
778 | bio_endio(bio, DM_ENDIO_REQUEUE); | ||
779 | return; | ||
780 | } | ||
781 | 768 | ||
782 | if (atomic_read(&ms->suspend)) { | 769 | while ((bio = bio_list_pop(failures))) { |
783 | while ((bio = bio_list_pop(failures))) | 770 | if (ms->log_failure) |
784 | bio_endio(bio, -EIO); | 771 | hold_bio(ms, bio); |
785 | return; | 772 | else { |
773 | ms->in_sync = 0; | ||
774 | dm_rh_mark_nosync(ms->rh, bio, bio->bi_size, 0); | ||
775 | } | ||
786 | } | 776 | } |
787 | |||
788 | spin_lock_irq(&ms->lock); | ||
789 | bio_list_merge(&ms->failures, failures); | ||
790 | spin_unlock_irq(&ms->lock); | ||
791 | |||
792 | delayed_wake(ms); | ||
793 | } | 777 | } |
794 | 778 | ||
795 | static void trigger_event(struct work_struct *work) | 779 | static void trigger_event(struct work_struct *work) |