mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
block: remove the bi_phys_segments field in struct bio
We only need the number of segments in the blk-mq submission path. Remove the field from struct bio, and return it from a variant of blk_queue_split instead of that it can passed as an argument to those functions that need the value. This also means we stop recounting segments except for cloning and partial segments. To keep the number of arguments in this how path down remove pointless struct request_queue arguments from any of the functions that had it and grew a nr_segs argument. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
f924cddebc
commit
14ccb66b3f
18 changed files with 106 additions and 137 deletions
15
block/bio.c
15
block/bio.c
|
|
@ -558,14 +558,6 @@ void bio_put(struct bio *bio)
|
|||
}
|
||||
EXPORT_SYMBOL(bio_put);
|
||||
|
||||
int bio_phys_segments(struct request_queue *q, struct bio *bio)
|
||||
{
|
||||
if (unlikely(!bio_flagged(bio, BIO_SEG_VALID)))
|
||||
blk_recount_segments(q, bio);
|
||||
|
||||
return bio->bi_phys_segments;
|
||||
}
|
||||
|
||||
/**
|
||||
* __bio_clone_fast - clone a bio that shares the original bio's biovec
|
||||
* @bio: destination bio
|
||||
|
|
@ -739,7 +731,7 @@ static int __bio_add_pc_page(struct request_queue *q, struct bio *bio,
|
|||
if (bio_full(bio))
|
||||
return 0;
|
||||
|
||||
if (bio->bi_phys_segments >= queue_max_segments(q))
|
||||
if (bio->bi_vcnt >= queue_max_segments(q))
|
||||
return 0;
|
||||
|
||||
bvec = &bio->bi_io_vec[bio->bi_vcnt];
|
||||
|
|
@ -749,8 +741,6 @@ static int __bio_add_pc_page(struct request_queue *q, struct bio *bio,
|
|||
bio->bi_vcnt++;
|
||||
done:
|
||||
bio->bi_iter.bi_size += len;
|
||||
bio->bi_phys_segments = bio->bi_vcnt;
|
||||
bio_set_flag(bio, BIO_SEG_VALID);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
|
@ -1909,10 +1899,7 @@ void bio_trim(struct bio *bio, int offset, int size)
|
|||
if (offset == 0 && size == bio->bi_iter.bi_size)
|
||||
return;
|
||||
|
||||
bio_clear_flag(bio, BIO_SEG_VALID);
|
||||
|
||||
bio_advance(bio, offset << 9);
|
||||
|
||||
bio->bi_iter.bi_size = size;
|
||||
|
||||
if (bio_integrity(bio))
|
||||
|
|
|
|||
Loading…
Reference in a new issue