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 Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux