[PATCHv3] blk: Replace SG_GAPGS with new queue limits mask

Christoph Hellwig hch at infradead.org
Tue Aug 4 04:28:17 PDT 2015


> -		if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS) &&
> -		    bvec_gap_to_prev(prev, offset))
> +		if (queue_virt_boundary(q) && bvec_gap_to_prev(prev, offset,
> +							queue_virt_boundary(q)))

Nipick:  This would look nicer as:

		if (queue_virt_boundary(q) &&
		     bvec_gap_to_prev(prev, offset, queue_virt_boundary(q)))

But why don't we hide all this beind a better implementation of
bvec_gap_to_prev:

> +static inline bool bvec_gap_to_prev(struct bio_vec *bprv, unsigned int offset, unsigned long mask)
>  {
> -	return offset || ((bprv->bv_offset + bprv->bv_len) & (PAGE_SIZE - 1));
> +	return offset || ((bprv->bv_offset + bprv->bv_len) & mask);
>  }

static inline bool bvec_gap_to_prev(struct request_queue *q,
		struct bio_vec *bprv, unsigned int offset)
{
	if (!queue_virt_boundary(q))
		return false;
	return offset ||
		((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q);
}



More information about the Linux-nvme mailing list