add patch improve-code-readability-in-ext4_iget
[ext4-patch-queue.git] / import-superblocks-chapter-from-wiki-page
blob9d948d31ce6ec3389d09f01eaff4405239df884c
1 ext4: import superblocks chapter from wiki page
3 From: Darrick J. Wong <darrick.wong@oracle.com>
5 Import the chapter about superblocks from the on-disk format wiki
6 page into the kernel documentation.
8 Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
9 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 ---
11  Documentation/filesystems/ext4/ondisk/globals.rst |    9 
12  Documentation/filesystems/ext4/ondisk/index.rst   |    1 
13  Documentation/filesystems/ext4/ondisk/super.rst   |  773 +++++++++++++++++++++
14  3 files changed, 783 insertions(+)
15  create mode 100644 Documentation/filesystems/ext4/ondisk/globals.rst
16  create mode 100644 Documentation/filesystems/ext4/ondisk/super.rst
19 diff --git a/Documentation/filesystems/ext4/ondisk/globals.rst b/Documentation/filesystems/ext4/ondisk/globals.rst
20 new file mode 100644
21 index 000000000000..4a33d0571bf2
22 --- /dev/null
23 +++ b/Documentation/filesystems/ext4/ondisk/globals.rst
24 @@ -0,0 +1,9 @@
25 +.. SPDX-License-Identifier: GPL-2.0
27 +Global Structures
28 +=================
30 +The filesystem is sharded into a number of block groups, each of which
31 +have static metadata at fixed locations.
33 +.. include:: super.rst
34 diff --git a/Documentation/filesystems/ext4/ondisk/index.rst b/Documentation/filesystems/ext4/ondisk/index.rst
35 index 282ba197b6b2..dbb259f83976 100644
36 --- a/Documentation/filesystems/ext4/ondisk/index.rst
37 +++ b/Documentation/filesystems/ext4/ondisk/index.rst
38 @@ -5,3 +5,4 @@ Data Structures and Algorithms
39  ==============================
40  .. include:: about.rst
41  .. include:: overview.rst
42 +.. include:: globals.rst
43 diff --git a/Documentation/filesystems/ext4/ondisk/super.rst b/Documentation/filesystems/ext4/ondisk/super.rst
44 new file mode 100644
45 index 000000000000..1f5ac9ab6f0c
46 --- /dev/null
47 +++ b/Documentation/filesystems/ext4/ondisk/super.rst
48 @@ -0,0 +1,773 @@
49 +.. SPDX-License-Identifier: GPL-2.0
51 +Super Block
52 +-----------
54 +The superblock records various information about the enclosing
55 +filesystem, such as block counts, inode counts, supported features,
56 +maintenance information, and more.
58 +If the sparse\_super feature flag is set, redundant copies of the
59 +superblock and group descriptors are kept only in the groups whose group
60 +number is either 0 or a power of 3, 5, or 7. If the flag is not set,
61 +redundant copies are kept in all groups.
63 +The superblock checksum is calculated against the superblock structure,
64 +which includes the FS UUID.
66 +The ext4 superblock is laid out as follows in
67 +``struct ext4_super_block``:
69 +.. list-table::
70 +   :widths: 1 1 1 77
71 +   :header-rows: 1
73 +   * - Offset
74 +     - Size
75 +     - Name
76 +     - Description
77 +   * - 0x0
78 +     - \_\_le32
79 +     - s\_inodes\_count
80 +     - Total inode count.
81 +   * - 0x4
82 +     - \_\_le32
83 +     - s\_blocks\_count\_lo
84 +     - Total block count.
85 +   * - 0x8
86 +     - \_\_le32
87 +     - s\_r\_blocks\_count\_lo
88 +     - This number of blocks can only be allocated by the super-user.
89 +   * - 0xC
90 +     - \_\_le32
91 +     - s\_free\_blocks\_count\_lo
92 +     - Free block count.
93 +   * - 0x10
94 +     - \_\_le32
95 +     - s\_free\_inodes\_count
96 +     - Free inode count.
97 +   * - 0x14
98 +     - \_\_le32
99 +     - s\_first\_data\_block
100 +     - First data block. This must be at least 1 for 1k-block filesystems and
101 +       is typically 0 for all other block sizes.
102 +   * - 0x18
103 +     - \_\_le32
104 +     - s\_log\_block\_size
105 +     - Block size is 2 ^ (10 + s\_log\_block\_size).
106 +   * - 0x1C
107 +     - \_\_le32
108 +     - s\_log\_cluster\_size
109 +     - Cluster size is (2 ^ s\_log\_cluster\_size) blocks if bigalloc is
110 +       enabled. Otherwise s\_log\_cluster\_size must equal s\_log\_block\_size.
111 +   * - 0x20
112 +     - \_\_le32
113 +     - s\_blocks\_per\_group
114 +     - Blocks per group.
115 +   * - 0x24
116 +     - \_\_le32
117 +     - s\_clusters\_per\_group
118 +     - Clusters per group, if bigalloc is enabled. Otherwise
119 +       s\_clusters\_per\_group must equal s\_blocks\_per\_group.
120 +   * - 0x28
121 +     - \_\_le32
122 +     - s\_inodes\_per\_group
123 +     - Inodes per group.
124 +   * - 0x2C
125 +     - \_\_le32
126 +     - s\_mtime
127 +     - Mount time, in seconds since the epoch.
128 +   * - 0x30
129 +     - \_\_le32
130 +     - s\_wtime
131 +     - Write time, in seconds since the epoch.
132 +   * - 0x34
133 +     - \_\_le16
134 +     - s\_mnt\_count
135 +     - Number of mounts since the last fsck.
136 +   * - 0x36
137 +     - \_\_le16
138 +     - s\_max\_mnt\_count
139 +     - Number of mounts beyond which a fsck is needed.
140 +   * - 0x38
141 +     - \_\_le16
142 +     - s\_magic
143 +     - Magic signature, 0xEF53
144 +   * - 0x3A
145 +     - \_\_le16
146 +     - s\_state
147 +     - File system state. See super_state_ for more info.
148 +   * - 0x3C
149 +     - \_\_le16
150 +     - s\_errors
151 +     - Behaviour when detecting errors. See super_errors_ for more info.
152 +   * - 0x3E
153 +     - \_\_le16
154 +     - s\_minor\_rev\_level
155 +     - Minor revision level.
156 +   * - 0x40
157 +     - \_\_le32
158 +     - s\_lastcheck
159 +     - Time of last check, in seconds since the epoch.
160 +   * - 0x44
161 +     - \_\_le32
162 +     - s\_checkinterval
163 +     - Maximum time between checks, in seconds.
164 +   * - 0x48
165 +     - \_\_le32
166 +     - s\_creator\_os
167 +     - Creator OS. See the table super_creator_ for more info.
168 +   * - 0x4C
169 +     - \_\_le32
170 +     - s\_rev\_level
171 +     - Revision level. See the table super_revision_ for more info.
172 +   * - 0x50
173 +     - \_\_le16
174 +     - s\_def\_resuid
175 +     - Default uid for reserved blocks.
176 +   * - 0x52
177 +     - \_\_le16
178 +     - s\_def\_resgid
179 +     - Default gid for reserved blocks.
180 +   * -
181 +     -
182 +     -
183 +     - These fields are for EXT4_DYNAMIC_REV superblocks only.
184 +       
185 +       Note: the difference between the compatible feature set and the
186 +       incompatible feature set is that if there is a bit set in the
187 +       incompatible feature set that the kernel doesn't know about, it should
188 +       refuse to mount the filesystem.
189 +       
190 +       e2fsck's requirements are more strict; if it doesn't know
191 +       about a feature in either the compatible or incompatible feature set, it
192 +       must abort and not try to meddle with things it doesn't understand...
193 +   * - 0x54
194 +     - \_\_le32
195 +     - s\_first\_ino
196 +     - First non-reserved inode.
197 +   * - 0x58
198 +     - \_\_le16
199 +     - s\_inode\_size
200 +     - Size of inode structure, in bytes.
201 +   * - 0x5A
202 +     - \_\_le16
203 +     - s\_block\_group\_nr
204 +     - Block group # of this superblock.
205 +   * - 0x5C
206 +     - \_\_le32
207 +     - s\_feature\_compat
208 +     - Compatible feature set flags. Kernel can still read/write this fs even
209 +       if it doesn't understand a flag; fsck should not do that. See the
210 +       super_compat_ table for more info.
211 +   * - 0x60
212 +     - \_\_le32
213 +     - s\_feature\_incompat
214 +     - Incompatible feature set. If the kernel or fsck doesn't understand one
215 +       of these bits, it should stop. See the super_incompat_ table for more
216 +       info.
217 +   * - 0x64
218 +     - \_\_le32
219 +     - s\_feature\_ro\_compat
220 +     - Readonly-compatible feature set. If the kernel doesn't understand one of
221 +       these bits, it can still mount read-only. See the super_rocompat_ table
222 +       for more info.
223 +   * - 0x68
224 +     - \_\_u8
225 +     - s\_uuid[16]
226 +     - 128-bit UUID for volume.
227 +   * - 0x78
228 +     - char
229 +     - s\_volume\_name[16]
230 +     - Volume label.
231 +   * - 0x88
232 +     - char
233 +     - s\_last\_mounted[64]
234 +     - Directory where filesystem was last mounted.
235 +   * - 0xC8
236 +     - \_\_le32
237 +     - s\_algorithm\_usage\_bitmap
238 +     - For compression (Not used in e2fsprogs/Linux)
239 +   * -
240 +     -
241 +     -
242 +     - Performance hints.  Directory preallocation should only happen if the
243 +       EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
244 +   * - 0xCC
245 +     - \_\_u8
246 +     - s\_prealloc\_blocks
247 +     - #. of blocks to try to preallocate for ... files? (Not used in
248 +       e2fsprogs/Linux)
249 +   * - 0xCD
250 +     - \_\_u8
251 +     - s\_prealloc\_dir\_blocks
252 +     - #. of blocks to preallocate for directories. (Not used in
253 +       e2fsprogs/Linux)
254 +   * - 0xCE
255 +     - \_\_le16
256 +     - s\_reserved\_gdt\_blocks
257 +     - Number of reserved GDT entries for future filesystem expansion.
258 +   * -
259 +     -
260 +     -
261 +     - Journalling support is valid only if EXT4_FEATURE_COMPAT_HAS_JOURNAL is
262 +       set.
263 +   * - 0xD0
264 +     - \_\_u8
265 +     - s\_journal\_uuid[16]
266 +     - UUID of journal superblock
267 +   * - 0xE0
268 +     - \_\_le32
269 +     - s\_journal\_inum
270 +     - inode number of journal file.
271 +   * - 0xE4
272 +     - \_\_le32
273 +     - s\_journal\_dev
274 +     - Device number of journal file, if the external journal feature flag is
275 +       set.
276 +   * - 0xE8
277 +     - \_\_le32
278 +     - s\_last\_orphan
279 +     - Start of list of orphaned inodes to delete.
280 +   * - 0xEC
281 +     - \_\_le32
282 +     - s\_hash\_seed[4]
283 +     - HTREE hash seed.
284 +   * - 0xFC
285 +     - \_\_u8
286 +     - s\_def\_hash\_version
287 +     - Default hash algorithm to use for directory hashes. See super_def_hash_
288 +       for more info.
289 +   * - 0xFD
290 +     - \_\_u8
291 +     - s\_jnl\_backup\_type
292 +     - If this value is 0 or EXT3\_JNL\_BACKUP\_BLOCKS (1), then the
293 +       ``s_jnl_blocks`` field contains a duplicate copy of the inode's
294 +       ``i_block[]`` array and ``i_size``.
295 +   * - 0xFE
296 +     - \_\_le16
297 +     - s\_desc\_size
298 +     - Size of group descriptors, in bytes, if the 64bit incompat feature flag
299 +       is set.
300 +   * - 0x100
301 +     - \_\_le32
302 +     - s\_default\_mount\_opts
303 +     - Default mount options. See the super_mountopts_ table for more info.
304 +   * - 0x104
305 +     - \_\_le32
306 +     - s\_first\_meta\_bg
307 +     - First metablock block group, if the meta\_bg feature is enabled.
308 +   * - 0x108
309 +     - \_\_le32
310 +     - s\_mkfs\_time
311 +     - When the filesystem was created, in seconds since the epoch.
312 +   * - 0x10C
313 +     - \_\_le32
314 +     - s\_jnl\_blocks[17]
315 +     - Backup copy of the journal inode's ``i_block[]`` array in the first 15
316 +       elements and i\_size\_high and i\_size in the 16th and 17th elements,
317 +       respectively.
318 +   * -
319 +     -
320 +     -
321 +     - 64bit support is valid only if EXT4_FEATURE_COMPAT_64BIT is set.
322 +   * - 0x150
323 +     - \_\_le32
324 +     - s\_blocks\_count\_hi
325 +     - High 32-bits of the block count.
326 +   * - 0x154
327 +     - \_\_le32
328 +     - s\_r\_blocks\_count\_hi
329 +     - High 32-bits of the reserved block count.
330 +   * - 0x158
331 +     - \_\_le32
332 +     - s\_free\_blocks\_count\_hi
333 +     - High 32-bits of the free block count.
334 +   * - 0x15C
335 +     - \_\_le16
336 +     - s\_min\_extra\_isize
337 +     - All inodes have at least # bytes.
338 +   * - 0x15E
339 +     - \_\_le16
340 +     - s\_want\_extra\_isize
341 +     - New inodes should reserve # bytes.
342 +   * - 0x160
343 +     - \_\_le32
344 +     - s\_flags
345 +     - Miscellaneous flags. See the super_flags_ table for more info.
346 +   * - 0x164
347 +     - \_\_le16
348 +     - s\_raid\_stride
349 +     - RAID stride. This is the number of logical blocks read from or written
350 +       to the disk before moving to the next disk. This affects the placement
351 +       of filesystem metadata, which will hopefully make RAID storage faster.
352 +   * - 0x166
353 +     - \_\_le16
354 +     - s\_mmp\_interval
355 +     - #. seconds to wait in multi-mount prevention (MMP) checking. In theory,
356 +       MMP is a mechanism to record in the superblock which host and device
357 +       have mounted the filesystem, in order to prevent multiple mounts. This
358 +       feature does not seem to be implemented...
359 +   * - 0x168
360 +     - \_\_le64
361 +     - s\_mmp\_block
362 +     - Block # for multi-mount protection data.
363 +   * - 0x170
364 +     - \_\_le32
365 +     - s\_raid\_stripe\_width
366 +     - RAID stripe width. This is the number of logical blocks read from or
367 +       written to the disk before coming back to the current disk. This is used
368 +       by the block allocator to try to reduce the number of read-modify-write
369 +       operations in a RAID5/6.
370 +   * - 0x174
371 +     - \_\_u8
372 +     - s\_log\_groups\_per\_flex
373 +     - Size of a flexible block group is 2 ^ ``s_log_groups_per_flex``.
374 +   * - 0x175
375 +     - \_\_u8
376 +     - s\_checksum\_type
377 +     - Metadata checksum algorithm type. The only valid value is 1 (crc32c).
378 +   * - 0x176
379 +     - \_\_le16
380 +     - s\_reserved\_pad
381 +     -
382 +   * - 0x178
383 +     - \_\_le64
384 +     - s\_kbytes\_written
385 +     - Number of KiB written to this filesystem over its lifetime.
386 +   * - 0x180
387 +     - \_\_le32
388 +     - s\_snapshot\_inum
389 +     - inode number of active snapshot. (Not used in e2fsprogs/Linux.)
390 +   * - 0x184
391 +     - \_\_le32
392 +     - s\_snapshot\_id
393 +     - Sequential ID of active snapshot. (Not used in e2fsprogs/Linux.)
394 +   * - 0x188
395 +     - \_\_le64
396 +     - s\_snapshot\_r\_blocks\_count
397 +     - Number of blocks reserved for active snapshot's future use. (Not used in
398 +       e2fsprogs/Linux.)
399 +   * - 0x190
400 +     - \_\_le32
401 +     - s\_snapshot\_list
402 +     - inode number of the head of the on-disk snapshot list. (Not used in
403 +       e2fsprogs/Linux.)
404 +   * - 0x194
405 +     - \_\_le32
406 +     - s\_error\_count
407 +     - Number of errors seen.
408 +   * - 0x198
409 +     - \_\_le32
410 +     - s\_first\_error\_time
411 +     - First time an error happened, in seconds since the epoch.
412 +   * - 0x19C
413 +     - \_\_le32
414 +     - s\_first\_error\_ino
415 +     - inode involved in first error.
416 +   * - 0x1A0
417 +     - \_\_le64
418 +     - s\_first\_error\_block
419 +     - Number of block involved of first error.
420 +   * - 0x1A8
421 +     - \_\_u8
422 +     - s\_first\_error\_func[32]
423 +     - Name of function where the error happened.
424 +   * - 0x1C8
425 +     - \_\_le32
426 +     - s\_first\_error\_line
427 +     - Line number where error happened.
428 +   * - 0x1CC
429 +     - \_\_le32
430 +     - s\_last\_error\_time
431 +     - Time of most recent error, in seconds since the epoch.
432 +   * - 0x1D0
433 +     - \_\_le32
434 +     - s\_last\_error\_ino
435 +     - inode involved in most recent error.
436 +   * - 0x1D4
437 +     - \_\_le32
438 +     - s\_last\_error\_line
439 +     - Line number where most recent error happened.
440 +   * - 0x1D8
441 +     - \_\_le64
442 +     - s\_last\_error\_block
443 +     - Number of block involved in most recent error.
444 +   * - 0x1E0
445 +     - \_\_u8
446 +     - s\_last\_error\_func[32]
447 +     - Name of function where the most recent error happened.
448 +   * - 0x200
449 +     - \_\_u8
450 +     - s\_mount\_opts[64]
451 +     - ASCIIZ string of mount options.
452 +   * - 0x240
453 +     - \_\_le32
454 +     - s\_usr\_quota\_inum
455 +     - Inode number of user `quota <quota>`__ file.
456 +   * - 0x244
457 +     - \_\_le32
458 +     - s\_grp\_quota\_inum
459 +     - Inode number of group `quota <quota>`__ file.
460 +   * - 0x248
461 +     - \_\_le32
462 +     - s\_overhead\_blocks
463 +     - Overhead blocks/clusters in fs. (Huh? This field is always zero, which
464 +       means that the kernel calculates it dynamically.)
465 +   * - 0x24C
466 +     - \_\_le32
467 +     - s\_backup\_bgs[2]
468 +     - Block groups containing superblock backups (if sparse\_super2)
469 +   * - 0x254
470 +     - \_\_u8
471 +     - s\_encrypt\_algos[4]
472 +     - Encryption algorithms in use. There can be up to four algorithms in use
473 +       at any time; valid algorithm codes are given in the super_encrypt_ table
474 +       below.
475 +   * - 0x258
476 +     - \_\_u8
477 +     - s\_encrypt\_pw\_salt[16]
478 +     - Salt for the string2key algorithm for encryption.
479 +   * - 0x268
480 +     - \_\_le32
481 +     - s\_lpf\_ino
482 +     - Inode number of lost+found
483 +   * - 0x26C
484 +     - \_\_le32
485 +     - s\_prj\_quota\_inum
486 +     - Inode that tracks project quotas.
487 +   * - 0x270
488 +     - \_\_le32
489 +     - s\_checksum\_seed
490 +     - Checksum seed used for metadata\_csum calculations. This value is
491 +       crc32c(~0, $orig\_fs\_uuid).
492 +   * - 0x274
493 +     - \_\_le32
494 +     - s\_reserved[98]
495 +     - Padding to the end of the block.
496 +   * - 0x3FC
497 +     - \_\_le32
498 +     - s\_checksum
499 +     - Superblock checksum.
501 +.. _super_state:
503 +The superblock state is some combination of the following:
505 +.. list-table::
506 +   :widths: 1 79
507 +   :header-rows: 1
509 +   * - Value
510 +     - Description
511 +   * - 0x0001
512 +     - Cleanly umounted
513 +   * - 0x0002
514 +     - Errors detected
515 +   * - 0x0004
516 +     - Orphans being recovered
518 +.. _super_errors:
520 +The superblock error policy is one of the following:
522 +.. list-table::
523 +   :widths: 1 79
524 +   :header-rows: 1
526 +   * - Value
527 +     - Description
528 +   * - 1
529 +     - Continue
530 +   * - 2
531 +     - Remount read-only
532 +   * - 3
533 +     - Panic
535 +.. _super_creator:
537 +The filesystem creator is one of the following:
539 +.. list-table::
540 +   :widths: 1 79
541 +   :header-rows: 1
543 +   * - Value
544 +     - Description
545 +   * - 0
546 +     - Linux
547 +   * - 1
548 +     - Hurd
549 +   * - 2
550 +     - Masix
551 +   * - 3
552 +     - FreeBSD
553 +   * - 4
554 +     - Lites
556 +.. _super_revision:
558 +The superblock revision is one of the following:
560 +.. list-table::
561 +   :widths: 1 79
562 +   :header-rows: 1
564 +   * - Value
565 +     - Description
566 +   * - 0
567 +     - Original format
568 +   * - 1
569 +     - v2 format w/ dynamic inode sizes
571 +Note that ``EXT4_DYNAMIC_REV`` refers to a revision 1 or newer filesystem.
573 +.. _super_compat:
575 +The superblock compatible features field is a combination of any of the
576 +following:
578 +.. list-table::
579 +   :widths: 1 79
580 +   :header-rows: 1
582 +   * - Value
583 +     - Description
584 +   * - 0x1
585 +     - Directory preallocation (COMPAT\_DIR\_PREALLOC).
586 +   * - 0x2
587 +     - “imagic inodes”. Not clear from the code what this does
588 +       (COMPAT\_IMAGIC\_INODES).
589 +   * - 0x4
590 +     - Has a journal (COMPAT\_HAS\_JOURNAL).
591 +   * - 0x8
592 +     - Supports extended attributes (COMPAT\_EXT\_ATTR).
593 +   * - 0x10
594 +     - Has reserved GDT blocks for filesystem expansion
595 +       (COMPAT\_RESIZE\_INODE). Requires RO\_COMPAT\_SPARSE\_SUPER.
596 +   * - 0x20
597 +     - Has directory indices (COMPAT\_DIR\_INDEX).
598 +   * - 0x40
599 +     - “Lazy BG”. Not in Linux kernel, seems to have been for uninitialized
600 +       block groups? (COMPAT\_LAZY\_BG)
601 +   * - 0x80
602 +     - “Exclude inode”. Not used. (COMPAT\_EXCLUDE\_INODE).
603 +   * - 0x100
604 +     - “Exclude bitmap”. Seems to be used to indicate the presence of
605 +       snapshot-related exclude bitmaps? Not defined in kernel or used in
606 +       e2fsprogs (COMPAT\_EXCLUDE\_BITMAP).
607 +   * - 0x200
608 +     - Sparse Super Block, v2. If this flag is set, the SB field s\_backup\_bgs
609 +       points to the two block groups that contain backup superblocks
610 +       (COMPAT\_SPARSE\_SUPER2).
612 +.. _super_incompat:
614 +The superblock incompatible features field is a combination of any of the
615 +following:
617 +.. list-table::
618 +   :widths: 1 79
619 +   :header-rows: 1
621 +   * - Value
622 +     - Description
623 +   * - 0x1
624 +     - Compression (INCOMPAT\_COMPRESSION).
625 +   * - 0x2
626 +     - Directory entries record the file type. See ext4\_dir\_entry\_2 below
627 +       (INCOMPAT\_FILETYPE).
628 +   * - 0x4
629 +     - Filesystem needs recovery (INCOMPAT\_RECOVER).
630 +   * - 0x8
631 +     - Filesystem has a separate journal device (INCOMPAT\_JOURNAL\_DEV).
632 +   * - 0x10
633 +     - Meta block groups. See the earlier discussion of this feature
634 +       (INCOMPAT\_META\_BG).
635 +   * - 0x40
636 +     - Files in this filesystem use extents (INCOMPAT\_EXTENTS).
637 +   * - 0x80
638 +     - Enable a filesystem size of 2^64 blocks (INCOMPAT\_64BIT).
639 +   * - 0x100
640 +     - Multiple mount protection. Not implemented (INCOMPAT\_MMP).
641 +   * - 0x200
642 +     - Flexible block groups. See the earlier discussion of this feature
643 +       (INCOMPAT\_FLEX\_BG).
644 +   * - 0x400
645 +     - Inodes can be used to store large extended attribute values
646 +       (INCOMPAT\_EA\_INODE).
647 +   * - 0x1000
648 +     - Data in directory entry (INCOMPAT\_DIRDATA). (Not implemented?)
649 +   * - 0x2000
650 +     - Metadata checksum seed is stored in the superblock. This feature enables
651 +       the administrator to change the UUID of a metadata\_csum filesystem
652 +       while the filesystem is mounted; without it, the checksum definition
653 +       requires all metadata blocks to be rewritten (INCOMPAT\_CSUM\_SEED).
654 +   * - 0x4000
655 +     - Large directory >2GB or 3-level htree (INCOMPAT\_LARGEDIR). Prior to
656 +       this feature, directories could not be larger than 4GiB and could not
657 +       have an htree more than 2 levels deep. If this feature is enabled,
658 +       directories can be larger than 4GiB and have a maximum htree depth of 3.
659 +   * - 0x8000
660 +     - Data in inode (INCOMPAT\_INLINE\_DATA).
661 +   * - 0x10000
662 +     - Encrypted inodes are present on the filesystem. (INCOMPAT\_ENCRYPT).
664 +.. _super_rocompat:
666 +The superblock read-only compatible features field is a combination of any of
667 +the following:
669 +.. list-table::
670 +   :widths: 1 79
671 +   :header-rows: 1
673 +   * - Value
674 +     - Description
675 +   * - 0x1
676 +     - Sparse superblocks. See the earlier discussion of this feature
677 +       (RO\_COMPAT\_SPARSE\_SUPER).
678 +   * - 0x2
679 +     - This filesystem has been used to store a file greater than 2GiB
680 +       (RO\_COMPAT\_LARGE\_FILE).
681 +   * - 0x4
682 +     - Not used in kernel or e2fsprogs (RO\_COMPAT\_BTREE\_DIR).
683 +   * - 0x8
684 +     - This filesystem has files whose sizes are represented in units of
685 +       logical blocks, not 512-byte sectors. This implies a very large file
686 +       indeed! (RO\_COMPAT\_HUGE\_FILE)
687 +   * - 0x10
688 +     - Group descriptors have checksums. In addition to detecting corruption,
689 +       this is useful for lazy formatting with uninitialized groups
690 +       (RO\_COMPAT\_GDT\_CSUM).
691 +   * - 0x20
692 +     - Indicates that the old ext3 32,000 subdirectory limit no longer applies
693 +       (RO\_COMPAT\_DIR\_NLINK). A directory's i\_links\_count will be set to 1
694 +       if it is incremented past 64,999.
695 +   * - 0x40
696 +     - Indicates that large inodes exist on this filesystem
697 +       (RO\_COMPAT\_EXTRA\_ISIZE).
698 +   * - 0x80
699 +     - This filesystem has a snapshot (RO\_COMPAT\_HAS\_SNAPSHOT).
700 +   * - 0x100
701 +     - `Quota <Quota>`__ (RO\_COMPAT\_QUOTA).
702 +   * - 0x200
703 +     - This filesystem supports “bigalloc”, which means that file extents are
704 +       tracked in units of clusters (of blocks) instead of blocks
705 +       (RO\_COMPAT\_BIGALLOC).
706 +   * - 0x400
707 +     - This filesystem supports metadata checksumming.
708 +       (RO\_COMPAT\_METADATA\_CSUM; implies RO\_COMPAT\_GDT\_CSUM, though
709 +       GDT\_CSUM must not be set)
710 +   * - 0x800
711 +     - Filesystem supports replicas. This feature is neither in the kernel nor
712 +       e2fsprogs. (RO\_COMPAT\_REPLICA)
713 +   * - 0x1000
714 +     - Read-only filesystem image; the kernel will not mount this image
715 +       read-write and most tools will refuse to write to the image.
716 +       (RO\_COMPAT\_READONLY)
717 +   * - 0x2000
718 +     - Filesystem tracks project quotas. (RO\_COMPAT\_PROJECT)
720 +.. _super_def_hash:
722 +The ``s_def_hash_version`` field is one of the following:
724 +.. list-table::
725 +   :widths: 1 79
726 +   :header-rows: 1
728 +   * - Value
729 +     - Description
730 +   * - 0x0
731 +     - Legacy.
732 +   * - 0x1
733 +     - Half MD4.
734 +   * - 0x2
735 +     - Tea.
736 +   * - 0x3
737 +     - Legacy, unsigned.
738 +   * - 0x4
739 +     - Half MD4, unsigned.
740 +   * - 0x5
741 +     - Tea, unsigned.
743 +.. _super_mountopts:
745 +The ``s_default_mount_opts`` field is any combination of the following:
747 +.. list-table::
748 +   :widths: 1 79
749 +   :header-rows: 1
751 +   * - Value
752 +     - Description
753 +   * - 0x0001
754 +     - Print debugging info upon (re)mount. (EXT4\_DEFM\_DEBUG)
755 +   * - 0x0002
756 +     - New files take the gid of the containing directory (instead of the fsgid
757 +       of the current process). (EXT4\_DEFM\_BSDGROUPS)
758 +   * - 0x0004
759 +     - Support userspace-provided extended attributes. (EXT4\_DEFM\_XATTR\_USER)
760 +   * - 0x0008
761 +     - Support POSIX access control lists (ACLs). (EXT4\_DEFM\_ACL)
762 +   * - 0x0010
763 +     - Do not support 32-bit UIDs. (EXT4\_DEFM\_UID16)
764 +   * - 0x0020
765 +     - All data and metadata are commited to the journal.
766 +       (EXT4\_DEFM\_JMODE\_DATA)
767 +   * - 0x0040
768 +     - All data are flushed to the disk before metadata are committed to the
769 +       journal. (EXT4\_DEFM\_JMODE\_ORDERED)
770 +   * - 0x0060
771 +     - Data ordering is not preserved; data may be written after the metadata
772 +       has been written. (EXT4\_DEFM\_JMODE\_WBACK)
773 +   * - 0x0100
774 +     - Disable write flushes. (EXT4\_DEFM\_NOBARRIER)
775 +   * - 0x0200
776 +     - Track which blocks in a filesystem are metadata and therefore should not
777 +       be used as data blocks. This option will be enabled by default on 3.18,
778 +       hopefully. (EXT4\_DEFM\_BLOCK\_VALIDITY)
779 +   * - 0x0400
780 +     - Enable DISCARD support, where the storage device is told about blocks
781 +       becoming unused. (EXT4\_DEFM\_DISCARD)
782 +   * - 0x0800
783 +     - Disable delayed allocation. (EXT4\_DEFM\_NODELALLOC)
785 +.. _super_flags:
787 +The ``s_flags`` field is any combination of the following:
789 +.. list-table::
790 +   :widths: 1 79
791 +   :header-rows: 1
793 +   * - Value
794 +     - Description
795 +   * - 0x0001
796 +     - Signed directory hash in use.
797 +   * - 0x0002
798 +     - Unsigned directory hash in use.
799 +   * - 0x0004
800 +     - To test development code.
802 +.. _super_encrypt:
804 +The ``s_encrypt_algos`` list can contain any of the following:
806 +.. list-table::
807 +   :widths: 1 79
808 +   :header-rows: 1
810 +   * - Value
811 +     - Description
812 +   * - 0
813 +     - Invalid algorithm (ENCRYPTION\_MODE\_INVALID).
814 +   * - 1
815 +     - 256-bit AES in XTS mode (ENCRYPTION\_MODE\_AES\_256\_XTS).
816 +   * - 2
817 +     - 256-bit AES in GCM mode (ENCRYPTION\_MODE\_AES\_256\_GCM).
818 +   * - 3
819 +     - 256-bit AES in CBC mode (ENCRYPTION\_MODE\_AES\_256\_CBC).
821 +Total size of the superblock is 1024 bytes.