ANDROID: f2fs: fix missing blk-crypto changes

I missed to fix blk-crypto changes that should be applied in compression flow.

Fixes: c7b7e54aee ("Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-4.19.y' into android-4.19")
Change-Id: Icdf8e0561c6f377fa23ab38cc8c57c2365b297d3
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
This commit is contained in:
Jaegeuk Kim
2020-02-10 13:49:04 -08:00
committed by Alistair Delva
parent 236c394629
commit 41e79eceb0
2 changed files with 6 additions and 4 deletions

View File

@@ -831,7 +831,8 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
err = f2fs_encrypt_one_page(&fio);
if (err)
goto out_destroy_crypt;
cc->cpages[i] = fio.encrypted_page;
if (fscrypt_inode_uses_fs_layer_crypto(inode))
cc->cpages[i] = fio.encrypted_page;
}
}
@@ -871,7 +872,7 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
f2fs_bug_on(fio.sbi, blkaddr == NULL_ADDR);
if (fio.encrypted)
if (fio.encrypted && fscrypt_inode_uses_fs_layer_crypto(inode))
fio.encrypted_page = cc->cpages[i - 1];
else
fio.compressed_page = cc->cpages[i - 1];

View File

@@ -2186,8 +2186,9 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
blkaddr = datablock_addr(dn.inode, dn.node_page,
dn.ofs_in_node + i + 1);
if (bio && !page_is_mergeable(sbi, bio,
*last_block_in_bio, blkaddr)) {
if (bio && (!page_is_mergeable(sbi, bio,
*last_block_in_bio, blkaddr) ||
!f2fs_crypt_mergeable_bio(bio, inode, page->index, NULL))) {
submit_and_realloc:
__submit_bio(sbi, bio, DATA);
bio = NULL;