Linux block I/O layer self-taught report

Source: Internet
Author: User

Block devices can be randomly accessed, that is, they can jump from one location to another at will when accessing the device.

The smallest addressable unit in a block device is the sector, and the size of the sector is the physical attribute of the device. The importance of the sector for the kernel is that all the device I/O operations must be performed based on the sector. The smallest logical addressable unit of the software-blocks (abstraction layer higher than the slice ). Block is an abstraction of a file system-you can only access the file system based on blocks. The block size cannot be smaller than the slice size, but only several times the slice size.

Each buffer corresponds to a block, which is equivalent to the representation of the disk block in the memory. It is represented by a buffer_head struct and is called a buffer header. It aims to describe the ing between disk blocks and physical memory buffers (the byte sequence on a specific page). It only plays the role of a descriptor, describes the ing from the buffer zone to the block.

The basic container for block operations in the kernel is represented by the bio struct. This struct represents the block I/O operations that are being performed (active) in the form of a fragment linked list, A fragment is a small contiguous memory buffer. Vector I/O is the so-called aggregation I/O. bio struct represents I/O operations, which can contain one or more pages of memory, while buffer_head represents a buffer, which only describes a disk block, it is associated with a separate disk block on a separate page. Bio can easily process high-end memory. It processes physical pages rather than direct pointers. It also facilitates the execution of scattered-centralized (vectorized) block I/O operations, the data in the operation can be taken from multiple physical pages.

Block I/O requests are stored in the Request queue, which is represented by the request_queue structure. As long as it is not empty, the block Device Driver of the queueProgramThe request is obtained from the queue header and sent to the corresponding block device. Each item in the queue is a separate request (represented by the request structure ). One request may need to operate on multiple consecutive disk blocks. Therefore, each request can contain multiple bio structures.

The subsystem responsible for submitting I/O requests in the kernel is called the I/O scheduler. The virtual block device sends multiple disk requests to reduce the addressing address of the disk and ensure optimal disk performance.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.