On 6/12/23 15:17, Damien Le Moal wrote:
On 6/13/23 05:33, Bart Van Assche wrote:
@@ -1283,7 +1293,8 @@ static int null_handle_rq(struct nullb_cmd *cmd)
spin_lock_irq(&nullb->lock);
rq_for_each_segment(bvec, rq, iter) {
- len = bvec.bv_len;
+ len = min(bvec.bv_len, nullb->dev->max_segment_size);
+ bvec.bv_len = len;
I am still confused by this change... Why is it necessary ? If max_segment_size
is set correctly, how can we ever get a BIO with a bvec length exceeding that
maximum ? If that is the case, aren't we missing a bio_split() somewhere ?
Hi Damien,
bio_split() enforces the max_sectors limit but not the max_segment_size
limit. __blk_rq_map_sg() enforces the max_segment_size limit. null_blk
does not call __blk_rq_map_sg(). Hence the above code to enforce the
max_segment_size limit.
Thanks,
Bart.