blk-merge.c (fd2ef39cc9a6b9c4c41864ac506906c52f94b06a) blk-merge.c (2705dfb2094777e405e065105e307074af8965c1)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Functions related to segment and merge handling
4 */
5#include <linux/kernel.h>
6#include <linux/module.h>
7#include <linux/bio.h>
8#include <linux/blkdev.h>

--- 545 unchanged lines hidden (view full) ---

554 if (req_op(rq) == REQ_OP_DISCARD)
555 return queue_max_discard_segments(rq->q);
556 return queue_max_segments(rq->q);
557}
558
559static inline int ll_new_hw_segment(struct request *req, struct bio *bio,
560 unsigned int nr_phys_segs)
561{
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Functions related to segment and merge handling
4 */
5#include <linux/kernel.h>
6#include <linux/module.h>
7#include <linux/bio.h>
8#include <linux/blkdev.h>

--- 545 unchanged lines hidden (view full) ---

554 if (req_op(rq) == REQ_OP_DISCARD)
555 return queue_max_discard_segments(rq->q);
556 return queue_max_segments(rq->q);
557}
558
559static inline int ll_new_hw_segment(struct request *req, struct bio *bio,
560 unsigned int nr_phys_segs)
561{
562 if (req->nr_phys_segments + nr_phys_segs > blk_rq_get_max_segments(req))
562 if (blk_integrity_merge_bio(req->q, req, bio) == false)
563 goto no_merge;
564
563 goto no_merge;
564
565 if (blk_integrity_merge_bio(req->q, req, bio) == false)
565 /* discard request merge won't add new segment */
566 if (req_op(req) == REQ_OP_DISCARD)
567 return 1;
568
569 if (req->nr_phys_segments + nr_phys_segs > blk_rq_get_max_segments(req))
566 goto no_merge;
567
568 /*
569 * This will form the start of a new hw segment. Bump both
570 * counters.
571 */
572 req->nr_phys_segments += nr_phys_segs;
573 return 1;

--- 573 unchanged lines hidden ---
570 goto no_merge;
571
572 /*
573 * This will form the start of a new hw segment. Bump both
574 * counters.
575 */
576 req->nr_phys_segments += nr_phys_segs;
577 return 1;

--- 573 unchanged lines hidden ---