blk.h (2e9bc3465ac54d282b855b073409c2c3a7d1ae00) blk.h (badf7f64378796d460c79eb0f182fa7282eb65d5)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BLK_INTERNAL_H
3#define BLK_INTERNAL_H
4
5#include <linux/idr.h>
6#include <linux/blk-mq.h>
7#include <linux/part_stat.h>
8#include <linux/blk-crypto.h>

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

91static inline bool bvec_gap_to_prev(struct request_queue *q,
92 struct bio_vec *bprv, unsigned int offset)
93{
94 if (!queue_virt_boundary(q))
95 return false;
96 return __bvec_gap_to_prev(q, bprv, offset);
97}
98
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BLK_INTERNAL_H
3#define BLK_INTERNAL_H
4
5#include <linux/idr.h>
6#include <linux/blk-mq.h>
7#include <linux/part_stat.h>
8#include <linux/blk-crypto.h>

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

91static inline bool bvec_gap_to_prev(struct request_queue *q,
92 struct bio_vec *bprv, unsigned int offset)
93{
94 if (!queue_virt_boundary(q))
95 return false;
96 return __bvec_gap_to_prev(q, bprv, offset);
97}
98
99static inline bool rq_mergeable(struct request *rq)
100{
101 if (blk_rq_is_passthrough(rq))
102 return false;
103
104 if (req_op(rq) == REQ_OP_FLUSH)
105 return false;
106
107 if (req_op(rq) == REQ_OP_WRITE_ZEROES)
108 return false;
109
110 if (req_op(rq) == REQ_OP_ZONE_APPEND)
111 return false;
112
113 if (rq->cmd_flags & REQ_NOMERGE_FLAGS)
114 return false;
115 if (rq->rq_flags & RQF_NOMERGE_FLAGS)
116 return false;
117
118 return true;
119}
120
121/*
122 * There are two different ways to handle DISCARD merges:
123 * 1) If max_discard_segments > 1, the driver treats every bio as a range and
124 * send the bios to controller together. The ranges don't need to be
125 * contiguous.
126 * 2) Otherwise, the request will be normal read/write requests. The ranges
127 * need to be contiguous.
128 */
129static inline bool blk_discard_mergable(struct request *req)
130{
131 if (req_op(req) == REQ_OP_DISCARD &&
132 queue_max_discard_segments(req->q) > 1)
133 return true;
134 return false;
135}
136
99#ifdef CONFIG_BLK_DEV_INTEGRITY
100void blk_flush_integrity(void);
101bool __bio_integrity_endio(struct bio *);
102void bio_integrity_free(struct bio *bio);
103static inline bool bio_integrity_endio(struct bio *bio)
104{
105 if (bio_integrity(bio))
106 return __bio_integrity_endio(bio);

--- 276 unchanged lines hidden ---
137#ifdef CONFIG_BLK_DEV_INTEGRITY
138void blk_flush_integrity(void);
139bool __bio_integrity_endio(struct bio *);
140void bio_integrity_free(struct bio *bio);
141static inline bool bio_integrity_endio(struct bio *bio)
142{
143 if (bio_integrity(bio))
144 return __bio_integrity_endio(bio);

--- 276 unchanged lines hidden ---