Re: [PATCH v6 8/8] null_blk: Support configuring the maximum segment size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux