Skip to content

Commit 70cb0d0

Browse files
committed
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 updates from Ted Ts'o: "Added new ext4 debugging ioctls to allow userspace to get information about the state of the extent status cache. Dropped workaround for pre-1970 dates which were encoded incorrectly in pre-4.4 kernels. Since both the kernel correctly generates, and e2fsck detects and fixes this issue for the past four years, it'e time to drop the workaround. (Also, it's not like files with dates in the distant past were all that common in the first place.) A lot of miscellaneous bug fixes and cleanups, including some ext4 Documentation fixes. Also included are two minor bug fixes in fs/unicode" * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (21 commits) unicode: make array 'token' static const, makes object smaller unicode: Move static keyword to the front of declarations ext4: add missing bigalloc documentation. ext4: fix kernel oops caused by spurious casefold flag ext4: fix integer overflow when calculating commit interval ext4: use percpu_counters for extent_status cache hits/misses ext4: fix potential use after free after remounting with noblock_validity jbd2: add missing tracepoint for reserved handle ext4: fix punch hole for inline_data file systems ext4: rework reserved cluster accounting when invalidating pages ext4: documentation fixes ext4: treat buffers with write errors as containing valid data ext4: fix warning inside ext4_convert_unwritten_extents_endio ext4: set error return correctly when ext4_htree_store_dirent fails ext4: drop legacy pre-1970 encoding workaround ext4: add new ioctl EXT4_IOC_GET_ES_CACHE ext4: add a new ioctl EXT4_IOC_GETSTATE ext4: add a new ioctl EXT4_IOC_CLEAR_ES_CACHE jbd2: flush_descriptor(): Do not decrease buffer head's ref count ext4: remove unnecessary error check ...
2 parents 104c0d6 + 040823b commit 70cb0d0

24 files changed

Lines changed: 890 additions & 309 deletions

‎Documentation/filesystems/ext4/bigalloc.rst‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,26 @@ ext4 code is not prepared to handle the case where the block size
99
exceeds the page size. However, for a filesystem of mostly huge files,
1010
it is desirable to be able to allocate disk blocks in units of multiple
1111
blocks to reduce both fragmentation and metadata overhead. The
12-
`bigalloc <Bigalloc>`__ feature provides exactly this ability. The
13-
administrator can set a block cluster size at mkfs time (which is stored
14-
in the s\_log\_cluster\_size field in the superblock); from then on, the
15-
block bitmaps track clusters, not individual blocks. This means that
16-
block groups can be several gigabytes in size (instead of just 128MiB);
17-
however, the minimum allocation unit becomes a cluster, not a block,
18-
even for directories. TaoBao had a patchset to extend the “use units of
19-
clusters instead of blocks” to the extent tree, though it is not clear
20-
where those patches went-- they eventually morphed into “extent tree v2”
21-
but that code has not landed as of May 2015.
12+
bigalloc feature provides exactly this ability.
13+
14+
The bigalloc feature (EXT4_FEATURE_RO_COMPAT_BIGALLOC) changes ext4 to
15+
use clustered allocation, so that each bit in the ext4 block allocation
16+
bitmap addresses a power of two number of blocks. For example, if the
17+
file system is mainly going to be storing large files in the 4-32
18+
megabyte range, it might make sense to set a cluster size of 1 megabyte.
19+
This means that each bit in the block allocation bitmap now addresses
20+
256 4k blocks. This shrinks the total size of the block allocation
21+
bitmaps for a 2T file system from 64 megabytes to 256 kilobytes. It also
22+
means that a block group addresses 32 gigabytes instead of 128 megabytes,
23+
also shrinking the amount of file system overhead for metadata.
24+
25+
The administrator can set a block cluster size at mkfs time (which is
26+
stored in the s\_log\_cluster\_size field in the superblock); from then
27+
on, the block bitmaps track clusters, not individual blocks. This means
28+
that block groups can be several gigabytes in size (instead of just
29+
128MiB); however, the minimum allocation unit becomes a cluster, not a
30+
block, even for directories. TaoBao had a patchset to extend the “use
31+
units of clusters instead of blocks” to the extent tree, though it is
32+
not clear where those patches went-- they eventually morphed into
33+
“extent tree v2” but that code has not landed as of May 2015.
2234

‎Documentation/filesystems/ext4/blockgroup.rst‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ if the flex\_bg size is 4, then group 0 will contain (in order) the
7171
superblock, group descriptors, data block bitmaps for groups 0-3, inode
7272
bitmaps for groups 0-3, inode tables for groups 0-3, and the remaining
7373
space in group 0 is for file data. The effect of this is to group the
74-
block metadata close together for faster loading, and to enable large
75-
files to be continuous on disk. Backup copies of the superblock and
76-
group descriptors are always at the beginning of block groups, even if
77-
flex\_bg is enabled. The number of block groups that make up a flex\_bg
78-
is given by 2 ^ ``sb.s_log_groups_per_flex``.
74+
block group metadata close together for faster loading, and to enable
75+
large files to be continuous on disk. Backup copies of the superblock
76+
and group descriptors are always at the beginning of block groups, even
77+
if flex\_bg is enabled. The number of block groups that make up a
78+
flex\_bg is given by 2 ^ ``sb.s_log_groups_per_flex``.
7979

8080
Meta Block Groups
8181
-----------------

‎Documentation/filesystems/ext4/blocks.rst‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ block groups. Block size is specified at mkfs time and typically is
1010
4KiB. You may experience mounting problems if block size is greater than
1111
page size (i.e. 64KiB blocks on a i386 which only has 4KiB memory
1212
pages). By default a filesystem can contain 2^32 blocks; if the '64bit'
13-
feature is enabled, then a filesystem can have 2^64 blocks.
13+
feature is enabled, then a filesystem can have 2^64 blocks. The location
14+
of structures is stored in terms of the block number the structure lives
15+
in and not the absolute offset on disk.
1416

1517
For 32-bit filesystems, limits are as follows:
1618

‎Documentation/filesystems/ext4/directory.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ is at most 263 bytes long, though on disk you'll need to reference
5959
- File name.
6060

6161
Since file names cannot be longer than 255 bytes, the new directory
62-
entry format shortens the rec\_len field and uses the space for a file
62+
entry format shortens the name\_len field and uses the space for a file
6363
type flag, probably to avoid having to load every inode during directory
6464
tree traversal. This format is ``ext4_dir_entry_2``, which is at most
6565
263 bytes long, though on disk you'll need to reference

‎Documentation/filesystems/ext4/group_descr.rst‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,12 @@ The block group descriptor is laid out in ``struct ext4_group_desc``.
9999
* - 0x1E
100100
- \_\_le16
101101
- bg\_checksum
102-
- Group descriptor checksum; crc16(sb\_uuid+group+desc) if the
103-
RO\_COMPAT\_GDT\_CSUM feature is set, or crc32c(sb\_uuid+group\_desc) &
104-
0xFFFF if the RO\_COMPAT\_METADATA\_CSUM feature is set.
102+
- Group descriptor checksum; crc16(sb\_uuid+group\_num+bg\_desc) if the
103+
RO\_COMPAT\_GDT\_CSUM feature is set, or
104+
crc32c(sb\_uuid+group\_num+bg\_desc) & 0xFFFF if the
105+
RO\_COMPAT\_METADATA\_CSUM feature is set. The bg\_checksum
106+
field in bg\_desc is skipped when calculating crc16 checksum,
107+
and set to zero if crc32c checksum is used.
105108
* -
106109
-
107110
-

‎Documentation/filesystems/ext4/inodes.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ inode, which allows struct ext4\_inode to grow for a new kernel without
472472
having to upgrade all of the on-disk inodes. Access to fields beyond
473473
EXT2\_GOOD\_OLD\_INODE\_SIZE should be verified to be within
474474
``i_extra_isize``. By default, ext4 inode records are 256 bytes, and (as
475-
of October 2013) the inode structure is 156 bytes
476-
(``i_extra_isize = 28``). The extra space between the end of the inode
475+
of August 2019) the inode structure is 160 bytes
476+
(``i_extra_isize = 32``). The extra space between the end of the inode
477477
structure and the end of the inode record can be used to store extended
478478
attributes. Each inode record can be as large as the filesystem block
479479
size, though this is not terribly efficient.

‎Documentation/filesystems/ext4/super.rst‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The ext4 superblock is laid out as follows in
5858
* - 0x1C
5959
- \_\_le32
6060
- s\_log\_cluster\_size
61-
- Cluster size is (2 ^ s\_log\_cluster\_size) blocks if bigalloc is
61+
- Cluster size is 2 ^ (10 + s\_log\_cluster\_size) blocks if bigalloc is
6262
enabled. Otherwise s\_log\_cluster\_size must equal s\_log\_block\_size.
6363
* - 0x20
6464
- \_\_le32
@@ -447,7 +447,7 @@ The ext4 superblock is laid out as follows in
447447
- Upper 8 bits of the s_wtime field.
448448
* - 0x275
449449
- \_\_u8
450-
- s\_wtime_hi
450+
- s\_mtime_hi
451451
- Upper 8 bits of the s_mtime field.
452452
* - 0x276
453453
- \_\_u8
@@ -466,12 +466,20 @@ The ext4 superblock is laid out as follows in
466466
- s\_last_error_time_hi
467467
- Upper 8 bits of the s_last_error_time_hi field.
468468
* - 0x27A
469-
- \_\_u8[2]
470-
- s\_pad
469+
- \_\_u8
470+
- s\_pad[2]
471471
- Zero padding.
472472
* - 0x27C
473+
- \_\_le16
474+
- s\_encoding
475+
- Filename charset encoding.
476+
* - 0x27E
477+
- \_\_le16
478+
- s\_encoding_flags
479+
- Filename charset encoding flags.
480+
* - 0x280
473481
- \_\_le32
474-
- s\_reserved[96]
482+
- s\_reserved[95]
475483
- Padding to the end of the block.
476484
* - 0x3FC
477485
- \_\_le32
@@ -617,7 +625,7 @@ following:
617625
* - 0x80
618626
- Enable a filesystem size of 2^64 blocks (INCOMPAT\_64BIT).
619627
* - 0x100
620-
- Multiple mount protection. Not implemented (INCOMPAT\_MMP).
628+
- Multiple mount protection (INCOMPAT\_MMP).
621629
* - 0x200
622630
- Flexible block groups. See the earlier discussion of this feature
623631
(INCOMPAT\_FLEX\_BG).

0 commit comments

Comments
 (0)