Skip to content

Commit 8c62f31

Browse files
committed
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/[email protected] Signed-off-by: Eric Biggers <[email protected]>
1 parent 2f944c6 commit 8c62f31

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

fs/crypto/fscrypt_private.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,19 @@ struct fscrypt_inode_info {
222222
struct fscrypt_prepared_key ci_enc_key;
223223

224224
/* True if ci_enc_key should be freed when this struct is freed */
225-
bool ci_owns_key;
225+
u8 ci_owns_key : 1;
226226

227227
#ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT
228228
/*
229229
* True if this inode will use inline encryption (blk-crypto) instead of
230230
* the traditional filesystem-layer encryption.
231231
*/
232-
bool ci_inlinecrypt;
232+
u8 ci_inlinecrypt : 1;
233233
#endif
234234

235+
/* True if ci_dirhash_key is initialized */
236+
u8 ci_dirhash_key_initialized : 1;
237+
235238
/*
236239
* log2 of the data unit size (granularity of contents encryption) of
237240
* this file. This is computable from ci_policy and ci_inode but is
@@ -242,6 +245,9 @@ struct fscrypt_inode_info {
242245
/* Cached value: log2 of number of data units per FS block */
243246
u8 ci_data_units_per_block_bits;
244247

248+
/* Hashed inode number. Only set for IV_INO_LBLK_32 */
249+
u32 ci_hashed_ino;
250+
245251
/*
246252
* Encryption mode used for this inode. It corresponds to either the
247253
* contents or filenames encryption mode, depending on the inode type.
@@ -276,16 +282,12 @@ struct fscrypt_inode_info {
276282
* the plaintext filenames -- currently just casefolded directories.
277283
*/
278284
siphash_key_t ci_dirhash_key;
279-
bool ci_dirhash_key_initialized;
280285

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

284289
/* This inode's nonce, copied from the fscrypt_context */
285290
u8 ci_nonce[FSCRYPT_FILE_NONCE_SIZE];
286-
287-
/* Hashed inode number. Only set for IV_INO_LBLK_32 */
288-
u32 ci_hashed_ino;
289291
};
290292

291293
typedef enum {

0 commit comments

Comments
 (0)