1BLK_INIT_QUEUE(9) Block Devices BLK_INIT_QUEUE(9)
2
3
4
6 blk_init_queue - prepare a request queue for use with a block device
7
9 struct request_queue * blk_init_queue(request_fn_proc * rfn,
10 spinlock_t * lock);
11
13 rfn
14 The function to be called to process requests that have been placed
15 on the queue.
16
17 lock
18 Request queue spin lock
19
21 If a block device wishes to use the standard request handling
22 procedures, which sorts requests and coalesces adjacent requests, then
23 it must call blk_init_queue. The function rfn will be called when there
24 are requests on the queue that need to be processed. If the device
25 supports plugging, then rfn may not be called immediately when requests
26 are available on the queue, but may be called at some time later
27 instead. Plugged queues are generally unplugged when a buffer belonging
28 to one of the requests on the queue is needed, or due to memory
29 pressure.
30
31 rfn is not required, or even expected, to remove all requests off the
32 queue, but only as many as it can handle at a time. If it does leave
33 requests on the queue, it is responsible for arranging that the
34 requests get dealt with eventually.
35
36 The queue spin lock must be held while manipulating the requests on the
37 request queue; this lock will be taken also from interrupt context, so
38 irq disabling is needed for it.
39
40 Function returns a pointer to the initialized request queue, or NULL if
41 it didn't succeed.
42
44 blk_init_queue must be paired with a blk_cleanup_queue call when the
45 block device is deactivated (such as at module unload).
46
48Kernel Hackers Manual 3.10 June 2019 BLK_INIT_QUEUE(9)