When the added page is merged to last same page in bio_add_pc_page(), the user may need to put this page for avoiding page leak. bio_map_user_iov() needs this kind of handling, and now it deals with it by itself in hack style. Moves the handling of put page into __bio_add_pc_page(), so bio_map_user_iov() may be simplified a bit, and maybe more users can benefit from this change.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -432,6 +432,9 @@ void bio_chain(struct bio *, struct bio *); · 431 unmodified lines | |||
| 432 | extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); | 432 | extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); |
| 433 | extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, | 433 | extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, |
| 434 | unsigned int, unsigned int); | 434 | unsigned int, unsigned int); |
| 435 | extern int __bio_add_pc_page(struct request_queue *, struct bio *, | ||
| 436 | struct page *, unsigned int, unsigned int, | ||
| 437 | bool); | ||
| 435 | bool __bio_try_merge_page(struct bio *bio, struct page *page, | 438 | bool __bio_try_merge_page(struct bio *bio, struct page *page, |
| 436 | unsigned int len, unsigned int off, bool same_page); | 439 | unsigned int len, unsigned int off, bool same_page); |
| 437 | void __bio_add_page(struct bio *bio, struct page *page, | 440 | void __bio_add_page(struct bio *bio, struct page *page, |