mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
Merge "fscrypt: pfk: ice: cover ICE-related data structures in CONFIG_PFK"
This commit is contained in:
commit
b6072a3c8e
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -121,9 +121,9 @@ struct bio {
|
||||
struct bio_vec *bi_io_vec; /* the actual vec list */
|
||||
|
||||
struct bio_set *bi_pool;
|
||||
|
||||
#ifdef CONFIG_PFK
|
||||
struct inode *bi_dio_inode;
|
||||
|
||||
#endif
|
||||
/*
|
||||
* We can inline a number of vecs at the end of the bio, to avoid
|
||||
* double allocations for a small number of bio_vecs. This member
|
||||
|
@ -44,7 +44,9 @@ struct bvec_iter {
|
||||
|
||||
unsigned int bi_bvec_done; /* number of bytes completed in
|
||||
current bvec */
|
||||
#ifdef CONFIG_PFK
|
||||
u64 bi_dun; /* DUN setting for bio */
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -256,4 +256,30 @@ static inline int fscrypt_encrypt_symlink(struct inode *inode,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* fscrypt_ice.c */
|
||||
#ifdef CONFIG_PFK
|
||||
extern int fscrypt_using_hardware_encryption(const struct inode *inode);
|
||||
extern void fscrypt_set_ice_dun(const struct inode *inode,
|
||||
struct bio *bio, u64 dun);
|
||||
extern void fscrypt_set_ice_skip(struct bio *bio, int bi_crypt_skip);
|
||||
extern bool fscrypt_mergeable_bio(struct bio *bio, u64 dun, bool bio_encrypted,
|
||||
int bi_crypt_skip);
|
||||
#else
|
||||
static inline int fscrypt_using_hardware_encryption(const struct inode *inode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void fscrypt_set_ice_dun(const struct inode *inode,
|
||||
struct bio *bio, u64 dun){}
|
||||
|
||||
static inline void fscrypt_set_ice_skip(struct bio *bio, int bi_crypt_skip)
|
||||
{}
|
||||
|
||||
static inline bool fscrypt_mergeable_bio(struct bio *bio,
|
||||
u64 dun, bool bio_encrypted, int bi_crypt_skip)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif /* _LINUX_FSCRYPT_H */
|
||||
|
@ -184,26 +184,6 @@ static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
/* fscrypt_ice.c */
|
||||
static inline int fscrypt_using_hardware_encryption(const struct inode *inode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void fscrypt_set_ice_dun(const struct inode *inode,
|
||||
struct bio *bio, u64 dun){}
|
||||
|
||||
static inline void fscrypt_set_ice_skip(struct bio *bio, int bi_crypt_skip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline bool fscrypt_mergeable_bio(struct bio *bio,
|
||||
u64 dun, bool bio_encrypted, int bi_crypt_skip)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* hooks.c */
|
||||
|
||||
static inline int fscrypt_file_open(struct inode *inode, struct file *filp)
|
||||
|
@ -197,14 +197,6 @@ extern void fscrypt_pullback_bio_page(struct page **, bool);
|
||||
extern int fscrypt_zeroout_range(const struct inode *, pgoff_t, sector_t,
|
||||
unsigned int);
|
||||
|
||||
/* fscrypt_ice.c */
|
||||
extern int fscrypt_using_hardware_encryption(const struct inode *inode);
|
||||
extern void fscrypt_set_ice_dun(const struct inode *inode,
|
||||
struct bio *bio, u64 dun);
|
||||
extern void fscrypt_set_ice_skip(struct bio *bio, int bi_crypt_skip);
|
||||
extern bool fscrypt_mergeable_bio(struct bio *bio, u64 dun, bool bio_encrypted,
|
||||
int bi_crypt_skip);
|
||||
|
||||
/* hooks.c */
|
||||
extern int fscrypt_file_open(struct inode *inode, struct file *filp);
|
||||
extern int __fscrypt_prepare_link(struct inode *inode, struct inode *dir);
|
||||
|
Loading…
x
Reference in New Issue
Block a user