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

Commit 01129d26 authored by Barani Muthukumaran's avatar Barani Muthukumaran Committed by Gerrit - the friendly Code Review server
Browse files

[ANDROID] 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: I8cea62922dd41ac860d9bad787774aa32115d0b0
Signed-off-by: default avatarMichael Halcrow <mhalcrow@google.com>
Git-repo: https://android.googlesource.com/kernel/common


[bmuthuku@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: default avatarBarani Muthukumaran <bmuthuku@codeaurora.org>
parent ddb7415b
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -502,6 +502,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
		bio_put(bio);
		bio_put(bio);
		return -EFAULT;
		return -EFAULT;
	}
	}
	fio->op_flags |= fio->encrypted_page ? REQ_NOENCRYPT : 0;
	bio_set_op_attrs(bio, fio->op, fio->op_flags);
	bio_set_op_attrs(bio, fio->op, fio->op_flags);


	inc_page_count(fio->sbi, is_read_io(fio->op) ?
	inc_page_count(fio->sbi, is_read_io(fio->op) ?
@@ -547,6 +548,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
	dun = PG_DUN(inode, fio->page);
	dun = PG_DUN(inode, fio->page);
	bi_crypt_skip = fio->encrypted_page ? 1 : 0;
	bi_crypt_skip = fio->encrypted_page ? 1 : 0;
	bio_encrypted = f2fs_may_encrypt_bio(inode, fio);
	bio_encrypted = f2fs_may_encrypt_bio(inode, fio);
	fio->op_flags |= fio->encrypted_page ? REQ_NOENCRYPT : 0;


	/* set submitted = true as a return value */
	/* set submitted = true as a return value */
	fio->submitted = true;
	fio->submitted = true;
@@ -617,7 +619,10 @@ static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr,
		return ERR_PTR(-ENOMEM);
		return ERR_PTR(-ENOMEM);
	f2fs_target_device(sbi, blkaddr, bio);
	f2fs_target_device(sbi, blkaddr, bio);
	bio->bi_end_io = f2fs_read_end_io;
	bio->bi_end_io = f2fs_read_end_io;
	bio_set_op_attrs(bio, REQ_OP_READ, 0);
	bio_set_op_attrs(bio, REQ_OP_READ,
			 (f2fs_encrypted_inode(inode) ?
			  REQ_NOENCRYPT :
			  0));


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