OSDN Git Service

fscrypt: simplify bounce page handling
authorEric Biggers <ebiggers@google.com>
Mon, 20 May 2019 16:29:39 +0000 (09:29 -0700)
committerEric Biggers <ebiggers@google.com>
Tue, 28 May 2019 17:27:52 +0000 (10:27 -0700)
commitd2d0727b1654e11563f181f4d3d48b9275514480
treefca4761fc4cf02a31f43aac5ae86e5276bbc298b
parentcd6c84d8f0cdc911df435bb075ba22ce3c605b07
fscrypt: simplify bounce page handling

Currently, bounce page handling for writes to encrypted files is
unnecessarily complicated.  A fscrypt_ctx is allocated along with each
bounce page, page_private(bounce_page) points to this fscrypt_ctx, and
fscrypt_ctx::w::control_page points to the original pagecache page.

However, because writes don't use the fscrypt_ctx for anything else,
there's no reason why page_private(bounce_page) can't just point to the
original pagecache page directly.

Therefore, this patch makes this change.  In the process, it also cleans
up the API exposed to filesystems that allows testing whether a page is
a bounce page, getting the pagecache page from a bounce page, and
freeing a bounce page.

Reviewed-by: Chandan Rajendra <chandan@linux.ibm.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
fs/crypto/bio.c
fs/crypto/crypto.c
fs/crypto/fscrypt_private.h
fs/ext4/page-io.c
fs/f2fs/data.c
include/linux/fscrypt.h