Reserve superblock fields s_lpf_ino and s_encryption_level

The s_lpf_ino field is intended to store the location of the lost and
found directory if the root directory becomes encrypted (which is not
yet supported).  The s_encryption_level field is designed to allow
support for future changes in the on-disk ext4 encryption format while
this feature under development, without having to burn a large number
of bits in the incompat feature flag.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debian
Theodore Ts'o 2015-04-12 08:51:53 -04:00
parent 4a05268cf8
commit fc898cb99b
3 changed files with 10 additions and 4 deletions

View File

@ -154,6 +154,7 @@ static struct field_set_info super_fields[] = {
FLAG_ARRAY, 2 },
{ "checksum", &set_sb.s_checksum, NULL, 4, parse_uint },
{ "checksum_type", &set_sb.s_checksum_type, NULL, 1, parse_uint },
{ "encryption_level", &set_sb.s_encryption_level, NULL, 1, parse_uint },
{ "error_count", &set_sb.s_error_count, NULL, 4, parse_uint },
{ "first_error_time", &set_sb.s_first_error_time, NULL, 4, parse_time },
{ "first_error_ino", &set_sb.s_first_error_ino, NULL, 4, parse_uint },
@ -168,6 +169,7 @@ static struct field_set_info super_fields[] = {
{ "encrypt_algos", &set_sb.s_encrypt_algos, NULL, 1, parse_uint,
FLAG_ARRAY, 4 },
{ "encrypt_pw_salt", &set_sb.s_encrypt_pw_salt, NULL, 16, parse_uuid },
{ "lpf_ino", &set_sb.s_lpf_ino, NULL, 4, parse_uint },
{ 0, 0, 0, 0 }
};

View File

@ -688,7 +688,8 @@ struct ext2_super_block {
__u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
__u8 s_log_groups_per_flex; /* FLEX_BG group size */
__u8 s_checksum_type; /* metadata checksum algorithm */
__u16 s_reserved_pad; /* Padding to next 32bits */
__u8 s_encryption_level; /* versioning level for encryption */
__u8 s_reserved_pad; /* Padding to next 32bits */
__u64 s_kbytes_written; /* nr of lifetime kilobytes written */
__u32 s_snapshot_inum; /* Inode number of active snapshot */
__u32 s_snapshot_id; /* sequential ID of active snapshot */
@ -715,7 +716,8 @@ struct ext2_super_block {
__u32 s_backup_bgs[2]; /* If sparse_super2 enabled */
__u8 s_encrypt_algos[4]; /* Encryption algorithms in use */
__u8 s_encrypt_pw_salt[16]; /* Salt used for string2key algorithm */
__u32 s_reserved[101]; /* Padding to the end of the block */
__le32 s_lpf_ino; /* Location of the lost+found inode */
__le32 s_reserved[100]; /* Padding to the end of the block */
__u32 s_checksum; /* crc32c(superblock) */
};

View File

@ -114,7 +114,8 @@ int main(int argc, char **argv)
check_field(s_raid_stripe_width, 4);
check_field(s_log_groups_per_flex, 1);
check_field(s_checksum_type, 1);
check_field(s_reserved_pad, 2);
check_field(s_encryption_level, 1);
check_field(s_reserved_pad, 1);
check_field(s_kbytes_written, 8);
check_field(s_snapshot_inum, 4);
check_field(s_snapshot_id, 4);
@ -138,7 +139,8 @@ int main(int argc, char **argv)
check_field(s_backup_bgs, 8);
check_field(s_encrypt_algos, 4);
check_field(s_encrypt_pw_salt, 16);
check_field(s_reserved, 101 * 4);
check_field(s_lpf_ino, 4);
check_field(s_reserved, 100 * 4);
check_field(s_checksum, 4);
do_field("Superblock end", 0, 0, cur_offset, 1024);
#endif