--- zzzz-none-000/linux-2.6.19.2/drivers/md/dm-raid1.c 2007-01-10 19:10:37.000000000 +0000 +++ davinci-8020-5505/linux-2.6.19.2/drivers/md/dm-raid1.c 2007-01-11 07:38:19.000000000 +0000 @@ -24,7 +24,6 @@ static struct workqueue_struct *_kmirrord_wq; static struct work_struct _kmirrord_work; -static DECLARE_WAIT_QUEUE_HEAD(_kmirrord_recovery_stopped); static inline void wake(void) { @@ -84,7 +83,6 @@ struct list_head *buckets; spinlock_t region_lock; - atomic_t recovery_in_flight; struct semaphore recovery_count; struct list_head clean_regions; struct list_head quiesced_regions; @@ -193,7 +191,6 @@ spin_lock_init(&rh->region_lock); sema_init(&rh->recovery_count, 0); - atomic_set(&rh->recovery_in_flight, 0); INIT_LIST_HEAD(&rh->clean_regions); INIT_LIST_HEAD(&rh->quiesced_regions); INIT_LIST_HEAD(&rh->recovered_regions); @@ -385,8 +382,6 @@ rh->log->type->clear_region(rh->log, reg->key); rh->log->type->complete_resync_work(rh->log, reg->key, 1); dispatch_bios(rh->ms, ®->delayed_bios); - if (atomic_dec_and_test(&rh->recovery_in_flight)) - wake_up_all(&_kmirrord_recovery_stopped); up(&rh->recovery_count); mempool_free(reg, rh->region_pool); } @@ -507,21 +502,11 @@ static void rh_recovery_prepare(struct region_hash *rh) { - /* Extra reference to avoid race with rh_stop_recovery */ - atomic_inc(&rh->recovery_in_flight); - - while (!down_trylock(&rh->recovery_count)) { - atomic_inc(&rh->recovery_in_flight); + while (!down_trylock(&rh->recovery_count)) if (__rh_recovery_prepare(rh) <= 0) { - atomic_dec(&rh->recovery_in_flight); up(&rh->recovery_count); break; } - } - - /* Drop the extra reference */ - if (atomic_dec_and_test(&rh->recovery_in_flight)) - wake_up_all(&_kmirrord_recovery_stopped); } /* @@ -1192,11 +1177,6 @@ struct dirty_log *log = ms->rh.log; rh_stop_recovery(&ms->rh); - - /* Wait for all I/O we generated to complete */ - wait_event(_kmirrord_recovery_stopped, - !atomic_read(&ms->rh.recovery_in_flight)); - if (log->type->suspend && log->type->suspend(log)) /* FIXME: need better error handling */ DMWARN("log suspend failed");