diff options
author | Theodore Ts'o <tytso@mit.edu> | 2015-05-31 20:31:34 +0300 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2015-05-31 20:31:34 +0300 |
commit | 614def7013574ffcd54019b6df40ac1c0df754af (patch) | |
tree | 50549389b403fac7179bc6f93ecb178091ad4c31 /fs/ext4/ext4_crypto.h | |
parent | 1aaa6e8b24114757a836ae0e62d2096deb76f274 (diff) | |
download | linux-614def7013574ffcd54019b6df40ac1c0df754af.tar.xz |
ext4 crypto: shrink size of the ext4_crypto_ctx structure
Some fields are only used when the crypto_ctx is being used on the
read path, some are only used on the write path, and some are only
used when the structure is on free list. Optimize memory use by using
a union.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4_crypto.h')
-rw-r--r-- | fs/ext4/ext4_crypto.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/ext4/ext4_crypto.h b/fs/ext4/ext4_crypto.h index 69faf0e9f874..c5258f242215 100644 --- a/fs/ext4/ext4_crypto.h +++ b/fs/ext4/ext4_crypto.h @@ -86,16 +86,23 @@ struct ext4_crypt_info { #define EXT4_CTX_REQUIRES_FREE_ENCRYPT_FL 0x00000001 #define EXT4_BOUNCE_PAGE_REQUIRES_FREE_ENCRYPT_FL 0x00000002 +#define EXT4_WRITE_PATH_FL 0x00000004 struct ext4_crypto_ctx { struct crypto_tfm *tfm; /* Crypto API context */ - struct page *bounce_page; /* Ciphertext page on write path */ - struct page *control_page; /* Original page on write path */ - struct bio *bio; /* The bio for this context */ - struct work_struct work; /* Work queue for read complete path */ - struct list_head free_list; /* Free list */ - int flags; /* Flags */ - int mode; /* Encryption mode for tfm */ + union { + struct { + struct page *bounce_page; /* Ciphertext page */ + struct page *control_page; /* Original page */ + } w; + struct { + struct bio *bio; + struct work_struct work; + } r; + struct list_head free_list; /* Free list */ + }; + char flags; /* Flags */ + char mode; /* Encryption mode for tfm */ }; struct ext4_completion_result { |