Re: [PATCH v2 1/3] block: bio: kill BIO_SEG_VALID flag

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

 



On 3/22/19 7:13 AM, Johannes Thumshirn wrote:
> @@ -712,7 +714,10 @@ int bio_add_pc_page(struct request_queue *q, struct bio *bio, struct page
>  	bvec->bv_len = len;
>  	bvec->bv_offset = offset;
>  	bio->bi_vcnt++;
> -	bio->bi_phys_segments++;
> +	if (bio->bi_phys_segments == -1)
> +		bio->bi_phys_segments = 1;
> +	else
> +		bio->bi_phys_segments++;
>  	bio->bi_iter.bi_size += len;

Echo Christophs suggestion here.

> diff --git a/block/blk-core.c b/block/blk-core.c
> index 4673ebe42255..53372a16dd7c 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -1514,6 +1514,7 @@ void blk_rq_bio_prep(struct request_queue *q, struct request *rq,
>  	else if (bio_op(bio) == REQ_OP_DISCARD)
>  		rq->nr_phys_segments = 1;
>  
> +	WARN_ON(rq->nr_phys_segments == -1);
>  	rq->__data_len = bio->bi_iter.bi_size;
>  	rq->bio = rq->biotail = bio;

Just make that:

	else
		rq->nr_phys_segments = 0;

for the third case?

-- 
Jens Axboe




[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