Analysis of file switches in Linux virtual systems

Source: Internet
Author: User
Article Title: Analysis of file switches in Linux virtual systems. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Linux? The most notable feature is flexibility and scalability, such as its Virtual File System switch (VFS ). You can create file systems on a variety of devices, including traditional disks, USB flash drives, memory, and other storage devices. You can also embed a file system in another file system environment. Explore the factors that make VFS so powerful and understand the main interfaces and processes of VFS.

The flexibility and scalability of the Linux File System are directly derived from a set of abstract interfaces. The core of this set of interfaces is the virtual file system switch (VFS ).

VFS provides a set of standard interfaces for upper-layer applications to execute file I/O on different file systems. This set of interfaces supports multiple concurrent file systems on one or more underlying devices. In addition, these file systems can be non-static and change according to storage devices.

VF and VFS

You can also see that VFS is also defined as a virtual file system, but the definition of virtual file system switch can better describe its function, because the Virtual Layer converts (multiplexing) requests across multiple file systems. /Proc file system brings a lot of confusion here, because it is also called a virtual file system.

For example, a typical Linux Desktop supports ext3 file systems on an available hard disk and ISO 9660 file systems on an available CD-ROM (or known as a CD-ROM file system or CDFS. Because CD-ROM can be inserted and removed, the Linux kernel must accommodate these new file systems that contain different contents and structures. You can access a remote File System through a Network File System (NFS. In this case, can Windows from the local hard disk be mounted in Linux? /Linux dual-boot System's NT File System (NTFS) partition, and can read and write data to it.

Finally, the portable USB flash boot (UFD) can be hot-swappable, which forms another file system. Generally speaking, you can use the same set of file I/O interfaces in these devices to allow the underlying file systems and physical devices to be abstracted from users (see figure 1 ).

Figure 1. abstraction layer that provides unified interfaces between different file systems and storage devices

Layered Abstraction

Now, we add some specific architectures to the abstract features provided by Linux VFS. Figure 2 shows the advanced view of the Linux structure from the perspective of VFS. On the VFS, the standard kernel system call interface (SCI) is used ). This interface allows the user space to send calls that require conversion to the kernel (in different address spaces ). In this domain, user space applications that call POSIX open call go through the gnu c library (glibc) to enter the kernel and system calls to diversify (de-multiplexing ). Finally, use sys_open to call VFS.

Figure 2. VFS layered architecture

Early VFS implementation

Linux is not the first operating system that includes a virtual layer to support a common file model. Earlier VFS implementations included Sun's VFS (SunOS version 2.0, around 1985), and IBM and Microsoft? "Installable File System" for ibm OS/2. These virtualization file system layer Methods pave the way for Linux VFS.

VFS provides an abstraction layer to separate POSIX APIs from the details of how specific file systems implement this behavior. The key here is that, no matter whether the underlying file system is ext3 or Btrfs, the Open, Read, Write or Close API system calls can work normally. VFS provides a general file model inherited by the underlying File System (which must implement behavior for various posix api functions. Another deep abstraction beyond the scope of VFS hides underlying physical devices (possibly disks, disk partitions, network storage entities, memory, or other media capable of storing information-even temporary ).

In addition to abstracting file operations from the underlying file system, VFS also binds underlying Block devices to available file systems. Let's take a look at the internal structure of VFS and its working principles.

[1] [2] [3] Next page

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.