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

Commit 3547983d authored by Shivaprasad Hongal's avatar Shivaprasad Hongal 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: Icf8bf3ae30395cf5428b2eae071d227e8ebe6e40
Signed-off-by: default avatarMichael Halcrow <mhalcrow@google.com>
[shongal@codeaurora.org: resolve trivial merge conflicts]
Git-repo: https://android.googlesource.com/kernel/common/


Signed-off-by: default avatarShivaprasad Hongal <shongal@codeaurora.org>
parent da2b1bb1
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -457,6 +457,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);
@@ -503,6 +504,7 @@ int f2fs_submit_page_write(struct f2fs_io_info *fio)
	dun = PG_DUN(inode, fio->page);
	bi_crypt_skip = fio->encrypted_page ? 1 : 0;
	bio_encrypted = f2fs_may_encrypt_bio(inode, fio);
	fio->op_flags |= fio->encrypted_page ? REQ_NOENCRYPT : 0;

	/* set submitted = true as a return value */
	fio->submitted = true;
@@ -568,7 +570,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, 0);
	bio_set_op_attrs(bio, REQ_OP_READ,
			 (f2fs_encrypted_inode(inode) ?
			  REQ_NOENCRYPT :
			  0));

	if (f2fs_encrypted_file(inode))
		post_read_steps |= 1 << STEP_DECRYPT;