Inode pointer structure: Difference between revisions

From HandWiki
imported>BotanyGa
link
 
LinXED (talk | contribs)
correction
 
Line 1: Line 1:
{{short description|Hierarchy/layout for directing inodes in a Unix File System}}
{{short description|Hierarchy/layout for directing inodes in a Unix File System}}
{{lowercase|inode pointer structure}}
{{Lowercase title}}
{{no footnotes|date = February 2012}}
[[File:Ext2-inode.svg|thumb|Example of structure]]
[[File:Ext2-inode.svg|thumb|Example of structure]]
The '''inode pointer structure''' is a structure adopted by the [[Inode|inode]] of a file in the [[Unix File System]] (UFS) to list the addresses of a file's [[Block (data storage)|data blocks]]. It is also adopted by many related file systems, including the [[Ext3|ext3]] file system, popular with Linux users.
The '''inode pointer structure''' is a structure adopted by the [[Inode|inode]] of a file in the [[Version 6 Unix]] file system, [[Software:Version 7 Unix|Version 7 Unix]] file system, and [[Unix File System]] (UFS) to list the addresses of a file's [[Block (data storage)|data blocks]]. It is also adopted by many related file systems, including the [[Ext3|ext3]] file system, popular with Linux users.


==Structure==
==Structure==
In the past, the structure may have consisted of eleven or thirteen pointers, but most modern file systems use fifteen pointers. These pointers consist of (assuming 15 pointers in the inode):
In the file system used in [[Version 6 Unix]], an inode contains eight pointers:<ref>{{cite journal |url=https://dsf.berkeley.edu/cs262/unix.pdf |title=The UNIX Time-Sharing System |first1=Dennis M. |last1=Ritchie |first2=Ken |last2=Thompson |author-link2=Ken Thompson |journal=Communications of the ACM |volume=17 |issue=7 |date=July 1974 |page=369}}</ref>


* Twelve pointers that directly point to blocks of the file's data (direct pointers)
* 8 '''direct pointer''' that directly point to blocks of a file with eight or fewer blocks;
* One singly indirect pointer (a pointer that points to a block of pointers that then point to blocks of the file's data)
* 8 '''singly indirect pointers''' (pointing to a block of direct pointers) for files with more than eight blocks.
* One doubly indirect pointer (a pointer that points to a block of pointers that point to other blocks of pointers that then point to blocks of the file's data)
 
* One triply indirect pointer (a pointer that points to a block of pointers that point to other blocks of pointers that point to other blocks of pointers that then point to blocks of the file's data)
In the file system used in [[Software:Version 7 Unix|Version 7 Unix]], an inode contains thirteen pointers:<ref>{{cite web |url=https://www.bell-labs.com/usr/dmr/www/cacm.pdf |title=The UNIX Time-Sharing System |first1=Dennis M. |last1=Ritchie |first2=Ken |last2=Thompson |author-link2=Ken Thompson}}</ref>
 
* 10 '''direct pointers''' that directly point to blocks of a file with eight or fewer blocks;
* 1 '''singly indirect pointer''' (pointing to a block of direct pointers)
* 1 '''doubly indirect pointer''' (pointing to a block of single indirect pointers)
* 1 '''triply indirect pointer''' (pointing to a block of doubly indirect pointers)
 
In the Unix file system, an inode contains fifteen pointers:<ref>{{cite web |url=https://docs.oracle.com/cd/E19455-01/805-7228/6j6q7uf0r/index.html |title=The Structure of UFS File System Cylinder Groups |work=System Administration Guide}}</ref>
 
* 12 '''direct pointers''' that directly point to blocks of the file's data
* 1 '''singly indirect pointer''' (pointing to a block of direct pointers)
* 1 '''doubly indirect pointer''' (pointing to a block of single indirect pointers)
* 1 '''triply indirect pointer''' (pointing to a block of doubly indirect pointers)
 
The levels of indirection indicate the number of pointer that must be followed before reaching actual file data.


==Key features==
==Key features==


===Fixed logical block size===
===Fixed logical block size===
The structure is partially illustrated in the diagram accompanying this article. The structure allows for inodes to describe very large files in file systems with a fixed logical block size. Central to the mechanism is that blocks of addresses (also called ''indirect blocks'') are only allocated as needed. For example, a 12-block file would be described using just the inode because its blocks fit into the number of direct pointers available. However, a 13-block file needs an indirect block to contain the thirteenth address.
The structure is partially illustrated in the diagram accompanying this article. The structure allows for inodes to describe very large files in file systems with a fixed logical block size. Central to the mechanism is that blocks of addresses (also called ''indirect blocks'') are only allocated as needed. For example, in the Unix file system, a 12-block file would be described using just the inode because its blocks fit into the number of direct pointers available. However, a 13-block file needs an indirect block to contain the thirteenth address.


===Ease of data location===
===Ease of data location===
Line 21: Line 36:


===Indirect blocks===
===Indirect blocks===
Unlike the inodes, which are fixed in number and allocated in a special part of the file system, the indirect blocks may be of any number and are allocated in the same part of the file system as data blocks. The number of pointers in the indirect blocks is dependent on the block size and size of block pointers. Example: with a 512-byte block size, and 4-byte block pointers, each indirect block can consist of 128 (512 / 4) pointers.
Unlike inodes, which are fixed in number and allocated in a special part of the file system, the indirect blocks may be of any number and are allocated in the same part of the file system as data blocks. The number of pointers in the indirect blocks is dependent on the block size and size of block pointers. Example: with a 512-byte block size, and 4-byte block pointers, each indirect block can consist of 128 (512 / 4) pointers.


== References ==
== References ==
{{Reflist}}
* [https://lwn.net/Articles/187321/ Ext3 for large file systems], LWN.net, June 12, 2006.
* [https://lwn.net/Articles/187321/ Ext3 for large file systems], LWN.net, June 12, 2006.
* {{cite journal | author1=[[Biography:Marshall Kirk McKusick|Marshall Kirk McKusick]]|author2=[[Biography:Bill Joy|William N. Joy]]|author3=[[Biography:Samuel J Leffler|Samuel J Leffler]]|author4=Robert S. Fabry | title=A Fast File System for UNIX | date=February 18, 1984 | url=http://www.cs.berkeley.edu/~brewer/cs262/FFS.pdf }}
* {{cite journal | author1=[[Biography:Marshall Kirk McKusick|Marshall Kirk McKusick]]|author2=[[Biography:Bill Joy|William N. Joy]]|author3=[[Biography:Samuel J Leffler|Samuel J Leffler]]|author4=Robert S. Fabry | title=A Fast File System for UNIX | date=February 18, 1984 | url=http://www.cs.berkeley.edu/~brewer/cs262/FFS.pdf |journal=Computer Systems Research Group }}


[[Category:Unix file system technology]]
[[Category:Unix file system technology]]


{{Sourceattribution|Inode pointer structure}}
{{Sourceattribution|Inode pointer structure}}

Latest revision as of 10:39, 14 February 2026

Short description: Hierarchy/layout for directing inodes in a Unix File System

Example of structure

The inode pointer structure is a structure adopted by the inode of a file in the Version 6 Unix file system, Version 7 Unix file system, and Unix File System (UFS) to list the addresses of a file's data blocks. It is also adopted by many related file systems, including the ext3 file system, popular with Linux users.

Structure

In the file system used in Version 6 Unix, an inode contains eight pointers:[1]

  • 8 direct pointer that directly point to blocks of a file with eight or fewer blocks;
  • 8 singly indirect pointers (pointing to a block of direct pointers) for files with more than eight blocks.

In the file system used in Version 7 Unix, an inode contains thirteen pointers:[2]

  • 10 direct pointers that directly point to blocks of a file with eight or fewer blocks;
  • 1 singly indirect pointer (pointing to a block of direct pointers)
  • 1 doubly indirect pointer (pointing to a block of single indirect pointers)
  • 1 triply indirect pointer (pointing to a block of doubly indirect pointers)

In the Unix file system, an inode contains fifteen pointers:[3]

  • 12 direct pointers that directly point to blocks of the file's data
  • 1 singly indirect pointer (pointing to a block of direct pointers)
  • 1 doubly indirect pointer (pointing to a block of single indirect pointers)
  • 1 triply indirect pointer (pointing to a block of doubly indirect pointers)

The levels of indirection indicate the number of pointer that must be followed before reaching actual file data.

Key features

Fixed logical block size

The structure is partially illustrated in the diagram accompanying this article. The structure allows for inodes to describe very large files in file systems with a fixed logical block size. Central to the mechanism is that blocks of addresses (also called indirect blocks) are only allocated as needed. For example, in the Unix file system, a 12-block file would be described using just the inode because its blocks fit into the number of direct pointers available. However, a 13-block file needs an indirect block to contain the thirteenth address.

Ease of data location

The inode pointer structure not only allows for files to easily be allocated to non-contiguous blocks, it also allows the data at a particular location inside a file to be easily located. This is possible because the logical block size is fixed. For example, if each block is 8 kB, file data at 112 kB to 120 kB would be pointed to by the third pointer of the first indirect block (assuming twelve direct pointers in the inode pointer structure).

Indirect blocks

Unlike inodes, which are fixed in number and allocated in a special part of the file system, the indirect blocks may be of any number and are allocated in the same part of the file system as data blocks. The number of pointers in the indirect blocks is dependent on the block size and size of block pointers. Example: with a 512-byte block size, and 4-byte block pointers, each indirect block can consist of 128 (512 / 4) pointers.

References