diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-11 09:04:23 +0900 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-11 09:04:23 +0900 | 
| commit | ce40be7a820bb393ac4ac69865f018d2f4038cf0 (patch) | |
| tree | b1fe5a93346eb06f22b1c303d63ec5456d7212ab /include/linux/bio.h | |
| parent | ba0a5a36f60e4c1152af3a2ae2813251974405bf (diff) | |
| parent | 02f3939e1a9357b7c370a4a69717cf9c02452737 (diff) | |
| download | olio-linux-3.10-ce40be7a820bb393ac4ac69865f018d2f4038cf0.tar.xz olio-linux-3.10-ce40be7a820bb393ac4ac69865f018d2f4038cf0.zip  | |
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 26435890dc8..820e7aaad4f 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -212,20 +212,41 @@ extern void bio_pair_release(struct bio_pair *dbio);  extern struct bio_set *bioset_create(unsigned int, unsigned int);  extern void bioset_free(struct bio_set *); -extern struct bio *bio_alloc(gfp_t, unsigned int); -extern struct bio *bio_kmalloc(gfp_t, unsigned int);  extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);  extern void bio_put(struct bio *); -extern void bio_free(struct bio *, struct bio_set *); + +extern void __bio_clone(struct bio *, struct bio *); +extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs); + +extern struct bio_set *fs_bio_set; + +static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs) +{ +	return bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); +} + +static inline struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask) +{ +	return bio_clone_bioset(bio, gfp_mask, fs_bio_set); +} + +static inline struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs) +{ +	return bio_alloc_bioset(gfp_mask, nr_iovecs, NULL); +} + +static inline struct bio *bio_clone_kmalloc(struct bio *bio, gfp_t gfp_mask) +{ +	return bio_clone_bioset(bio, gfp_mask, NULL); + +}  extern void bio_endio(struct bio *, int);  struct request_queue;  extern int bio_phys_segments(struct request_queue *, struct bio *); -extern void __bio_clone(struct bio *, struct bio *); -extern struct bio *bio_clone(struct bio *, gfp_t); -  extern void bio_init(struct bio *); +extern void bio_reset(struct bio *);  extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);  extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, @@ -304,8 +325,6 @@ struct biovec_slab {  	struct kmem_cache *slab;  }; -extern struct bio_set *fs_bio_set; -  /*   * a small number of entries is fine, not going to be performance critical.   * basically we just need to survive @@ -367,9 +386,31 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,  /*   * Check whether this bio carries any data or not. A NULL bio is allowed.   */ -static inline int bio_has_data(struct bio *bio) +static inline bool bio_has_data(struct bio *bio)  { -	return bio && bio->bi_io_vec != NULL; +	if (bio && bio->bi_vcnt) +		return true; + +	return false; +} + +static inline bool bio_is_rw(struct bio *bio) +{ +	if (!bio_has_data(bio)) +		return false; + +	if (bio->bi_rw & REQ_WRITE_SAME) +		return false; + +	return true; +} + +static inline bool bio_mergeable(struct bio *bio) +{ +	if (bio->bi_rw & REQ_NOMERGE_FLAGS) +		return false; + +	return true;  }  /* @@ -505,9 +546,8 @@ static inline struct bio *bio_list_get(struct bio_list *bl)  #define bio_integrity(bio) (bio->bi_integrity != NULL) -extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *);  extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); -extern void bio_integrity_free(struct bio *, struct bio_set *); +extern void bio_integrity_free(struct bio *);  extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int);  extern int bio_integrity_enabled(struct bio *bio);  extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); @@ -517,7 +557,7 @@ extern void bio_integrity_endio(struct bio *, int);  extern void bio_integrity_advance(struct bio *, unsigned int);  extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int);  extern void bio_integrity_split(struct bio *, struct bio_pair *, int); -extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t, struct bio_set *); +extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t);  extern int bioset_integrity_create(struct bio_set *, int);  extern void bioset_integrity_free(struct bio_set *);  extern void bio_integrity_init(void); @@ -549,13 +589,13 @@ static inline int bio_integrity_prep(struct bio *bio)  	return 0;  } -static inline void bio_integrity_free(struct bio *bio, struct bio_set *bs) +static inline void bio_integrity_free(struct bio *bio)  {  	return;  }  static inline int bio_integrity_clone(struct bio *bio, struct bio *bio_src, -				      gfp_t gfp_mask, struct bio_set *bs) +				      gfp_t gfp_mask)  {  	return 0;  }  |