Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93c96785 authored by Michael Halcrow's avatar Michael Halcrow Committed by Sahitya Tummala
Browse files

f2fs: Set the bio REQ_NOENCRYPT flag



When lower layers such as dm-crypt observe the REQ_NOENCRYPT flag, it
helps the I/O stack avoid redundant encryption, improving performance
and power utilization.

Note that lower layers must be consistent in their observation of this
flag in order to avoid the possibility of data corruption.

Change-Id: Icf8bf3ae30395cf5428b2eae071d227e8ebe6e40
Signed-off-by: default avatarMichael Halcrow <mhalcrow@google.com>
Git-repo: Git-repo: https://android.googlesource.com/kernel/common/


Git-commit: 56568872b546659642fe99eb4388587528e8f3cc
[stummala@codeaurora.org: resolved merge conflicts]
Signed-off-by: default avatarSahitya Tummala <stummala@codeaurora.org>
parent 285e264b
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -460,6 +460,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
		bio_put(bio);
		return -EFAULT;
	}
	fio->op_flags |= fio->encrypted_page ? REQ_NOENCRYPT : 0;
	bio_set_op_attrs(bio, fio->op, fio->op_flags);

	__submit_bio(fio->sbi, bio, fio->type);
@@ -501,6 +502,8 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
	verify_block_addr(fio, fio->new_blkaddr);

	bio_page = fio->encrypted_page ? fio->encrypted_page : fio->page;
	fio->op_flags |= fio->encrypted_page ? REQ_NOENCRYPT : 0;

	inode = fio->page->mapping->host;
	dun = PG_DUN(inode, fio->page);
	bi_crypt_skip = fio->encrypted_page ? 1 : 0;
@@ -572,7 +575,10 @@ static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr,
		return ERR_PTR(-ENOMEM);
	f2fs_target_device(sbi, blkaddr, bio);
	bio->bi_end_io = f2fs_read_end_io;
	bio_set_op_attrs(bio, REQ_OP_READ, op_flag);
	bio_set_op_attrs(bio, REQ_OP_READ,
			 (f2fs_encrypted_inode(inode) ?
			  REQ_NOENCRYPT :
			  op_flag));

        if (f2fs_encrypted_file(inode) &&
            !fscrypt_using_hardware_encryption(inode))