This article was reprinted from: 75665751.vfsmount, the relationship between the dentry of the installation point and the dentry of the equipment(1) One installation point can install multiple devices(2) One device can be installed on multiple mounting pointsThe relationship between 2.vfsmount and VfsmountThe relationship between the 3.vfsmount and the dentry of
Note the following:1) each time a process opens a file, a file structure corresponds to it. The same process can open the same file multiple times to obtain multiple different file structures. The file structure describes the attributes of the opened file, such as the current offset of the file.2) two different file structures can correspond to the same dentry structure. When a process opens the same file multiple times, there is only one
Linux virtual file system four main objects:1) Super Block2) Index node (inode)3) Catalog entry (dentry)4) Document object (file)A process that refers to various objects as it operates on a file is as follows:by Task_struct get files_struct, then through the file descriptor (int fd) to obtain the corresponding file object (**FD), then get the Directory item object (Dentry), and finally get the Index node ob
Directory Item Caching---dentry
Linux uses directory item caching (Dentry caching) to quickly access the results of previous lookup operations,
struct Dentry {
atomic_t d_count;//directory Entry Object reference counter, D_count value plus 1 when a process occupies the file. The size of the value is judged when the file is deleted by a procedure.
unsigned in
How are we going to describe a file in the process? We use directory entries (dentry) and Index nodes (inode). They are defined as follows :struct Dentry {struct Inode *d_inode; /* Where The name belongs To-null isstruct Dentry *d_parent; /* Parent Directory */struct List_head d_child; /* Child of the parent list */struct Dentry_operations *d_op;struct Super_bloc
> For reprinting, please specify the Source: piao2010's blog, the drifting code. Thank you! Pai_^
> Link: Linux cp mv rm ln command impact on inode and dentry
When reading the File System Section of "Advanced Programming in UNIX environment", I found that I am not very clear about the concepts related to the file system.First, we will introduce two basic concepts:The first important concept, inode (Chinese name: Index node), contains most of the infor
In kernel 2.6.32, The dcache. c file of VFS exports a series of functions with export_symbol for kernel and file system programs.
1. export_symbol (d_alloc );
Struct dentry * d_alloc (struct dentry * parent, const struct qstr * name)
Construct the dentry of a sub-file or directory based on the dentry of the parent dire
operation of opening a file. as shown in the preceding figure, operations on opened files only occupy a small amount of space, while other contents are related to opening files.
To open a file, you first need the file path, such as "dir0/dir1/file ". this path is split into multiple levels by '/'. Each level is a file (the directory is also a file, such as dir0 and dir1 ).
At the beginning of searching for this file path, we need a starting point. If the file path starts with '/', it starts wi
"/" directory. This includes mounting the rootfs File System to the root directory. The code for constructing the root directory is in the init_mount_tree () function (fs \ namespace. c.
First, the init_mount_tree () function will call do_kern_mount ("rootfs", 0, "rootfs", NULL) to mount the previously registered rootfs file system. This seems a bit strange, because according to the previous statement, it seems that there should be a mount directory first, and then mount the corresponding file
the rootfs File System to the root directory. The code for constructing the root directory is in the init_mount_tree () function (fs \ namespace. c.
First, the init_mount_tree () function will call do_kern_mount ("rootfs", 0, "rootfs", NULL) to mount the previously registered rootfs file system. This seems a bit strange, because according to the previous statement, it seems that there should be a mount directory first, and then mount the corresponding file system on it, however, VFS does not se
Tags: VFS inode dentry File System
This article was originally published by fireaxe and can be freely copied and reproduced using GPL. However, for reprinting, please maintain the integrity of the document and indicate the original author and original link. The content can be used at will, but no guarantee is made for the consequences caused by the use of the content. [Email protected] blog: fireaxe.blog.chinaunix.net
VFS is a core concept of Linux.
directory item (dentry) structure in the directory structure. the "start point" is also a dentry structure.
When we execute the cd command in shell, it actually changes the dentry representing the current path in the fs_struct structure.
The process can also use the chroot system call to change the dentry representing
will be very different. To avoid this difference, Linux introduces the concept of VFS. As a result, Linux has built a new file system stored in memory. All other file systems must be converted to the VFS structure before they can be called by users.3. Build VFS
The so-called VFS construction is the process of loading the actual file system, that is, the process of mount being called. As shown in, the following uses an ext2 file system as an example.
This is a simplified Ext2 disk structure and
difference, Linux introduces the concept of VFS. As a result, Linux has built a new file system stored in memory. All other file systems must be converted to the VFS structure before they can be called by users.3. Build VFS
The so-called VFS construction is the process of loading the actual file system, that is, the process of mount being called. As shown in, the following uses an ext2 file system as an example.
This is a simplified Ext2 disk structure and is only used to describe the basic pro
Path search is a major operation of VFS: To get the inode of a file name. Path search is a tedious part of VFS, mainly including symbolic links, file system mount points, and other strange paths such as... And // introduce complexity.
Nameidata data Data Structure
The search process involves many function calls. During these calls, nameidata plays an important role: 1. Passing parameters to the search function; 2. Saving the search result.
struct nameidata { struct
number has been obtained, Filp_open to obtain a document structure, first listing the file structure as follows:struct file {struct list_headf_list;struct dentry*f_dentry;//pointer to the DENTRY structure of the file f_dentrystruct vfsmount *f_vfsmnt ;//Pointer to the VFSMNT structure that installs the file's device in the file system struct file_operations*f_op;atomic_tf_count;unsigned int f_flags
system to the root directory "/". The code that constructs the root directory is in the Init_mount_tree () function (FS\NAMESPACE.C).First, the Init_mount_tree () function calls Do_kern_mount ("Rootfs", 0, "Rootfs", and NULL) to mount the previously registered Rootfs file system. This may seem a bit odd, because according to the previous statement, it seems that the mount directory should be mounted before the corresponding file system is mounted, but the VFS does not seem to have established i
-child process shares the FILES_STRUCT structure to share all open file instances. The typical example is multithreading.Open FileThe process of opening a file is complex compared to the simple operation of an open file. As you can see from the diagram above, the files that have been opened are only a small amount of space, while others are related to open files.To open a file, you first need a file path, such as "Dir0/dir1/file". This path is split into multiple levels by '/' and each level is
In the Linux kernel source scenario analysis-File system installation, in the article, sudo mount-t ext2/dev/sdb1/mnt/sdb has been called, and the file system is mounted on the/MNT/SDB node, then we then visit/mnt/sdb/ The HELLO.C node. Let's see what's the difference between Path_walk's execution? int Path_walk (const char * name, struct nameidata *nd) {struct dentry *dentry;struct inode *inode;int err;uns
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.