Skip to content

Commit 354c6e0

Browse files
committed
Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 fixes from Ted Ts'o: "Fix a variety of bugs, many of which were found by folks using fuzzing or error injection. Also fix up how test_dummy_encryption mount option is handled for the new mount API. Finally, fix/cleanup a number of comments and ext4 Documentation files" * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: ext4: fix a doubled word "need" in a comment ext4: add reserved GDT blocks check ext4: make variable "count" signed ext4: correct the judgment of BUG in ext4_mb_normalize_request ext4: fix bug_on ext4_mb_use_inode_pa ext4: fix up test_dummy_encryption handling for new mount API ext4: use kmemdup() to replace kmalloc + memcpy ext4: fix super block checksum incorrect after mount ext4: improve write performance with disabled delalloc ext4: fix warning when submitting superblock in ext4_commit_super() ext4, doc: remove unnecessary escaping ext4: fix incorrect comment in ext4_bio_write_page() fs: fix jbd2_journal_try_to_free_buffers() kernel-doc comment
2 parents ace2045 + 1f3ddff commit 354c6e0

26 files changed

+947
-895
lines changed

Documentation/filesystems/ext4/attributes.rst

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ disappeared as of Linux 3.0.
1313

1414
There are two places where extended attributes can be found. The first
1515
place is between the end of each inode entry and the beginning of the
16-
next inode entry. For example, if inode.i\_extra\_isize = 28 and
17-
sb.inode\_size = 256, then there are 256 - (128 + 28) = 100 bytes
16+
next inode entry. For example, if inode.i_extra_isize = 28 and
17+
sb.inode_size = 256, then there are 256 - (128 + 28) = 100 bytes
1818
available for in-inode extended attribute storage. The second place
1919
where extended attributes can be found is in the block pointed to by
2020
``inode.i_file_acl``. As of Linux 3.11, it is not possible for this
@@ -38,8 +38,8 @@ Extended attributes, when stored after the inode, have a header
3838
- Name
3939
- Description
4040
* - 0x0
41-
- \_\_le32
42-
- h\_magic
41+
- __le32
42+
- h_magic
4343
- Magic number for identification, 0xEA020000. This value is set by the
4444
Linux driver, though e2fsprogs doesn't seem to check it(?)
4545

@@ -55,28 +55,28 @@ The beginning of an extended attribute block is in
5555
- Name
5656
- Description
5757
* - 0x0
58-
- \_\_le32
59-
- h\_magic
58+
- __le32
59+
- h_magic
6060
- Magic number for identification, 0xEA020000.
6161
* - 0x4
62-
- \_\_le32
63-
- h\_refcount
62+
- __le32
63+
- h_refcount
6464
- Reference count.
6565
* - 0x8
66-
- \_\_le32
67-
- h\_blocks
66+
- __le32
67+
- h_blocks
6868
- Number of disk blocks used.
6969
* - 0xC
70-
- \_\_le32
71-
- h\_hash
70+
- __le32
71+
- h_hash
7272
- Hash value of all attributes.
7373
* - 0x10
74-
- \_\_le32
75-
- h\_checksum
74+
- __le32
75+
- h_checksum
7676
- Checksum of the extended attribute block.
7777
* - 0x14
78-
- \_\_u32
79-
- h\_reserved[3]
78+
- __u32
79+
- h_reserved[3]
8080
- Zero.
8181

8282
The checksum is calculated against the FS UUID, the 64-bit block number
@@ -100,46 +100,46 @@ Attributes stored inside an inode do not need be stored in sorted order.
100100
- Name
101101
- Description
102102
* - 0x0
103-
- \_\_u8
104-
- e\_name\_len
103+
- __u8
104+
- e_name_len
105105
- Length of name.
106106
* - 0x1
107-
- \_\_u8
108-
- e\_name\_index
107+
- __u8
108+
- e_name_index
109109
- Attribute name index. There is a discussion of this below.
110110
* - 0x2
111-
- \_\_le16
112-
- e\_value\_offs
111+
- __le16
112+
- e_value_offs
113113
- Location of this attribute's value on the disk block where it is stored.
114114
Multiple attributes can share the same value. For an inode attribute
115115
this value is relative to the start of the first entry; for a block this
116116
value is relative to the start of the block (i.e. the header).
117117
* - 0x4
118-
- \_\_le32
119-
- e\_value\_inum
118+
- __le32
119+
- e_value_inum
120120
- The inode where the value is stored. Zero indicates the value is in the
121121
same block as this entry. This field is only used if the
122-
INCOMPAT\_EA\_INODE feature is enabled.
122+
INCOMPAT_EA_INODE feature is enabled.
123123
* - 0x8
124-
- \_\_le32
125-
- e\_value\_size
124+
- __le32
125+
- e_value_size
126126
- Length of attribute value.
127127
* - 0xC
128-
- \_\_le32
129-
- e\_hash
128+
- __le32
129+
- e_hash
130130
- Hash value of attribute name and attribute value. The kernel doesn't
131131
update the hash for in-inode attributes, so for that case this value
132132
must be zero, because e2fsck validates any non-zero hash regardless of
133133
where the xattr lives.
134134
* - 0x10
135135
- char
136-
- e\_name[e\_name\_len]
136+
- e_name[e_name_len]
137137
- Attribute name. Does not include trailing NULL.
138138

139139
Attribute values can follow the end of the entry table. There appears to
140140
be a requirement that they be aligned to 4-byte boundaries. The values
141141
are stored starting at the end of the block and grow towards the
142-
xattr\_header/xattr\_entry table. When the two collide, the overflow is
142+
xattr_header/xattr_entry table. When the two collide, the overflow is
143143
put into a separate disk block. If the disk block fills up, the
144144
filesystem returns -ENOSPC.
145145

@@ -167,15 +167,15 @@ the key name. Here is a map of name index values to key prefixes:
167167
* - 1
168168
- “user.”
169169
* - 2
170-
- “system.posix\_acl\_access
170+
- “system.posix_acl_access
171171
* - 3
172-
- “system.posix\_acl\_default
172+
- “system.posix_acl_default
173173
* - 4
174174
- “trusted.”
175175
* - 6
176176
- “security.”
177177
* - 7
178-
- “system.” (inline\_data only?)
178+
- “system.” (inline_data only?)
179179
* - 8
180180
- “system.richacl” (SuSE kernels only?)
181181

Documentation/filesystems/ext4/bigalloc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ means that a block group addresses 32 gigabytes instead of 128 megabytes,
2323
also shrinking the amount of file system overhead for metadata.
2424

2525
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
26+
stored in the s_log_cluster_size field in the superblock); from then
2727
on, the block bitmaps track clusters, not individual blocks. This means
2828
that block groups can be several gigabytes in size (instead of just
2929
128MiB); however, the minimum allocation unit becomes a cluster, not a

Documentation/filesystems/ext4/bitmaps.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ group.
99
The inode bitmap records which entries in the inode table are in use.
1010

1111
As with most bitmaps, one bit represents the usage status of one data
12-
block or inode table entry. This implies a block group size of 8 \*
13-
number\_of\_bytes\_in\_a\_logical\_block.
12+
block or inode table entry. This implies a block group size of 8 *
13+
number_of_bytes_in_a_logical_block.
1414

1515
NOTE: If ``BLOCK_UNINIT`` is set for a given block group, various parts
1616
of the kernel and e2fsprogs code pretends that the block bitmap contains
1717
zeros (i.e. all blocks in the group are free). However, it is not
1818
necessarily the case that no blocks are in use -- if ``meta_bg`` is set,
1919
the bitmaps and group descriptor live inside the group. Unfortunately,
20-
ext2fs\_test\_block\_bitmap2() will return '0' for those locations,
20+
ext2fs_test_block_bitmap2() will return '0' for those locations,
2121
which produces confusing debugfs output.
2222

2323
Inode Table

Documentation/filesystems/ext4/blockgroup.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,39 +56,39 @@ established that the super block and the group descriptor table, if
5656
present, will be at the beginning of the block group. The bitmaps and
5757
the inode table can be anywhere, and it is quite possible for the
5858
bitmaps to come after the inode table, or for both to be in different
59-
groups (flex\_bg). Leftover space is used for file data blocks, indirect
59+
groups (flex_bg). Leftover space is used for file data blocks, indirect
6060
block maps, extent tree blocks, and extended attributes.
6161

6262
Flexible Block Groups
6363
---------------------
6464

6565
Starting in ext4, there is a new feature called flexible block groups
66-
(flex\_bg). In a flex\_bg, several block groups are tied together as one
66+
(flex_bg). In a flex_bg, several block groups are tied together as one
6767
logical block group; the bitmap spaces and the inode table space in the
68-
first block group of the flex\_bg are expanded to include the bitmaps
69-
and inode tables of all other block groups in the flex\_bg. For example,
70-
if the flex\_bg size is 4, then group 0 will contain (in order) the
68+
first block group of the flex_bg are expanded to include the bitmaps
69+
and inode tables of all other block groups in the flex_bg. For example,
70+
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
7474
block group metadata close together for faster loading, and to enable
7575
large files to be continuous on disk. Backup copies of the superblock
7676
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``.
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
-----------------
8282

83-
Without the option META\_BG, for safety concerns, all block group
83+
Without the option META_BG, for safety concerns, all block group
8484
descriptors copies are kept in the first block group. Given the default
8585
128MiB(2^27 bytes) block group size and 64-byte group descriptors, ext4
8686
can have at most 2^27/64 = 2^21 block groups. This limits the entire
8787
filesystem size to 2^21 * 2^27 = 2^48bytes or 256TiB.
8888

8989
The solution to this problem is to use the metablock group feature
90-
(META\_BG), which is already in ext3 for all 2.6 releases. With the
91-
META\_BG feature, ext4 filesystems are partitioned into many metablock
90+
(META_BG), which is already in ext3 for all 2.6 releases. With the
91+
META_BG feature, ext4 filesystems are partitioned into many metablock
9292
groups. Each metablock group is a cluster of block groups whose group
9393
descriptor structures can be stored in a single disk block. For ext4
9494
filesystems with 4 KB block size, a single metablock group partition
@@ -110,7 +110,7 @@ bytes, a meta-block group contains 32 block groups for filesystems with
110110
a 1KB block size, and 128 block groups for filesystems with a 4KB
111111
blocksize. Filesystems can either be created using this new block group
112112
descriptor layout, or existing filesystems can be resized on-line, and
113-
the field s\_first\_meta\_bg in the superblock will indicate the first
113+
the field s_first_meta_bg in the superblock will indicate the first
114114
block group using this new layout.
115115

116116
Please see an important note about ``BLOCK_UNINIT`` in the section about
@@ -121,15 +121,15 @@ Lazy Block Group Initialization
121121

122122
A new feature for ext4 are three block group descriptor flags that
123123
enable mkfs to skip initializing other parts of the block group
124-
metadata. Specifically, the INODE\_UNINIT and BLOCK\_UNINIT flags mean
124+
metadata. Specifically, the INODE_UNINIT and BLOCK_UNINIT flags mean
125125
that the inode and block bitmaps for that group can be calculated and
126126
therefore the on-disk bitmap blocks are not initialized. This is
127127
generally the case for an empty block group or a block group containing
128-
only fixed-location block group metadata. The INODE\_ZEROED flag means
128+
only fixed-location block group metadata. The INODE_ZEROED flag means
129129
that the inode table has been initialized; mkfs will unset this flag and
130130
rely on the kernel to initialize the inode tables in the background.
131131

132132
By not writing zeroes to the bitmaps and inode table, mkfs time is
133-
reduced considerably. Note the feature flag is RO\_COMPAT\_GDT\_CSUM,
134-
but the dumpe2fs output prints this as “uninit\_bg”. They are the same
133+
reduced considerably. Note the feature flag is RO_COMPAT_GDT_CSUM,
134+
but the dumpe2fs output prints this as “uninit_bg”. They are the same
135135
thing.

Documentation/filesystems/ext4/blockmap.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. SPDX-License-Identifier: GPL-2.0
22
33
+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4-
| i.i\_block Offset | Where It Points |
4+
| i.i_block Offset | Where It Points |
55
+=====================+==============================================================================================================================================================================================================================+
66
| 0 to 11 | Direct map to file blocks 0 to 11. |
77
+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Documentation/filesystems/ext4/checksums.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Checksums
44
---------
55

66
Starting in early 2012, metadata checksums were added to all major ext4
7-
and jbd2 data structures. The associated feature flag is metadata\_csum.
7+
and jbd2 data structures. The associated feature flag is metadata_csum.
88
The desired checksum algorithm is indicated in the superblock, though as
99
of October 2012 the only supported algorithm is crc32c. Some data
1010
structures did not have space to fit a full 32-bit checksum, so only the
@@ -20,7 +20,7 @@ encounters directory blocks that lack sufficient empty space to add a
2020
checksum, it will request that you run ``e2fsck -D`` to have the
2121
directories rebuilt with checksums. This has the added benefit of
2222
removing slack space from the directory files and rebalancing the htree
23-
indexes. If you \_ignore\_ this step, your directories will not be
23+
indexes. If you _ignore_ this step, your directories will not be
2424
protected by a checksum!
2525

2626
The following table describes the data elements that go into each type
@@ -35,39 +35,39 @@ of checksum. The checksum function is whatever the superblock describes
3535
- Length
3636
- Ingredients
3737
* - Superblock
38-
- \_\_le32
38+
- __le32
3939
- The entire superblock up to the checksum field. The UUID lives inside
4040
the superblock.
4141
* - MMP
42-
- \_\_le32
42+
- __le32
4343
- UUID + the entire MMP block up to the checksum field.
4444
* - Extended Attributes
45-
- \_\_le32
45+
- __le32
4646
- UUID + the entire extended attribute block. The checksum field is set to
4747
zero.
4848
* - Directory Entries
49-
- \_\_le32
49+
- __le32
5050
- UUID + inode number + inode generation + the directory block up to the
5151
fake entry enclosing the checksum field.
5252
* - HTREE Nodes
53-
- \_\_le32
53+
- __le32
5454
- UUID + inode number + inode generation + all valid extents + HTREE tail.
5555
The checksum field is set to zero.
5656
* - Extents
57-
- \_\_le32
57+
- __le32
5858
- UUID + inode number + inode generation + the entire extent block up to
5959
the checksum field.
6060
* - Bitmaps
61-
- \_\_le32 or \_\_le16
61+
- __le32 or __le16
6262
- UUID + the entire bitmap. Checksums are stored in the group descriptor,
6363
and truncated if the group descriptor size is 32 bytes (i.e. ^64bit)
6464
* - Inodes
65-
- \_\_le32
65+
- __le32
6666
- UUID + inode number + inode generation + the entire inode. The checksum
6767
field is set to zero. Each inode has its own checksum.
6868
* - Group Descriptors
69-
- \_\_le16
70-
- If metadata\_csum, then UUID + group number + the entire descriptor;
71-
else if gdt\_csum, then crc16(UUID + group number + the entire
69+
- __le16
70+
- If metadata_csum, then UUID + group number + the entire descriptor;
71+
else if gdt_csum, then crc16(UUID + group number + the entire
7272
descriptor). In all cases, only the lower 16 bits are stored.
7373

0 commit comments

Comments
 (0)