File systems and block Devices

Source: Internet
Author: User

1. The high-speed buffer zone is located between VFS and a specific file system.

2. The file node on the disk contains the strcut address_space field. The structure corresponds to the file node on the disk.

3. A struct address_space contains one or more cache pages. The cache pages are organized by the base tree for easy search.

4. Each cache page contains multiple cache blocks. The content of the cache page is not necessarily continuous on the disk, but the content of the buffer block is continuous on the disk.

5. Each buffer block corresponds to the structure of a buffer header. This structure mainly contains the physical location of the disk corresponding to the buffer block content, and the buffer header forms a linked list.

6. the kernel first determines that the disk block of the inode to be read and written is not in the cache block of the inode, create a new cache page and cache block and buffer header, and add them to the corresponding address_space,

If address_space does not exist, create address_space for the node (how to determine whether the node needs further research in the cache area and check the first linked list in the cache area ?)

7. Synchronously refresh the disk or pdflush periodic scheduling to submit the data in the buffer zone to a disk. The submission method is to call submit_bio through struct bio.

8. bio can be divided into two types: Real-time and non-real-time direct submission. Most of them are non-real-time. You need to insert bio into a suitable request, bio contains data in one or more cache blocks, and a request contains one or

The data requested in multiple bio requests is continuous on the disk.

9. Continuous requests on the disk may be merged into one request, and requests in the order on the disk are re-ordered (36 with NOP scheduling)Algorithm, Only merge, not sort)

10. Sorted requests are sent to ahci

To be continued...

The following describes several important functions:

The file is read and written through generic_file_write. After initializing some data structures, call _ generic_file_aio_write_nolock. The actual function for reading and writing cached pages is

Static ssize_t generic_1_m_write (struct file * file, struct iov_iter * I, loff_t POS); this function is executed as follows:

1. Obtain the address_space of the file node and call the write_begain method of the address_space of the block Device File node. This method mainly

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.