Refine per-cpu bio alloc cache interfaces so that DM and other block drivers can properly create and use the cache: DM uses bioset_init_from_src() to do its final bioset initialization, so must update bioset_init_from_src() to set BIOSET_PERCPU_CACHE if %src bioset has a cache. Also move bio_clear_polled() to include/linux/bio.h to allow users outside of block core.
Unified · Split
| @@ -1767,6 +1767,8 @@ int bioset_init_from_src(struct bio_set *bs, struct bio_set *src) · 1766 unmodified lines | |||
| 1767 | flags |= BIOSET_NEED_BVECS; | 1767 | flags |= BIOSET_NEED_BVECS; |
| 1768 | if (src->rescue_workqueue) | 1768 | if (src->rescue_workqueue) |
| 1769 | flags |= BIOSET_NEED_RESCUER; | 1769 | flags |= BIOSET_NEED_RESCUER; |
| 1770 | if (src->cache) | ||
| 1771 | flags |= BIOSET_PERCPU_CACHE; | ||
| 1770 | 1772 | ||
| 1771 | return bioset_init(bs, src->bio_pool.min_nr, src->front_pad, flags); | 1773 | return bioset_init(bs, src->bio_pool.min_nr, src->front_pad, flags); |
| 1772 | } | 1774 | } |
| @@ -450,12 +450,6 @@ extern struct device_attribute dev_attr_events; · 449 unmodified lines | |||
| 450 | extern struct device_attribute dev_attr_events_async; | 450 | extern struct device_attribute dev_attr_events_async; |
| 451 | extern struct device_attribute dev_attr_events_poll_msecs; | 451 | extern struct device_attribute dev_attr_events_poll_msecs; |
| 452 | 452 | ||
| 453 | static inline void bio_clear_polled(struct bio *bio) | ||
| 454 | { | ||
| 455 | /* can't support alloc cache if we turn off polling */ | ||
| 456 | bio->bi_opf &= ~(REQ_POLLED | REQ_ALLOC_CACHE); | ||
| 457 | } | ||
| 458 | |||
| 459 | long blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg); | 453 | long blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg); |
| 460 | long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg); | 454 | long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg); |
| 461 | 455 | ||
| @@ -780,6 +780,12 @@ static inline void bio_set_polled(struct bio *bio, struct kiocb *kiocb) · 779 unmodified lines | |||
| 780 | bio->bi_opf |= REQ_NOWAIT; | 780 | bio->bi_opf |= REQ_NOWAIT; |
| 781 | } | 781 | } |
| 782 | 782 | ||
| 783 | static inline void bio_clear_polled(struct bio *bio) | ||
| 784 | { | ||
| 785 | /* can't support alloc cache if we turn off polling */ | ||
| 786 | bio->bi_opf &= ~(REQ_POLLED | REQ_ALLOC_CACHE); | ||
| 787 | } | ||
| 788 | |||
| 783 | struct bio *blk_next_bio(struct bio *bio, struct block_device *bdev, | 789 | struct bio *blk_next_bio(struct bio *bio, struct block_device *bdev, |
| 784 | unsigned int nr_pages, unsigned int opf, gfp_t gfp); | 790 | unsigned int nr_pages, unsigned int opf, gfp_t gfp); |
| 785 | 791 | ||