]> xenbits.xensource.com Git - people/aperard/linux.git/commitdiff
fscrypt: shrink the size of struct fscrypt_inode_info slightly
authorEric Biggers <ebiggers@google.com>
Sat, 24 Feb 2024 06:01:03 +0000 (22:01 -0800)
committerEric Biggers <ebiggers@google.com>
Sat, 24 Feb 2024 06:03:48 +0000 (22:03 -0800)
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: Eric Biggers <ebiggers@google.com>
fs/crypto/fscrypt_private.h

index 1892356cf924acb1a5d259b2a222a64ed9cb6767..8371e4e1f596a9639844c2ee4a43841df47421de 100644 (file)
@@ -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 {