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

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

Merge "f2fs/fscrypt-ice: disallow bio merged into request"

parents 28b00bc0 84680317
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1529,6 +1529,7 @@ bool bio_attempt_front_merge(struct request_queue *q, struct request *req,
	bio->bi_next = req->bio;
	req->bio = bio;

	WARN_ON(req->__dun || bio->bi_iter.bi_dun);
	req->__sector = bio->bi_iter.bi_sector;
	req->__data_len += bio->bi_iter.bi_size;
	req->ioprio = ioprio_best(req->ioprio, bio_prio(bio));
@@ -1644,6 +1645,7 @@ void init_request_from_bio(struct request *req, struct bio *bio)

	req->errors = 0;
	req->__sector = bio->bi_iter.bi_sector;
	req->__dun = bio->bi_iter.bi_dun;
	req->ioprio = bio_prio(bio);
	blk_rq_bio_prep(req->q, req, bio);
}
@@ -2646,8 +2648,11 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
	req->__data_len -= total_bytes;

	/* update sector only for requests with clear definition of sector */
	if (req->cmd_type == REQ_TYPE_FS)
	if (req->cmd_type == REQ_TYPE_FS) {
		req->__sector += total_bytes >> 9;
		if (req->__dun)
			req->__dun += total_bytes >> 12;
	}

	/* mixed attributes always follow the first bio */
	if (req->cmd_flags & REQ_MIXED_MERGE) {
@@ -3048,6 +3053,7 @@ 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);
	dst->__dun = blk_rq_dun(src);
	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,6 +876,8 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)

int blk_try_merge(struct request *rq, struct bio *bio)
{
	if (blk_rq_dun(rq) || bio_dun(bio))
		return ELEVATOR_NO_MERGE;
	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 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ struct request {
	/* the following two fields are internal, NEVER access directly */
	unsigned int __data_len;	/* total data len */
	sector_t __sector;		/* sector cursor */
	u64 __dun;			/* dun for UFS */

	struct bio *bio;
	struct bio *biotail;
@@ -866,6 +867,11 @@ static inline sector_t blk_rq_pos(const struct request *rq)
	return rq->__sector;
}

static inline sector_t blk_rq_dun(const struct request *rq)
{
	return rq->__dun;
}

static inline unsigned int blk_rq_bytes(const struct request *rq)
{
	return rq->__data_len;