From 8bacf6deb02367008cc25244d9c3d23b0f797048 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Tue, 12 May 2015 13:26:54 -0700 Subject: f2fs crypto: use slab caches This patch integrates the below patch into f2fs. "ext4 crypto: use slab caches Use slab caches the ext4_crypto_ctx and ext4_crypt_info structures for slighly better memory efficiency and debuggability." Signed-off-by: Theodore Ts'o Signed-off-by: Jaegeuk Kim --- fs/f2fs/crypto_key.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fs/f2fs/crypto_key.c') diff --git a/fs/f2fs/crypto_key.c b/fs/f2fs/crypto_key.c index c7d414dd3a4a..6b9312b281b7 100644 --- a/fs/f2fs/crypto_key.c +++ b/fs/f2fs/crypto_key.c @@ -99,7 +99,7 @@ void f2fs_free_encryption_info(struct inode *inode) key_put(ci->ci_keyring_key); crypto_free_ablkcipher(ci->ci_ctfm); memzero_explicit(&ci->ci_raw, sizeof(ci->ci_raw)); - kfree(ci); + kmem_cache_free(f2fs_crypt_info_cachep, ci); fi->i_crypt_info = NULL; } @@ -137,7 +137,7 @@ int _f2fs_get_encryption_info(struct inode *inode) return -EINVAL; res = 0; - crypt_info = kmalloc(sizeof(struct f2fs_crypt_info), GFP_NOFS); + crypt_info = kmem_cache_alloc(f2fs_crypt_info_cachep, GFP_NOFS); if (!crypt_info) return -ENOMEM; @@ -187,7 +187,7 @@ out: if (res < 0) { if (res == -ENOKEY) res = 0; - kfree(crypt_info); + kmem_cache_free(f2fs_crypt_info_cachep, crypt_info); } else { fi->i_crypt_info = crypt_info; crypt_info->ci_keyring_key = keyring_key; -- cgit v1.2.3