~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/filesystems/ext4/directory.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/filesystems/ext4/directory.rst (Version linux-6.12-rc7) and /Documentation/filesystems/ext4/directory.rst (Version linux-4.20.17)


  1 .. SPDX-License-Identifier: GPL-2.0                 1 .. SPDX-License-Identifier: GPL-2.0
  2                                                     2 
  3 Directory Entries                                   3 Directory Entries
  4 -----------------                                   4 -----------------
  5                                                     5 
  6 In an ext4 filesystem, a directory is more or       6 In an ext4 filesystem, a directory is more or less a flat file that maps
  7 an arbitrary byte string (usually ASCII) to an      7 an arbitrary byte string (usually ASCII) to an inode number on the
  8 filesystem. There can be many directory entrie      8 filesystem. There can be many directory entries across the filesystem
  9 that reference the same inode number--these ar      9 that reference the same inode number--these are known as hard links, and
 10 that is why hard links cannot reference files      10 that is why hard links cannot reference files on other filesystems. As
 11 such, directory entries are found by reading t     11 such, directory entries are found by reading the data block(s)
 12 associated with a directory file for the parti     12 associated with a directory file for the particular directory entry that
 13 is desired.                                        13 is desired.
 14                                                    14 
 15 Linear (Classic) Directories                       15 Linear (Classic) Directories
 16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~                       16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 17                                                    17 
 18 By default, each directory lists its entries i     18 By default, each directory lists its entries in an “almost-linear”
 19 array. I write “almost” because it's not a     19 array. I write “almost” because it's not a linear array in the memory
 20 sense because directory entries are not split      20 sense because directory entries are not split across filesystem blocks.
 21 Therefore, it is more accurate to say that a d     21 Therefore, it is more accurate to say that a directory is a series of
 22 data blocks and that each block contains a lin     22 data blocks and that each block contains a linear array of directory
 23 entries. The end of each per-block array is si     23 entries. The end of each per-block array is signified by reaching the
 24 end of the block; the last entry in the block      24 end of the block; the last entry in the block has a record length that
 25 takes it all the way to the end of the block.      25 takes it all the way to the end of the block. The end of the entire
 26 directory is of course signified by reaching t     26 directory is of course signified by reaching the end of the file. Unused
 27 directory entries are signified by inode = 0.      27 directory entries are signified by inode = 0. By default the filesystem
 28 uses ``struct ext4_dir_entry_2`` for directory     28 uses ``struct ext4_dir_entry_2`` for directory entries unless the
 29 “filetype” feature flag is not set, in whi     29 “filetype” feature flag is not set, in which case it uses
 30 ``struct ext4_dir_entry``.                         30 ``struct ext4_dir_entry``.
 31                                                    31 
 32 The original directory entry format is ``struc     32 The original directory entry format is ``struct ext4_dir_entry``, which
 33 is at most 263 bytes long, though on disk you'     33 is at most 263 bytes long, though on disk you'll need to reference
 34 ``dirent.rec_len`` to know for sure.               34 ``dirent.rec_len`` to know for sure.
 35                                                    35 
 36 .. list-table::                                    36 .. list-table::
 37    :widths: 8 8 24 40                              37    :widths: 8 8 24 40
 38    :header-rows: 1                                 38    :header-rows: 1
 39                                                    39 
 40    * - Offset                                      40    * - Offset
 41      - Size                                        41      - Size
 42      - Name                                        42      - Name
 43      - Description                                 43      - Description
 44    * - 0x0                                         44    * - 0x0
 45      - __le32                                  !!  45      - \_\_le32
 46      - inode                                       46      - inode
 47      - Number of the inode that this directory     47      - Number of the inode that this directory entry points to.
 48    * - 0x4                                         48    * - 0x4
 49      - __le16                                  !!  49      - \_\_le16
 50      - rec_len                                 !!  50      - rec\_len
 51      - Length of this directory entry. Must be     51      - Length of this directory entry. Must be a multiple of 4.
 52    * - 0x6                                         52    * - 0x6
 53      - __le16                                  !!  53      - \_\_le16
 54      - name_len                                !!  54      - name\_len
 55      - Length of the file name.                    55      - Length of the file name.
 56    * - 0x8                                         56    * - 0x8
 57      - char                                        57      - char
 58      - name[EXT4_NAME_LEN]                     !!  58      - name[EXT4\_NAME\_LEN]
 59      - File name.                                  59      - File name.
 60                                                    60 
 61 Since file names cannot be longer than 255 byt     61 Since file names cannot be longer than 255 bytes, the new directory
 62 entry format shortens the name_len field and u !!  62 entry format shortens the rec\_len field and uses the space for a file
 63 type flag, probably to avoid having to load ev     63 type flag, probably to avoid having to load every inode during directory
 64 tree traversal. This format is ``ext4_dir_entr     64 tree traversal. This format is ``ext4_dir_entry_2``, which is at most
 65 263 bytes long, though on disk you'll need to      65 263 bytes long, though on disk you'll need to reference
 66 ``dirent.rec_len`` to know for sure.               66 ``dirent.rec_len`` to know for sure.
 67                                                    67 
 68 .. list-table::                                    68 .. list-table::
 69    :widths: 8 8 24 40                              69    :widths: 8 8 24 40
 70    :header-rows: 1                                 70    :header-rows: 1
 71                                                    71 
 72    * - Offset                                      72    * - Offset
 73      - Size                                        73      - Size
 74      - Name                                        74      - Name
 75      - Description                                 75      - Description
 76    * - 0x0                                         76    * - 0x0
 77      - __le32                                  !!  77      - \_\_le32
 78      - inode                                       78      - inode
 79      - Number of the inode that this directory     79      - Number of the inode that this directory entry points to.
 80    * - 0x4                                         80    * - 0x4
 81      - __le16                                  !!  81      - \_\_le16
 82      - rec_len                                 !!  82      - rec\_len
 83      - Length of this directory entry.             83      - Length of this directory entry.
 84    * - 0x6                                         84    * - 0x6
 85      - __u8                                    !!  85      - \_\_u8
 86      - name_len                                !!  86      - name\_len
 87      - Length of the file name.                    87      - Length of the file name.
 88    * - 0x7                                         88    * - 0x7
 89      - __u8                                    !!  89      - \_\_u8
 90      - file_type                               !!  90      - file\_type
 91      - File type code, see ftype_ table below.     91      - File type code, see ftype_ table below.
 92    * - 0x8                                         92    * - 0x8
 93      - char                                        93      - char
 94      - name[EXT4_NAME_LEN]                     !!  94      - name[EXT4\_NAME\_LEN]
 95      - File name.                                  95      - File name.
 96                                                    96 
 97 .. _ftype:                                         97 .. _ftype:
 98                                                    98 
 99 The directory file type is one of the followin     99 The directory file type is one of the following values:
100                                                   100 
101 .. list-table::                                   101 .. list-table::
102    :widths: 16 64                                 102    :widths: 16 64
103    :header-rows: 1                                103    :header-rows: 1
104                                                   104 
105    * - Value                                      105    * - Value
106      - Description                                106      - Description
107    * - 0x0                                        107    * - 0x0
108      - Unknown.                                   108      - Unknown.
109    * - 0x1                                        109    * - 0x1
110      - Regular file.                              110      - Regular file.
111    * - 0x2                                        111    * - 0x2
112      - Directory.                                 112      - Directory.
113    * - 0x3                                        113    * - 0x3
114      - Character device file.                     114      - Character device file.
115    * - 0x4                                        115    * - 0x4
116      - Block device file.                         116      - Block device file.
117    * - 0x5                                        117    * - 0x5
118      - FIFO.                                      118      - FIFO.
119    * - 0x6                                        119    * - 0x6
120      - Socket.                                    120      - Socket.
121    * - 0x7                                        121    * - 0x7
122      - Symbolic link.                             122      - Symbolic link.
123                                                   123 
124 To support directories that are both encrypted << 
125 must also include hash information in the dire << 
126 ``ext4_extended_dir_entry_2`` to ``ext4_dir_en << 
127 for dot and dotdot, which are kept the same. T << 
128 after ``name`` and is included in the size lis << 
129 entry uses this extension, it may be up to 271 << 
130                                                << 
131 .. list-table::                                << 
132    :widths: 8 8 24 40                          << 
133    :header-rows: 1                             << 
134                                                << 
135    * - Offset                                  << 
136      - Size                                    << 
137      - Name                                    << 
138      - Description                             << 
139    * - 0x0                                     << 
140      - __le32                                  << 
141      - hash                                    << 
142      - The hash of the directory name          << 
143    * - 0x4                                     << 
144      - __le32                                  << 
145      - minor_hash                              << 
146      - The minor hash of the directory name    << 
147                                                << 
148                                                << 
149 In order to add checksums to these classic dir    124 In order to add checksums to these classic directory blocks, a phony
150 ``struct ext4_dir_entry`` is placed at the end    125 ``struct ext4_dir_entry`` is placed at the end of each leaf block to
151 hold the checksum. The directory entry is 12 b    126 hold the checksum. The directory entry is 12 bytes long. The inode
152 number and name_len fields are set to zero to  !! 127 number and name\_len fields are set to zero to fool old software into
153 ignoring an apparently empty directory entry,     128 ignoring an apparently empty directory entry, and the checksum is stored
154 in the place where the name normally goes. The    129 in the place where the name normally goes. The structure is
155 ``struct ext4_dir_entry_tail``:                   130 ``struct ext4_dir_entry_tail``:
156                                                   131 
157 .. list-table::                                   132 .. list-table::
158    :widths: 8 8 24 40                             133    :widths: 8 8 24 40
159    :header-rows: 1                                134    :header-rows: 1
160                                                   135 
161    * - Offset                                     136    * - Offset
162      - Size                                       137      - Size
163      - Name                                       138      - Name
164      - Description                                139      - Description
165    * - 0x0                                        140    * - 0x0
166      - __le32                                  !! 141      - \_\_le32
167      - det_reserved_zero1                      !! 142      - det\_reserved\_zero1
168      - Inode number, which must be zero.          143      - Inode number, which must be zero.
169    * - 0x4                                        144    * - 0x4
170      - __le16                                  !! 145      - \_\_le16
171      - det_rec_len                             !! 146      - det\_rec\_len
172      - Length of this directory entry, which m    147      - Length of this directory entry, which must be 12.
173    * - 0x6                                        148    * - 0x6
174      - __u8                                    !! 149      - \_\_u8
175      - det_reserved_zero2                      !! 150      - det\_reserved\_zero2
176      - Length of the file name, which must be     151      - Length of the file name, which must be zero.
177    * - 0x7                                        152    * - 0x7
178      - __u8                                    !! 153      - \_\_u8
179      - det_reserved_ft                         !! 154      - det\_reserved\_ft
180      - File type, which must be 0xDE.             155      - File type, which must be 0xDE.
181    * - 0x8                                        156    * - 0x8
182      - __le32                                  !! 157      - \_\_le32
183      - det_checksum                            !! 158      - det\_checksum
184      - Directory leaf block checksum.             159      - Directory leaf block checksum.
185                                                   160 
186 The leaf directory block checksum is calculate    161 The leaf directory block checksum is calculated against the FS UUID, the
187 directory's inode number, the directory's inod    162 directory's inode number, the directory's inode generation number, and
188 the entire directory entry block up to (but no    163 the entire directory entry block up to (but not including) the fake
189 directory entry.                                  164 directory entry.
190                                                   165 
191 Hash Tree Directories                             166 Hash Tree Directories
192 ~~~~~~~~~~~~~~~~~~~~~                             167 ~~~~~~~~~~~~~~~~~~~~~
193                                                   168 
194 A linear array of directory entries isn't grea    169 A linear array of directory entries isn't great for performance, so a
195 new feature was added to ext3 to provide a fas    170 new feature was added to ext3 to provide a faster (but peculiar)
196 balanced tree keyed off a hash of the director    171 balanced tree keyed off a hash of the directory entry name. If the
197 EXT4_INDEX_FL (0x1000) flag is set in the inod !! 172 EXT4\_INDEX\_FL (0x1000) flag is set in the inode, this directory uses a
198 hashed btree (htree) to organize and find dire    173 hashed btree (htree) to organize and find directory entries. For
199 backwards read-only compatibility with ext2, t    174 backwards read-only compatibility with ext2, this tree is actually
200 hidden inside the directory file, masquerading    175 hidden inside the directory file, masquerading as “empty” directory data
201 blocks! It was stated previously that the end     176 blocks! It was stated previously that the end of the linear directory
202 entry table was signified with an entry pointi    177 entry table was signified with an entry pointing to inode 0; this is
203 (ab)used to fool the old linear-scan algorithm    178 (ab)used to fool the old linear-scan algorithm into thinking that the
204 rest of the directory block is empty so that i    179 rest of the directory block is empty so that it moves on.
205                                                   180 
206 The root of the tree always lives in the first    181 The root of the tree always lives in the first data block of the
207 directory. By ext2 custom, the '.' and '..' en    182 directory. By ext2 custom, the '.' and '..' entries must appear at the
208 beginning of this first block, so they are put    183 beginning of this first block, so they are put here as two
209 ``struct ext4_dir_entry_2`` s and not stored i !! 184 ``struct ext4_dir_entry_2``\ s and not stored in the tree. The rest of
210 the root node contains metadata about the tree    185 the root node contains metadata about the tree and finally a hash->block
211 map to find nodes that are lower in the htree.    186 map to find nodes that are lower in the htree. If
212 ``dx_root.info.indirect_levels`` is non-zero t    187 ``dx_root.info.indirect_levels`` is non-zero then the htree has two
213 levels; the data block pointed to by the root     188 levels; the data block pointed to by the root node's map is an interior
214 node, which is indexed by a minor hash. Interi    189 node, which is indexed by a minor hash. Interior nodes in this tree
215 contains a zeroed out ``struct ext4_dir_entry_    190 contains a zeroed out ``struct ext4_dir_entry_2`` followed by a
216 minor_hash->block map to find leafe nodes. Lea !! 191 minor\_hash->block map to find leafe nodes. Leaf nodes contain a linear
217 array of all ``struct ext4_dir_entry_2``; all     192 array of all ``struct ext4_dir_entry_2``; all of these entries
218 (presumably) hash to the same value. If there     193 (presumably) hash to the same value. If there is an overflow, the
219 entries simply overflow into the next leaf nod    194 entries simply overflow into the next leaf node, and the
220 least-significant bit of the hash (in the inte    195 least-significant bit of the hash (in the interior node map) that gets
221 us to this next leaf node is set.                 196 us to this next leaf node is set.
222                                                   197 
223 To traverse the directory as a htree, the code    198 To traverse the directory as a htree, the code calculates the hash of
224 the desired file name and uses it to find the     199 the desired file name and uses it to find the corresponding block
225 number. If the tree is flat, the block is a li    200 number. If the tree is flat, the block is a linear array of directory
226 entries that can be searched; otherwise, the m    201 entries that can be searched; otherwise, the minor hash of the file name
227 is computed and used against this second block    202 is computed and used against this second block to find the corresponding
228 third block number. That third block number wi    203 third block number. That third block number will be a linear array of
229 directory entries.                                204 directory entries.
230                                                   205 
231 To traverse the directory as a linear array (s    206 To traverse the directory as a linear array (such as the old code does),
232 the code simply reads every data block in the     207 the code simply reads every data block in the directory. The blocks used
233 for the htree will appear to have no entries (    208 for the htree will appear to have no entries (aside from '.' and '..')
234 and so only the leaf nodes will appear to have    209 and so only the leaf nodes will appear to have any interesting content.
235                                                   210 
236 The root of the htree is in ``struct dx_root``    211 The root of the htree is in ``struct dx_root``, which is the full length
237 of a data block:                                  212 of a data block:
238                                                   213 
239 .. list-table::                                   214 .. list-table::
240    :widths: 8 8 24 40                             215    :widths: 8 8 24 40
241    :header-rows: 1                                216    :header-rows: 1
242                                                   217 
243    * - Offset                                     218    * - Offset
244      - Type                                       219      - Type
245      - Name                                       220      - Name
246      - Description                                221      - Description
247    * - 0x0                                        222    * - 0x0
248      - __le32                                  !! 223      - \_\_le32
249      - dot.inode                                  224      - dot.inode
250      - inode number of this directory.            225      - inode number of this directory.
251    * - 0x4                                        226    * - 0x4
252      - __le16                                  !! 227      - \_\_le16
253      - dot.rec_len                             !! 228      - dot.rec\_len
254      - Length of this record, 12.                 229      - Length of this record, 12.
255    * - 0x6                                        230    * - 0x6
256      - u8                                         231      - u8
257      - dot.name_len                            !! 232      - dot.name\_len
258      - Length of the name, 1.                     233      - Length of the name, 1.
259    * - 0x7                                        234    * - 0x7
260      - u8                                         235      - u8
261      - dot.file_type                           !! 236      - dot.file\_type
262      - File type of this entry, 0x2 (directory    237      - File type of this entry, 0x2 (directory) (if the feature flag is set).
263    * - 0x8                                        238    * - 0x8
264      - char                                       239      - char
265      - dot.name[4]                                240      - dot.name[4]
266      - “.\0\0\0”                           !! 241      - “.\\0\\0\\0”
267    * - 0xC                                        242    * - 0xC
268      - __le32                                  !! 243      - \_\_le32
269      - dotdot.inode                               244      - dotdot.inode
270      - inode number of parent directory.          245      - inode number of parent directory.
271    * - 0x10                                       246    * - 0x10
272      - __le16                                  !! 247      - \_\_le16
273      - dotdot.rec_len                          !! 248      - dotdot.rec\_len
274      - block_size - 12. The record length is l !! 249      - block\_size - 12. The record length is long enough to cover all htree
275        data.                                      250        data.
276    * - 0x12                                       251    * - 0x12
277      - u8                                         252      - u8
278      - dotdot.name_len                         !! 253      - dotdot.name\_len
279      - Length of the name, 2.                     254      - Length of the name, 2.
280    * - 0x13                                       255    * - 0x13
281      - u8                                         256      - u8
282      - dotdot.file_type                        !! 257      - dotdot.file\_type
283      - File type of this entry, 0x2 (directory    258      - File type of this entry, 0x2 (directory) (if the feature flag is set).
284    * - 0x14                                       259    * - 0x14
285      - char                                       260      - char
286      - dotdot_name[4]                          !! 261      - dotdot\_name[4]
287      - “..\0\0”                            !! 262      - “..\\0\\0”
288    * - 0x18                                       263    * - 0x18
289      - __le32                                  !! 264      - \_\_le32
290      - struct dx_root_info.reserved_zero       !! 265      - struct dx\_root\_info.reserved\_zero
291      - Zero.                                      266      - Zero.
292    * - 0x1C                                       267    * - 0x1C
293      - u8                                         268      - u8
294      - struct dx_root_info.hash_version        !! 269      - struct dx\_root\_info.hash\_version
295      - Hash type, see dirhash_ table below.       270      - Hash type, see dirhash_ table below.
296    * - 0x1D                                       271    * - 0x1D
297      - u8                                         272      - u8
298      - struct dx_root_info.info_length         !! 273      - struct dx\_root\_info.info\_length
299      - Length of the tree information, 0x8.       274      - Length of the tree information, 0x8.
300    * - 0x1E                                       275    * - 0x1E
301      - u8                                         276      - u8
302      - struct dx_root_info.indirect_levels     !! 277      - struct dx\_root\_info.indirect\_levels
303      - Depth of the htree. Cannot be larger th !! 278      - Depth of the htree. Cannot be larger than 3 if the INCOMPAT\_LARGEDIR
304        feature is set; cannot be larger than 2    279        feature is set; cannot be larger than 2 otherwise.
305    * - 0x1F                                       280    * - 0x1F
306      - u8                                         281      - u8
307      - struct dx_root_info.unused_flags        !! 282      - struct dx\_root\_info.unused\_flags
308      -                                            283      -
309    * - 0x20                                       284    * - 0x20
310      - __le16                                  !! 285      - \_\_le16
311      - limit                                      286      - limit
312      - Maximum number of dx_entries that can f !! 287      - Maximum number of dx\_entries that can follow this header, plus 1 for
313        the header itself.                         288        the header itself.
314    * - 0x22                                       289    * - 0x22
315      - __le16                                  !! 290      - \_\_le16
316      - count                                      291      - count
317      - Actual number of dx_entries that follow !! 292      - Actual number of dx\_entries that follow this header, plus 1 for the
318        header itself.                             293        header itself.
319    * - 0x24                                       294    * - 0x24
320      - __le32                                  !! 295      - \_\_le32
321      - block                                      296      - block
322      - The block number (within the directory     297      - The block number (within the directory file) that goes with hash=0.
323    * - 0x28                                       298    * - 0x28
324      - struct dx_entry                         !! 299      - struct dx\_entry
325      - entries[0]                                 300      - entries[0]
326      - As many 8-byte ``struct dx_entry`` as f    301      - As many 8-byte ``struct dx_entry`` as fits in the rest of the data block.
327                                                   302 
328 .. _dirhash:                                      303 .. _dirhash:
329                                                   304 
330 The directory hash is one of the following val    305 The directory hash is one of the following values:
331                                                   306 
332 .. list-table::                                   307 .. list-table::
333    :widths: 16 64                                 308    :widths: 16 64
334    :header-rows: 1                                309    :header-rows: 1
335                                                   310 
336    * - Value                                      311    * - Value
337      - Description                                312      - Description
338    * - 0x0                                        313    * - 0x0
339      - Legacy.                                    314      - Legacy.
340    * - 0x1                                        315    * - 0x1
341      - Half MD4.                                  316      - Half MD4.
342    * - 0x2                                        317    * - 0x2
343      - Tea.                                       318      - Tea.
344    * - 0x3                                        319    * - 0x3
345      - Legacy, unsigned.                          320      - Legacy, unsigned.
346    * - 0x4                                        321    * - 0x4
347      - Half MD4, unsigned.                        322      - Half MD4, unsigned.
348    * - 0x5                                        323    * - 0x5
349      - Tea, unsigned.                             324      - Tea, unsigned.
350    * - 0x6                                     << 
351      - Siphash.                                << 
352                                                   325 
353 Interior nodes of an htree are recorded as ``s    326 Interior nodes of an htree are recorded as ``struct dx_node``, which is
354 also the full length of a data block:             327 also the full length of a data block:
355                                                   328 
356 .. list-table::                                   329 .. list-table::
357    :widths: 8 8 24 40                             330    :widths: 8 8 24 40
358    :header-rows: 1                                331    :header-rows: 1
359                                                   332 
360    * - Offset                                     333    * - Offset
361      - Type                                       334      - Type
362      - Name                                       335      - Name
363      - Description                                336      - Description
364    * - 0x0                                        337    * - 0x0
365      - __le32                                  !! 338      - \_\_le32
366      - fake.inode                                 339      - fake.inode
367      - Zero, to make it look like this entry i    340      - Zero, to make it look like this entry is not in use.
368    * - 0x4                                        341    * - 0x4
369      - __le16                                  !! 342      - \_\_le16
370      - fake.rec_len                            !! 343      - fake.rec\_len
371      - The size of the block, in order to hide !! 344      - The size of the block, in order to hide all of the dx\_node data.
372    * - 0x6                                        345    * - 0x6
373      - u8                                         346      - u8
374      - name_len                                !! 347      - name\_len
375      - Zero. There is no name for this “unus    348      - Zero. There is no name for this “unused” directory entry.
376    * - 0x7                                        349    * - 0x7
377      - u8                                         350      - u8
378      - file_type                               !! 351      - file\_type
379      - Zero. There is no file type for this     352      - Zero. There is no file type for this “unused” directory entry.
380    * - 0x8                                        353    * - 0x8
381      - __le16                                  !! 354      - \_\_le16
382      - limit                                      355      - limit
383      - Maximum number of dx_entries that can f !! 356      - Maximum number of dx\_entries that can follow this header, plus 1 for
384        the header itself.                         357        the header itself.
385    * - 0xA                                        358    * - 0xA
386      - __le16                                  !! 359      - \_\_le16
387      - count                                      360      - count
388      - Actual number of dx_entries that follow !! 361      - Actual number of dx\_entries that follow this header, plus 1 for the
389        header itself.                             362        header itself.
390    * - 0xE                                        363    * - 0xE
391      - __le32                                  !! 364      - \_\_le32
392      - block                                      365      - block
393      - The block number (within the directory     366      - The block number (within the directory file) that goes with the lowest
394        hash value of this block. This value is    367        hash value of this block. This value is stored in the parent block.
395    * - 0x12                                       368    * - 0x12
396      - struct dx_entry                         !! 369      - struct dx\_entry
397      - entries[0]                                 370      - entries[0]
398      - As many 8-byte ``struct dx_entry`` as f    371      - As many 8-byte ``struct dx_entry`` as fits in the rest of the data block.
399                                                   372 
400 The hash maps that exist in both ``struct dx_r    373 The hash maps that exist in both ``struct dx_root`` and
401 ``struct dx_node`` are recorded as ``struct dx    374 ``struct dx_node`` are recorded as ``struct dx_entry``, which is 8 bytes
402 long:                                             375 long:
403                                                   376 
404 .. list-table::                                   377 .. list-table::
405    :widths: 8 8 24 40                             378    :widths: 8 8 24 40
406    :header-rows: 1                                379    :header-rows: 1
407                                                   380 
408    * - Offset                                     381    * - Offset
409      - Type                                       382      - Type
410      - Name                                       383      - Name
411      - Description                                384      - Description
412    * - 0x0                                        385    * - 0x0
413      - __le32                                  !! 386      - \_\_le32
414      - hash                                       387      - hash
415      - Hash code.                                 388      - Hash code.
416    * - 0x4                                        389    * - 0x4
417      - __le32                                  !! 390      - \_\_le32
418      - block                                      391      - block
419      - Block number (within the directory file    392      - Block number (within the directory file, not filesystem blocks) of the
420        next node in the htree.                    393        next node in the htree.
421                                                   394 
422 (If you think this is all quite clever and pec    395 (If you think this is all quite clever and peculiar, so does the
423 author.)                                          396 author.)
424                                                   397 
425 If metadata checksums are enabled, the last 8     398 If metadata checksums are enabled, the last 8 bytes of the directory
426 block (precisely the length of one dx_entry) a !! 399 block (precisely the length of one dx\_entry) are used to store a
427 ``struct dx_tail``, which contains the checksu    400 ``struct dx_tail``, which contains the checksum. The ``limit`` and
428 ``count`` entries in the dx_root/dx_node struc !! 401 ``count`` entries in the dx\_root/dx\_node structures are adjusted as
429 necessary to fit the dx_tail into the block. I !! 402 necessary to fit the dx\_tail into the block. If there is no space for
430 the dx_tail, the user is notified to run e2fsc !! 403 the dx\_tail, the user is notified to run e2fsck -D to rebuild the
431 directory index (which will ensure that there'    404 directory index (which will ensure that there's space for the checksum.
432 The dx_tail structure is 8 bytes long and look !! 405 The dx\_tail structure is 8 bytes long and looks like this:
433                                                   406 
434 .. list-table::                                   407 .. list-table::
435    :widths: 8 8 24 40                             408    :widths: 8 8 24 40
436    :header-rows: 1                                409    :header-rows: 1
437                                                   410 
438    * - Offset                                     411    * - Offset
439      - Type                                       412      - Type
440      - Name                                       413      - Name
441      - Description                                414      - Description
442    * - 0x0                                        415    * - 0x0
443      - u32                                        416      - u32
444      - dt_reserved                             !! 417      - dt\_reserved
445      - Zero.                                      418      - Zero.
446    * - 0x4                                        419    * - 0x4
447      - __le32                                  !! 420      - \_\_le32
448      - dt_checksum                             !! 421      - dt\_checksum
449      - Checksum of the htree directory block.     422      - Checksum of the htree directory block.
450                                                   423 
451 The checksum is calculated against the FS UUID    424 The checksum is calculated against the FS UUID, the htree index header
452 (dx_root or dx_node), all of the htree indices !! 425 (dx\_root or dx\_node), all of the htree indices (dx\_entry) that are in
453 use, and the tail block (dx_tail).             !! 426 use, and the tail block (dx\_tail).
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php