Commit 8c62f31e authored by Eric Biggers's avatar Eric Biggers
Browse files

fscrypt: shrink the size of struct fscrypt_inode_info slightly

Shrink the size of struct fscrypt_inode_info by 8 bytes by packing the
small fields into the 64 bits after ci_enc_key.

Link: https://lore.kernel.org/r/20240224060103.91037-1-ebiggers@kernel.org


Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
parent 2f944c66
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -222,16 +222,19 @@ struct fscrypt_inode_info {
	struct fscrypt_prepared_key ci_enc_key;

	/* True if ci_enc_key should be freed when this struct is freed */
	bool ci_owns_key;
	u8 ci_owns_key : 1;

#ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT
	/*
	 * True if this inode will use inline encryption (blk-crypto) instead of
	 * the traditional filesystem-layer encryption.
	 */
	bool ci_inlinecrypt;
	u8 ci_inlinecrypt : 1;
#endif

	/* True if ci_dirhash_key is initialized */
	u8 ci_dirhash_key_initialized : 1;

	/*
	 * log2 of the data unit size (granularity of contents encryption) of
	 * this file.  This is computable from ci_policy and ci_inode but is
@@ -242,6 +245,9 @@ struct fscrypt_inode_info {
	/* Cached value: log2 of number of data units per FS block */
	u8 ci_data_units_per_block_bits;

	/* Hashed inode number.  Only set for IV_INO_LBLK_32 */
	u32 ci_hashed_ino;

	/*
	 * Encryption mode used for this inode.  It corresponds to either the
	 * contents or filenames encryption mode, depending on the inode type.
@@ -276,16 +282,12 @@ struct fscrypt_inode_info {
	 * the plaintext filenames -- currently just casefolded directories.
	 */
	siphash_key_t ci_dirhash_key;
	bool ci_dirhash_key_initialized;

	/* The encryption policy used by this inode */
	union fscrypt_policy ci_policy;

	/* This inode's nonce, copied from the fscrypt_context */
	u8 ci_nonce[FSCRYPT_FILE_NONCE_SIZE];

	/* Hashed inode number.  Only set for IV_INO_LBLK_32 */
	u32 ci_hashed_ino;
};

typedef enum {