]> git.karo-electronics.de Git - linux-beck.git/commit
f2fs crypto: use per-inode tfm structure
authorJaegeuk Kim <jaegeuk@kernel.org>
Wed, 20 May 2015 05:26:54 +0000 (22:26 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 1 Jun 2015 23:21:04 +0000 (16:21 -0700)
commit26bf3dc7e25b813ff5c92234f8165941fdc12a63
tree1486f8923c5f9c05fc6684d2c4b425f65b1ca459
parentda554e48caab95a48afe0d7be8d9eae2bbdaa28d
f2fs crypto: use per-inode tfm structure

This patch applies the following ext4 patch:

  ext4 crypto: use per-inode tfm structure

As suggested by Herbert Xu, we shouldn't allocate a new tfm each time
we read or write a page.  Instead we can use a single tfm hanging off
the inode's crypt_info structure for all of our encryption needs for
that inode, since the tfm can be used by multiple crypto requests in
parallel.

Also use cmpxchg() to avoid races that could result in crypt_info
structure getting doubly allocated or doubly freed.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/crypto.c
fs/f2fs/crypto_fname.c
fs/f2fs/crypto_key.c
fs/f2fs/dir.c
fs/f2fs/f2fs.h
fs/f2fs/f2fs_crypto.h
fs/f2fs/inode.c
fs/f2fs/namei.c
fs/f2fs/super.c