summaryrefslogtreecommitdiff
path: root/drivers/md/dm-raid1.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-12-10 23:52:04 +0000
committerAlasdair G Kergon <agk@redhat.com>2009-12-10 23:52:04 +0000
commit0f398a8403e31c737b429fddc3850093d0bf58d0 (patch)
tree4acfeaf25e028f4700d88c8b685fa7e6d83e8b96 /drivers/md/dm-raid1.c
parent04788507686d184d8166918b70ef52311bc36dcb (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/md/dm-raid1.c')
-rw-r--r--drivers/md/dm-raid1.c34
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)
{
struct bio *bio;
- if (!failures->head)
+ if (likely(!failures->head))
return;
- if (!ms->log_failure) {
- while ((bio = bio_list_pop(failures))) {
- ms->in_sync = 0;
- dm_rh_mark_nosync(ms->rh, bio, bio->bi_size, 0);
- }
- return;
- }
-
/*
* If the log has failed, unattempted writes are being
- * put on the failures list. We can't issue those writes
+ * put on the holds list. We can't issue those writes
* until a log has been marked, so we must store them.
*
* 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)
* for us to treat them the same and requeue them
* as well.
*/
- if (dm_noflush_suspending(ms->ti)) {
- while ((bio = bio_list_pop(failures)))
- bio_endio(bio, DM_ENDIO_REQUEUE);
- return;
- }
- if (atomic_read(&ms->suspend)) {
- while ((bio = bio_list_pop(failures)))
- bio_endio(bio, -EIO);
- return;
+ while ((bio = bio_list_pop(failures))) {
+ if (ms->log_failure)
+ hold_bio(ms, bio);
+ else {
+ ms->in_sync = 0;
+ dm_rh_mark_nosync(ms->rh, bio, bio->bi_size, 0);
+ }
}
-
- spin_lock_irq(&ms->lock);
- bio_list_merge(&ms->failures, failures);
- spin_unlock_irq(&ms->lock);
-
- delayed_wake(ms);
}
static void trigger_event(struct work_struct *work)