文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Linux Device Driver 1

Linux Device Driver 1

时间:2007-05-15  来源:jack_zheng

ch16 -- block driver

A block driver provides access to devices that transfer randomly accessible data in fixed-size blocks -- disk drives, primarily. Efficient block drivers are cirtical for performance -- and not just for explicit reads and writes in user applications.

A block is a fixed-size chunk of data, often 4096bytes. A sector is a small block whose size is usually determined by the underlying hardware, 512 bytes in the kernel. If a different size of sector was used, you have to scale the kernel's sector number.

Char devices make their operations available to the system b way of the file_operations structure. Block devices use struct block_device_operations. open() and close() are similar for char and block devices. (mkfs and mount will call open for block devs). The core of every block driver is its request function. no read and write for block devices.

The kernel will optimize on the request to get better performance. The highest cost in a disk operation is always the positioning of the read and write heads. request queues contain a great deal of logic aimed at finding adjacent requests and coalescing then into larger operations. The kernel may join multiple requests that involve adjacent sectors on the disk (but never combines read and write within a single request structure).

The bio structure contains everything that a block driver needs to carry out the request without reference to the user-space process that caused that request to be initiated.

The kernel optimize the order of requests in the queue. this work involves sorting requests and, perhaps, even stalling the queue to allow an anticipated request to arrive. These techniques help the system's performance when dealing with a real, spinning disk drive. However, Many block-oriented devices, such as flash memory arrays, readers for media cards and RAM disks have truly random-access performance and do not benefit from advanced request queueing logic. Other devices, such as software RAID arrays or virtual disks created by logical volume managers, do not have the performance characteristics fo which the block layer's request queues are optimized. For this kind of device, it would be better to accept requests directly from the block layer and not bother with the request queue at all.

相关阅读 更多 +
排行榜 更多 +
拉力竞速2

拉力竞速2

体育竞技 下载
文字乱舞水浒

文字乱舞水浒

角色扮演 下载
蓝图公考

蓝图公考

学习教育 下载