diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-10 20:04:23 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-10 20:04:23 -0400 |
| commit | ce40be7a820bb393ac4ac69865f018d2f4038cf0 (patch) | |
| tree | b1fe5a93346eb06f22b1c303d63ec5456d7212ab /include/linux/bio.h | |
| parent | ba0a5a36f60e4c1152af3a2ae2813251974405bf (diff) | |
| parent | 02f3939e1a9357b7c370a4a69717cf9c02452737 (diff) | |
Merge branch 'for-3.7/core' of git://git.kernel.dk/linux-block
Pull block IO update from Jens Axboe:
"Core block IO bits for 3.7. Not a huge round this time, it contains:
- First series from Kent cleaning up and generalizing bio allocation
and freeing.
- WRITE_SAME support from Martin.
- Mikulas patches to prevent O_DIRECT crashes when someone changes
the block size of a device.
- Make bio_split() work on data-less bio's (like trim/discards).
- A few other minor fixups."
Fixed up silent semantic mis-merge as per Mikulas Patocka and Andrew
Morton. It is due to the VM no longer using a prio-tree (see commit
6b2dbba8b6ac: "mm: replace vma prio_tree with an interval tree").
So make set_blocksize() use mapping_mapped() instead of open-coding the
internal VM knowledge that has changed.
* 'for-3.7/core' of git://git.kernel.dk/linux-block: (26 commits)
block: makes bio_split support bio without data
scatterlist: refactor the sg_nents
scatterlist: add sg_nents
fs: fix include/percpu-rwsem.h export error
percpu-rw-semaphore: fix documentation typos
fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared
blockdev: turn a rw semaphore into a percpu rw semaphore
Fix a crash when block device is read and block size is changed at the same time
block: fix request_queue->flags initialization
block: lift the initial queue bypass mode on blk_register_queue() instead of blk_init_allocated_queue()
block: ioctl to zero block ranges
block: Make blkdev_issue_zeroout use WRITE SAME
block: Implement support for WRITE SAME
block: Consolidate command flag and queue limit checks for merges
block: Clean up special command handling logic
block/blk-tag.c: Remove useless kfree
block: remove the duplicated setting for congestion_threshold
block: reject invalid queue attribute values
block: Add bio_clone_bioset(), bio_clone_kmalloc()
block: Consolidate bio_alloc_bioset(), bio_kmalloc()
...
Diffstat (limited to 'include/linux/bio.h')
| -rw-r--r-- | include/linux/bio.h | 70 |
1 files changed, 55 insertions, 15 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 26435890dc87..820e7aaad4fd 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -212,20 +212,41 @@ extern void bio_pair_release(struct bio_pair *dbio); | |||
| 212 | extern struct bio_set *bioset_create(unsigned int, unsigned int); | 212 | extern struct bio_set *bioset_create(unsigned int, unsigned int); |
| 213 | extern void bioset_free(struct bio_set *); | 213 | extern void bioset_free(struct bio_set *); |
| 214 | 214 | ||
| 215 | extern struct bio *bio_alloc(gfp_t, unsigned int); | ||
| 216 | extern struct bio *bio_kmalloc(gfp_t, unsigned int); | ||
| 217 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); | 215 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); |
| 218 | extern void bio_put(struct bio *); | 216 | extern void bio_put(struct bio *); |
| 219 | extern void bio_free(struct bio *, struct bio_set *); | 217 | |
| 218 | extern void __bio_clone(struct bio *, struct bio *); | ||
| 219 | extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs); | ||
| 220 | |||
| 221 | extern struct bio_set *fs_bio_set; | ||
| 222 | |||
| 223 | static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs) | ||
| 224 | { | ||
| 225 | return bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); | ||
| 226 | } | ||
| 227 | |||
| 228 | static inline struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask) | ||
| 229 | { | ||
| 230 | return bio_clone_bioset(bio, gfp_mask, fs_bio_set); | ||
| 231 | } | ||
| 232 | |||
| 233 | static inline struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs) | ||
| 234 | { | ||
| 235 | return bio_alloc_bioset(gfp_mask, nr_iovecs, NULL); | ||
| 236 | } | ||
| 237 | |||
| 238 | static inline struct bio *bio_clone_kmalloc(struct bio *bio, gfp_t gfp_mask) | ||
| 239 | { | ||
| 240 | return bio_clone_bioset(bio, gfp_mask, NULL); | ||
| 241 | |||
| 242 | } | ||
| 220 | 243 | ||
| 221 | extern void bio_endio(struct bio *, int); | 244 | extern void bio_endio(struct bio *, int); |
| 222 | struct request_queue; | 245 | struct request_queue; |
| 223 | extern int bio_phys_segments(struct request_queue *, struct bio *); | 246 | extern int bio_phys_segments(struct request_queue *, struct bio *); |
| 224 | 247 | ||
| 225 | extern void __bio_clone(struct bio *, struct bio *); | ||
| 226 | extern struct bio *bio_clone(struct bio *, gfp_t); | ||
| 227 | |||
| 228 | extern void bio_init(struct bio *); | 248 | extern void bio_init(struct bio *); |
| 249 | extern void bio_reset(struct bio *); | ||
| 229 | 250 | ||
| 230 | extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); | 251 | extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); |
| 231 | extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, | 252 | extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, |
| @@ -304,8 +325,6 @@ struct biovec_slab { | |||
| 304 | struct kmem_cache *slab; | 325 | struct kmem_cache *slab; |
| 305 | }; | 326 | }; |
| 306 | 327 | ||
| 307 | extern struct bio_set *fs_bio_set; | ||
| 308 | |||
| 309 | /* | 328 | /* |
| 310 | * a small number of entries is fine, not going to be performance critical. | 329 | * a small number of entries is fine, not going to be performance critical. |
| 311 | * basically we just need to survive | 330 | * basically we just need to survive |
| @@ -367,9 +386,31 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, | |||
| 367 | /* | 386 | /* |
| 368 | * Check whether this bio carries any data or not. A NULL bio is allowed. | 387 | * Check whether this bio carries any data or not. A NULL bio is allowed. |
| 369 | */ | 388 | */ |
| 370 | static inline int bio_has_data(struct bio *bio) | 389 | static inline bool bio_has_data(struct bio *bio) |
| 371 | { | 390 | { |
| 372 | return bio && bio->bi_io_vec != NULL; | 391 | if (bio && bio->bi_vcnt) |
| 392 | return true; | ||
| 393 | |||
| 394 | return false; | ||
| 395 | } | ||
| 396 | |||
| 397 | static inline bool bio_is_rw(struct bio *bio) | ||
| 398 | { | ||
| 399 | if (!bio_has_data(bio)) | ||
| 400 | return false; | ||
| 401 | |||
| 402 | if (bio->bi_rw & REQ_WRITE_SAME) | ||
| 403 | return false; | ||
| 404 | |||
| 405 | return true; | ||
| 406 | } | ||
| 407 | |||
| 408 | static inline bool bio_mergeable(struct bio *bio) | ||
| 409 | { | ||
| 410 | if (bio->bi_rw & REQ_NOMERGE_FLAGS) | ||
| 411 | return false; | ||
| 412 | |||
| 413 | return true; | ||
| 373 | } | 414 | } |
| 374 | 415 | ||
| 375 | /* | 416 | /* |
| @@ -505,9 +546,8 @@ static inline struct bio *bio_list_get(struct bio_list *bl) | |||
| 505 | 546 | ||
| 506 | #define bio_integrity(bio) (bio->bi_integrity != NULL) | 547 | #define bio_integrity(bio) (bio->bi_integrity != NULL) |
| 507 | 548 | ||
| 508 | extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *); | ||
| 509 | extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); | 549 | extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); |
| 510 | extern void bio_integrity_free(struct bio *, struct bio_set *); | 550 | extern void bio_integrity_free(struct bio *); |
| 511 | extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); | 551 | extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); |
| 512 | extern int bio_integrity_enabled(struct bio *bio); | 552 | extern int bio_integrity_enabled(struct bio *bio); |
| 513 | extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); | 553 | extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); |
| @@ -517,7 +557,7 @@ extern void bio_integrity_endio(struct bio *, int); | |||
| 517 | extern void bio_integrity_advance(struct bio *, unsigned int); | 557 | extern void bio_integrity_advance(struct bio *, unsigned int); |
| 518 | extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); | 558 | extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); |
| 519 | extern void bio_integrity_split(struct bio *, struct bio_pair *, int); | 559 | extern void bio_integrity_split(struct bio *, struct bio_pair *, int); |
| 520 | extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t, struct bio_set *); | 560 | extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t); |
| 521 | extern int bioset_integrity_create(struct bio_set *, int); | 561 | extern int bioset_integrity_create(struct bio_set *, int); |
| 522 | extern void bioset_integrity_free(struct bio_set *); | 562 | extern void bioset_integrity_free(struct bio_set *); |
| 523 | extern void bio_integrity_init(void); | 563 | extern void bio_integrity_init(void); |
| @@ -549,13 +589,13 @@ static inline int bio_integrity_prep(struct bio *bio) | |||
| 549 | return 0; | 589 | return 0; |
| 550 | } | 590 | } |
| 551 | 591 | ||
| 552 | static inline void bio_integrity_free(struct bio *bio, struct bio_set *bs) | 592 | static inline void bio_integrity_free(struct bio *bio) |
| 553 | { | 593 | { |
| 554 | return; | 594 | return; |
| 555 | } | 595 | } |
| 556 | 596 | ||
| 557 | static inline int bio_integrity_clone(struct bio *bio, struct bio *bio_src, | 597 | static inline int bio_integrity_clone(struct bio *bio, struct bio *bio_src, |
| 558 | gfp_t gfp_mask, struct bio_set *bs) | 598 | gfp_t gfp_mask) |
| 559 | { | 599 | { |
| 560 | return 0; | 600 | return 0; |
| 561 | } | 601 | } |
