long congestion_wait(int rw, long timeout) {

long ret; DEFINE_WAIT(wait);

wait_queue_head_t *wqh = &congestion_wqh[rw];

prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE); ret = io_schedule_timeout(timeout); finish_wait(wqh, &wait); return ret;

congestion_wait invokes some functions once the requisite data structures have been initialized:

□ prepare_to_wait is used in conjunction with a time out to implement waiting for clearance of congested queues. It puts the process in the task_uninterruptible state and places it on the appropriate wait queue.

□ io_schedule_timeout implements the desired time out using the resources described in Chapter 15. Control is passed to other processes until the time out expires.

Upon expiry of the time out (1 second is used for background synchronization), finish_wait is invoked to remove the process from the wait queue so that work can continue.

Continue reading here: Forced Writeback

Was this article helpful?

0 0