Data Structures

A double wait queue is needed to implement the congestion method. The definition is as follows: mm/backing-dev.c static wait_queue_head_t congestion_wqh[2] = {

_WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),

_WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])

The kernel provides two queues, one for input and one for output. Two pre-processor constants (read and write) are defined in <fs.h> to allow access to the array elements and to clearly differentiate between the two queues without the direct use of numbers.

The kernel makes a distinction between the directions in which data are transmitted to the queue — in other words, between input and output. The data structure does not differentiate between the various devices in the system. As you will see shortly, the data structures of the block layer contain queue-specific information on possible congestion.

Notice that the queues are not supposed to be manipulated directly with standard wait queue methods. Instead, a number of auxiliary functions declared in <backing-dev.h> are provided by the kernel; they are covered in the following discussion.

Continue reading here: Thresholds

Was this article helpful?

0 0