The patch titled eCryptfs: set inode key only once per crypto operation has been added to the -mm tree. Its filename is ecryptfs-set-inode-key-only-once-per-crypto-operation.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: eCryptfs: set inode key only once per crypto operation From: Trevor Highland <trevor.highland@xxxxxxxxx> There is no need to keep re-setting the same key for any given eCryptfs inode. This patch optimizes the use of the crypto API and helps performance a bit. Signed-off-by: Trevor Highland <trevor.highland@xxxxxxxxx> Signed-off-by: Michael Halcrow <mhalcrow@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/ecryptfs/crypto.c | 7 +++++-- fs/ecryptfs/ecryptfs_kernel.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff -puN fs/ecryptfs/crypto.c~ecryptfs-set-inode-key-only-once-per-crypto-operation fs/ecryptfs/crypto.c --- a/fs/ecryptfs/crypto.c~ecryptfs-set-inode-key-only-once-per-crypto-operation +++ a/fs/ecryptfs/crypto.c @@ -337,8 +337,11 @@ static int encrypt_scatterlist(struct ec } /* Consider doing this once, when the file is opened */ mutex_lock(&crypt_stat->cs_tfm_mutex); - rc = crypto_blkcipher_setkey(crypt_stat->tfm, crypt_stat->key, - crypt_stat->key_size); + if (!(crypt_stat->flags & ECRYPTFS_KEY_SET)) { + rc = crypto_blkcipher_setkey(crypt_stat->tfm, crypt_stat->key, + crypt_stat->key_size); + crypt_stat->flags |= ECRYPTFS_KEY_SET; + } if (rc) { ecryptfs_printk(KERN_ERR, "Error setting key; rc = [%d]\n", rc); diff -puN fs/ecryptfs/ecryptfs_kernel.h~ecryptfs-set-inode-key-only-once-per-crypto-operation fs/ecryptfs/ecryptfs_kernel.h --- a/fs/ecryptfs/ecryptfs_kernel.h~ecryptfs-set-inode-key-only-once-per-crypto-operation +++ a/fs/ecryptfs/ecryptfs_kernel.h @@ -234,6 +234,7 @@ struct ecryptfs_crypt_stat { #define ECRYPTFS_KEY_VALID 0x00000080 #define ECRYPTFS_METADATA_IN_XATTR 0x00000100 #define ECRYPTFS_VIEW_AS_ENCRYPTED 0x00000200 +#define ECRYPTFS_KEY_SET 0x00000400 u32 flags; unsigned int file_version; size_t iv_bytes; _ Patches currently in -mm which might be from trevor.highland@xxxxxxxxx are ecryptfs-set-inode-key-only-once-per-crypto-operation.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html