Read/write/flush are the most common operations, optimise switch in blk_may_split() for these cases. All three added conditions are compiled into a single comparison as the corresponding REQ_OP_* take 0-2. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- block/blk.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/block/blk.h b/block/blk.h index 6a039e6c7d07..0bf00e96e1f0 100644 --- a/block/blk.h +++ b/block/blk.h @@ -269,14 +269,18 @@ ssize_t part_timeout_store(struct device *, struct device_attribute *, static inline bool blk_may_split(struct request_queue *q, struct bio *bio) { - switch (bio_op(bio)) { - case REQ_OP_DISCARD: - case REQ_OP_SECURE_ERASE: - case REQ_OP_WRITE_ZEROES: - case REQ_OP_WRITE_SAME: - return true; /* non-trivial splitting decisions */ - default: - break; + unsigned int op = bio_op(bio); + + if (op != REQ_OP_READ && op != REQ_OP_WRITE && op != REQ_OP_FLUSH) { + switch (op) { + case REQ_OP_DISCARD: + case REQ_OP_SECURE_ERASE: + case REQ_OP_WRITE_ZEROES: + case REQ_OP_WRITE_SAME: + return true; /* non-trivial splitting decisions */ + default: + break; + } } /* -- 2.33.1