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

Commit bf760df2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

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

parents 9e8db9a4 9b550ec6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -570,8 +570,8 @@ static inline void bio_clone_crypt_key(struct bio *dst, const struct bio *src)
#ifdef CONFIG_PFK
	dst->bi_crypt_key = src->bi_crypt_key;
	dst->bi_iter.bi_dun = src->bi_iter.bi_dun;
#endif
	dst->bi_dio_inode = src->bi_dio_inode;
#endif
}

/**
@@ -598,7 +598,9 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
	bio->bi_opf = bio_src->bi_opf;
	bio->bi_iter = bio_src->bi_iter;
	bio->bi_io_vec = bio_src->bi_io_vec;
#ifdef CONFIG_PFK
	bio->bi_dio_inode = bio_src->bi_dio_inode;
#endif
	bio_clone_crypt_key(bio, bio_src);
	bio_clone_blkcg_association(bio, bio_src);
}
+8 −0
Original line number Diff line number Diff line
@@ -1529,7 +1529,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));
@@ -1645,7 +1647,9 @@ void init_request_from_bio(struct request *req, struct bio *bio)

	req->errors = 0;
	req->__sector = bio->bi_iter.bi_sector;
#ifdef CONFIG_PFK
	req->__dun = bio->bi_iter.bi_dun;
#endif
	req->ioprio = bio_prio(bio);
	blk_rq_bio_prep(req->q, req, bio);
}
@@ -2650,8 +2654,10 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
	/* update sector only for requests with clear definition of sector */
	if (req->cmd_type == REQ_TYPE_FS) {
		req->__sector += total_bytes >> 9;
#ifdef CONFIG_PFK
		if (req->__dun)
			req->__dun += total_bytes >> 12;
#endif
	}

	/* mixed attributes always follow the first bio */
@@ -3053,7 +3059,9 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src)
			 (src->cmd_flags & REQ_CLONE_MASK) | REQ_NOMERGE);
	dst->cmd_type = src->cmd_type;
	dst->__sector = blk_rq_pos(src);
#ifdef CONFIG_PFK
	dst->__dun = blk_rq_dun(src);
#endif
	dst->__data_len = blk_rq_bytes(src);
	dst->nr_phys_segments = src->nr_phys_segments;
	dst->ioprio = src->ioprio;
+2 −0
Original line number Diff line number Diff line
@@ -876,8 +876,10 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)

int 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 (blk_rq_pos(rq) + blk_rq_sectors(rq) == bio->bi_iter.bi_sector)
		return ELEVATOR_BACK_MERGE;
	else if (blk_rq_pos(rq) - bio_sectors(bio) == bio->bi_iter.bi_sector)
+6 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2017, Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2018, Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -900,6 +900,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);
@@ -907,6 +908,10 @@ 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);
+6 −0
Original line number Diff line number Diff line
@@ -392,6 +392,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)
{
@@ -406,6 +407,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.
@@ -428,6 +430,7 @@ static inline void dio_bio_submit(struct dio *dio, struct dio_submit *sdio)
	if (dio->is_async && dio->op == REQ_OP_READ && dio->should_dirty)
		bio_set_pages_dirty(bio);

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

/* iv sector for security/pfe/pfk_fscrypt.c and f2fs in fs/f2fs/f2fs.h.*/
@@ -437,6 +440,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
	dio->bio_bdev = bio->bi_bdev;

	if (sdio->submit_io) {
@@ -457,7 +461,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