summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/f2fs_crypto.h
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-05-12 13:40:20 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2015-06-01 16:20:57 -0700
commitca40b0305209248e5fd05f6ba8a3874656ff0117 (patch)
tree65e86f731b5da91f6572f3fda670359661165951 /fs/f2fs/f2fs_crypto.h
parent640778fbc97b36757bd1f857ba4b599a200517c2 (diff)
downloadlinux-ca40b0305209248e5fd05f6ba8a3874656ff0117.tar.gz
linux-ca40b0305209248e5fd05f6ba8a3874656ff0117.tar.bz2
linux-ca40b0305209248e5fd05f6ba8a3874656ff0117.zip
f2fs crypto: shrink size of the f2fs_crypto_ctx structure
This patch integrates the below patch into f2fs. "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> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/f2fs_crypto.h')
-rw-r--r--fs/f2fs/f2fs_crypto.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/f2fs/f2fs_crypto.h b/fs/f2fs/f2fs_crypto.h
index 58682d2830e9..e33cec9c3f36 100644
--- a/fs/f2fs/f2fs_crypto.h
+++ b/fs/f2fs/f2fs_crypto.h
@@ -87,16 +87,23 @@ struct f2fs_crypt_info {
#define F2FS_CTX_REQUIRES_FREE_ENCRYPT_FL 0x00000001
#define F2FS_BOUNCE_PAGE_REQUIRES_FREE_ENCRYPT_FL 0x00000002
+#define F2FS_WRITE_PATH_FL 0x00000004
struct f2fs_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 f2fs_completion_result {