> - set_bdi_congested(bio->bi_bdev->bd_disk->bdi, BLK_RW_ASYNC); > - do { > - spin_unlock(&pd->lock); > - congestion_wait(BLK_RW_ASYNC, HZ); > - spin_lock(&pd->lock); > - } while(pd->bio_queue_size > pd->write_congestion_off); > + ___wait_var_event(&pd->congested, > + pd->bio_queue_size <= pd->write_congestion_off, > + TASK_UNINTERRUPTIBLE, 0, 0, > + ({pd->congested = true; > + spin_unlock(&pd->lock); > + schedule(); > + spin_lock(&pd->lock); > + }) I'd be tempted to open code the ___wait_var_event here as this is pretty unreadable. But otherwise this change looks good to me: Reviewed-by: Christoph Hellwig <hch@xxxxxx>