Re: [PATCH] block: respect virtual boundary mask in bvecs

From: Bart Van Assche
Date: Tue Nov 06 2018 - 09:53:23 EST


On 11/5/18 2:23 AM, Johannes Thumshirn wrote:
@@ -169,7 +169,7 @@ static inline bool biovec_phys_mergeable(struct request_queue *q,
static inline bool __bvec_gap_to_prev(struct request_queue *q,
struct bio_vec *bprv, unsigned int offset)
{
- return offset ||
+ return (offset & queue_virt_boundary(q)) ||
((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q));
}

How about changing that expression into the following to make it easier for the compiler to optimize this code?

(offset | (bprv->bv_offset + bprv->bv_len)) & queue_virt_boundary(q)

Thanks,

Bart.