tailieunhanh - linux device drivers 2nd edition phần 7
Mô-đun cấp phát, một phần của mã mẫu được phát hành trên trang web FTP O'Reilly, cung cấp một giao diện phân bổ cho quản lý bất kỳ bộ nhớ cao không được sử dụng bởi hạt nhân Linux. Mô-đun này được mô tả chi tiết hơn trong "phân bổ Do-it-mình" trong Chương 13. Ưu điểm của cấp phát trên ea bigphysar bản vá lỗi | Handling Requests The Detailed View A variant of this latter case can also occur if your request function returns while an I O request is still active. Many drivers for real hardware will start an I O operation then return the work is completed in the driver s interrupt handler. We will look at interrupt-driven block I O in detail later in this chapter for now it is worth mentioning however that the request function can be called while these operations are still in progress. Some drivers handle request function reentrancy by maintaining an internal request queue. The request function simply removes any new requests from the I O request queue and adds them to the internal queue which is then processed through a combination of tasklets and interrupt handlers. How the macros and functions work In our simple request function earlier we were not concerned with buffer_head structures or linked lists. The macros and functions in linux hide the structure of the I O request queue in order to make the task of writing a block driver simpler. In many cases however getting reasonable performance requires a deeper understanding of how the queue works. In this section we look at the actual steps involved in manipulating the request queue subsequent sections show some more advanced techniques for writing block request functions. The fields of the request structure that we looked at earlier sector cur-rent_nr_sectors and buffer are really just copies of the analogous information stored in the first buffer_head structure on the list. Thus a request function that uses this information from the CURRENT pointer is just processing the first of what might be many buffers within the request. The task of splitting up a multibuffer request into seemingly independent single-buffer requests is handled by two important definitions in linux the INIT_REQUEST macro and the end_request function. Of the two INIT_REQUEST is the simpler all it really does is make a couple of .
đang nạp các trang xem trước