Understanding file system inode The concept of

*
concept :inode It's the index node , It is used to store the basic information of files and directories , Include time , File name , Users and groups, etc

*
inode yes UNIX A data structure in operating system , Its essence is structure

*
stay Linux in , The index node structure exists in the system memory and disk , It can be divided into VFS inode With the actual file system inode.

*
VFS inode As a real file system inode The abstraction of , The structure is defined inode Operations related to it inode_operations
Linux in VFS inode include/linux/fs.h struct inode { ... const struct
inode_operations *i_op; // Inode operation unsigned long i_ino; // Index node number atomic_t
i_count; // Reference counter unsigned int i_nlink; // Number of hard links ... } struct inode_operations {
... int (*create) (struct inode *,struct dentry *,int, struct nameidata *); int
(*link) (struct dentry *,struct inode *,struct dentry *); int (*unlink) (struct
inode *,struct dentry *); int (*symlink) (struct inode *,struct dentry *,const
char *); int (*mkdir) (struct inode *,struct dentry *,int); int (*rmdir)
(struct inode *,struct dentry *);... }
*
Linux in VFS inode

* There are two counters per file :i_count And i_nlink, Reference count and hard link count
* i_count Used to track the number of files accessed , and i_nlink Is the above use ls -l The number of file hard links viewed by commands such as
* When a file is deleted , be i_nlink Set to 0
* These two counters of the file make Linux System upgrades or program updates become easier
* The system or program can be shut down without shutting down ( That is, documents i_count Not for 0), Replace the new file with the same file name , The new document has its own inode and data
block, Old files will be completely deleted after the related process is shut down
*
file system ext4 Medium inode
ext4 Medium inode struct ext4_inode { ... __le32 i_atime; // Last access time of file content __le32
i_ctime; // inode Modification time __le32 i_mtime; // Last modification time of file content __le16 i_links_count; //
Hard link count __le32 i_blocks_lo; // Block count __le32 i_block[EXT4_N_BLOCKS]; // Point to specific
block... };
*
The definition of three times can correspond to the command stat You can see three times in

*
i_links_count Not only for hard link count of files , Also used to track the number of subdirectories of a directory ( The directory does not show the number of hard links , command ls -ld What you see is the number of subdirectories )

*
file system ext3 Yes i_links_count There are limitations , The maximum number is :32000( This is limited to ext4 Was cancelled )

Technology
©2019-2020 Toolsou All rights reserved,
ELementUI select Multi select drop-down box to get all properties of the selected item python Dynamic programming for single source shortest path Vue + Element-ui Drop down box for el-select Get extra parameters 【Python- data fetch 】 read txt Each line of file generates a list of data java Several common runtime exceptions and simple examples Element-UI Implementation of secondary packaging TreeSelect Tree drop-down selection component The shortest path of maze BFS algorithm (python realization )iPhone 12 price , Configure full exposure : Cut it off 64GB, Battery 2227mAh start ( Essence 2020 year 6 month 3 Daily update ) TypeScript Detailed explanation of Chinese interface pytorch of ResNet18( Yes cifar10 The accuracy of data classification is achieved 94%)