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

Commit b6072a3c authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "fscrypt: pfk: ice: cover ICE-related data structures in CONFIG_PFK"

parents 6ad5260d 8dbee71a
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -617,7 +617,6 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
	bio->bi_write_hint = bio_src->bi_write_hint;
	bio->bi_iter = bio_src->bi_iter;
	bio->bi_io_vec = bio_src->bi_io_vec;
	bio->bi_dio_inode = bio_src->bi_dio_inode;
	bio_clone_crypt_key(bio, bio_src);
	bio_clone_blkcg_association(bio, bio_src);
}
+8 −0
Original line number Diff line number Diff line
@@ -1655,7 +1655,9 @@ bool bio_attempt_front_merge(struct request_queue *q, struct request *req,
	bio->bi_next = req->bio;
	req->bio = bio;

#ifdef CONFIG_PFK
	WARN_ON(req->__dun || bio->bi_iter.bi_dun);
#endif
	req->__sector = bio->bi_iter.bi_sector;
	req->__data_len += bio->bi_iter.bi_size;
	req->ioprio = ioprio_best(req->ioprio, bio_prio(bio));
@@ -1805,7 +1807,9 @@ void blk_init_request_from_bio(struct request *req, struct bio *bio)
	else
		req->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);
	req->write_hint = bio->bi_write_hint;
#ifdef CONFIG_PFK
	req->__dun = bio->bi_iter.bi_dun;
#endif
	blk_rq_bio_prep(req->q, req, bio);
}
EXPORT_SYMBOL_GPL(blk_init_request_from_bio);
@@ -2795,8 +2799,10 @@ bool blk_update_request(struct request *req, blk_status_t error,
	/* update sector only for requests with clear definition of sector */
	if (!blk_rq_is_passthrough(req)) {
		req->__sector += total_bytes >> 9;
#ifdef CONFIG_PFK
		if (req->__dun)
			req->__dun += total_bytes >> 12;
#endif
	}

	/* mixed attributes always follow the first bio */
@@ -3160,7 +3166,9 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src)
{
	dst->cpu = src->cpu;
	dst->__sector = blk_rq_pos(src);
#ifdef CONFIG_PFK
	dst->__dun = blk_rq_dun(src);
#endif
	dst->__data_len = blk_rq_bytes(src);
	if (src->rq_flags & RQF_SPECIAL_PAYLOAD) {
		dst->rq_flags |= RQF_SPECIAL_PAYLOAD;
+2 −0
Original line number Diff line number Diff line
@@ -845,8 +845,10 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)

enum elv_merge blk_try_merge(struct request *rq, struct bio *bio)
{
#ifdef CONFIG_PFK
	if (blk_rq_dun(rq) || bio_dun(bio))
		return ELEVATOR_NO_MERGE;
#endif
	if (req_op(rq) == REQ_OP_DISCARD &&
	    queue_max_discard_segments(rq->q) > 1)
		return ELEVATOR_DISCARD_MERGE;
+5 −1
Original line number Diff line number Diff line
@@ -940,6 +940,7 @@ static int ufs_qcom_crypto_req_setup(struct ufs_hba *hba,

	/* Use request LBA or given dun as the DUN value */
	if (req->bio) {
#ifdef CONFIG_PFK
		if (bio_dun(req->bio)) {
			/* dun @bio can be split, so we have to adjust offset */
			*dun = bio_dun(req->bio);
@@ -947,8 +948,11 @@ static int ufs_qcom_crypto_req_setup(struct ufs_hba *hba,
			*dun = req->bio->bi_iter.bi_sector;
			*dun >>= UFS_QCOM_ICE_TR_DATA_UNIT_4_KB;
		}
#else
		*dun = req->bio->bi_iter.bi_sector;
		*dun >>= UFS_QCOM_ICE_TR_DATA_UNIT_4_KB;
#endif
	}

	ret = ufs_qcom_ice_req_setup(host, lrbp->cmd, cc_index, enable);

	return ret;
+6 −2
Original line number Diff line number Diff line
@@ -432,6 +432,7 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio,
	sdio->logical_offset_in_bio = sdio->cur_page_fs_offset;
}

#ifdef CONFIG_PFK
static bool is_inode_filesystem_type(const struct inode *inode,
					const char *fs_type)
{
@@ -446,6 +447,7 @@ static bool is_inode_filesystem_type(const struct inode *inode,

	return (strcmp(inode->i_sb->s_type->name, fs_type) == 0);
}
#endif

/*
 * In the AIO read case we speculatively dirty the pages before starting IO.
@@ -469,6 +471,7 @@ static inline void dio_bio_submit(struct dio *dio, struct dio_submit *sdio)
		bio_set_pages_dirty(bio);

	dio->bio_disk = bio->bi_disk;
#ifdef CONFIG_PFK
	bio->bi_dio_inode = dio->inode;

/* iv sector for security/pfe/pfk_fscrypt.c and f2fs in fs/f2fs/f2fs.h */
@@ -478,7 +481,7 @@ static inline void dio_bio_submit(struct dio *dio, struct dio_submit *sdio)
	if (is_inode_filesystem_type(dio->inode, "f2fs"))
		fscrypt_set_ice_dun(dio->inode, bio, PG_DUN_NEW(dio->inode,
			(sdio->logical_offset_in_bio >> PAGE_SHIFT)));

#endif
	if (sdio->submit_io) {
		sdio->submit_io(bio, dio->inode, sdio->logical_offset_in_bio);
		dio->bio_cookie = BLK_QC_T_NONE;
@@ -496,8 +499,9 @@ struct inode *dio_bio_get_inode(struct bio *bio)

	if (bio == NULL)
		return NULL;

#ifdef CONFIG_PFK
	inode = bio->bi_dio_inode;
#endif
	return inode;
}

Loading