bio.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. /*
  2. * 2.5 block I/O model
  3. *
  4. * Copyright (C) 2001 Jens Axboe <axboe@suse.de>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. *
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public Licens
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-
  19. */
  20. #ifndef __LINUX_BIO_H
  21. #define __LINUX_BIO_H
  22. #include <linux/highmem.h>
  23. #include <linux/mempool.h>
  24. #include <linux/ioprio.h>
  25. #include <linux/bug.h>
  26. #ifdef CONFIG_BLOCK
  27. #include <asm/io.h>
  28. /* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */
  29. #include <linux/blk_types.h>
  30. #define BIO_DEBUG
  31. #ifdef BIO_DEBUG
  32. #define BIO_BUG_ON BUG_ON
  33. #else
  34. #define BIO_BUG_ON
  35. #endif
  36. #define BIO_MAX_PAGES 256
  37. #define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT)
  38. #define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9)
  39. /*
  40. * upper 16 bits of bi_rw define the io priority of this bio
  41. */
  42. #define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS)
  43. #define bio_prio(bio) ((bio)->bi_rw >> BIO_PRIO_SHIFT)
  44. #define bio_prio_valid(bio) ioprio_valid(bio_prio(bio))
  45. #define bio_set_prio(bio, prio) do { \
  46. WARN_ON(prio >= (1 << IOPRIO_BITS)); \
  47. (bio)->bi_rw &= ((1UL << BIO_PRIO_SHIFT) - 1); \
  48. (bio)->bi_rw |= ((unsigned long) (prio) << BIO_PRIO_SHIFT); \
  49. } while (0)
  50. /*
  51. * various member access, note that bio_data should of course not be used
  52. * on highmem page vectors
  53. */
  54. #define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)]))
  55. #define bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_idx)
  56. #define bio_page(bio) bio_iovec((bio))->bv_page
  57. #define bio_offset(bio) bio_iovec((bio))->bv_offset
  58. #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
  59. #define bio_sectors(bio) ((bio)->bi_size >> 9)
  60. #define bio_end_sector(bio) ((bio)->bi_sector + bio_sectors((bio)))
  61. static inline unsigned int bio_cur_bytes(struct bio *bio)
  62. {
  63. if (bio->bi_vcnt)
  64. return bio_iovec(bio)->bv_len;
  65. else /* dataless requests such as discard */
  66. return bio->bi_size;
  67. }
  68. static inline void *bio_data(struct bio *bio)
  69. {
  70. if (bio->bi_vcnt)
  71. return page_address(bio_page(bio)) + bio_offset(bio);
  72. return NULL;
  73. }
  74. static inline int bio_has_allocated_vec(struct bio *bio)
  75. {
  76. return bio->bi_io_vec && bio->bi_io_vec != bio->bi_inline_vecs;
  77. }
  78. /*
  79. * will die
  80. */
  81. #define bio_to_phys(bio) (page_to_phys(bio_page((bio))) + (unsigned long) bio_offset((bio)))
  82. #define bvec_to_phys(bv) (page_to_phys((bv)->bv_page) + (unsigned long) (bv)->bv_offset)
  83. /*
  84. * queues that have highmem support enabled may still need to revert to
  85. * PIO transfers occasionally and thus map high pages temporarily. For
  86. * permanent PIO fall back, user is probably better off disabling highmem
  87. * I/O completely on that queue (see ide-dma for example)
  88. */
  89. #define __bio_kmap_atomic(bio, idx, kmtype) \
  90. (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \
  91. bio_iovec_idx((bio), (idx))->bv_offset)
  92. #define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr)
  93. /*
  94. * merge helpers etc
  95. */
  96. #define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1)
  97. #define __BVEC_START(bio) bio_iovec_idx((bio), (bio)->bi_idx)
  98. /* Default implementation of BIOVEC_PHYS_MERGEABLE */
  99. #define __BIOVEC_PHYS_MERGEABLE(vec1, vec2) \
  100. ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2)))
  101. /*
  102. * allow arch override, for eg virtualized architectures (put in asm/io.h)
  103. */
  104. #ifndef BIOVEC_PHYS_MERGEABLE
  105. #define BIOVEC_PHYS_MERGEABLE(vec1, vec2) \
  106. __BIOVEC_PHYS_MERGEABLE(vec1, vec2)
  107. #endif
  108. #define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \
  109. (((addr1) | (mask)) == (((addr2) - 1) | (mask)))
  110. #define BIOVEC_SEG_BOUNDARY(q, b1, b2) \
  111. __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q)))
  112. #define BIO_SEG_BOUNDARY(q, b1, b2) \
  113. BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2)))
  114. #define bio_io_error(bio) bio_endio((bio), -EIO)
  115. /*
  116. * drivers should not use the __ version unless they _really_ know what
  117. * they're doing
  118. */
  119. #define __bio_for_each_segment(bvl, bio, i, start_idx) \
  120. for (bvl = bio_iovec_idx((bio), (start_idx)), i = (start_idx); \
  121. i < (bio)->bi_vcnt; \
  122. bvl++, i++)
  123. /*
  124. * drivers should _never_ use the all version - the bio may have been split
  125. * before it got to the driver and the driver won't own all of it
  126. */
  127. #define bio_for_each_segment_all(bvl, bio, i) \
  128. for (i = 0; \
  129. bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \
  130. i++)
  131. #define bio_for_each_segment(bvl, bio, i) \
  132. for (i = (bio)->bi_idx; \
  133. bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \
  134. i++)
  135. /*
  136. * get a reference to a bio, so it won't disappear. the intended use is
  137. * something like:
  138. *
  139. * bio_get(bio);
  140. * submit_bio(rw, bio);
  141. * if (bio->bi_flags ...)
  142. * do_something
  143. * bio_put(bio);
  144. *
  145. * without the bio_get(), it could potentially complete I/O before submit_bio
  146. * returns. and then bio would be freed memory when if (bio->bi_flags ...)
  147. * runs
  148. */
  149. #define bio_get(bio) atomic_inc(&(bio)->bi_cnt)
  150. #if defined(CONFIG_BLK_DEV_INTEGRITY)
  151. /*
  152. * bio integrity payload
  153. */
  154. struct bio_integrity_payload {
  155. struct bio *bip_bio; /* parent bio */
  156. sector_t bip_sector; /* virtual start sector */
  157. void *bip_buf; /* generated integrity data */
  158. bio_end_io_t *bip_end_io; /* saved I/O completion fn */
  159. unsigned int bip_size;
  160. unsigned short bip_slab; /* slab the bip came from */
  161. unsigned short bip_vcnt; /* # of integrity bio_vecs */
  162. unsigned short bip_idx; /* current bip_vec index */
  163. struct work_struct bip_work; /* I/O completion */
  164. struct bio_vec *bip_vec;
  165. struct bio_vec bip_inline_vecs[0];/* embedded bvec array */
  166. };
  167. #endif /* CONFIG_BLK_DEV_INTEGRITY */
  168. /*
  169. * A bio_pair is used when we need to split a bio.
  170. * This can only happen for a bio that refers to just one
  171. * page of data, and in the unusual situation when the
  172. * page crosses a chunk/device boundary
  173. *
  174. * The address of the master bio is stored in bio1.bi_private
  175. * The address of the pool the pair was allocated from is stored
  176. * in bio2.bi_private
  177. */
  178. struct bio_pair {
  179. struct bio bio1, bio2;
  180. struct bio_vec bv1, bv2;
  181. #if defined(CONFIG_BLK_DEV_INTEGRITY)
  182. struct bio_integrity_payload bip1, bip2;
  183. struct bio_vec iv1, iv2;
  184. #endif
  185. atomic_t cnt;
  186. int error;
  187. };
  188. extern struct bio_pair *bio_split(struct bio *bi, int first_sectors);
  189. extern void bio_pair_release(struct bio_pair *dbio);
  190. extern struct bio_set *bioset_create(unsigned int, unsigned int);
  191. extern void bioset_free(struct bio_set *);
  192. extern mempool_t *biovec_create_pool(struct bio_set *bs, int pool_entries);
  193. extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
  194. extern void bio_put(struct bio *);
  195. extern void __bio_clone(struct bio *, struct bio *);
  196. extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs);
  197. extern struct bio_set *fs_bio_set;
  198. static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs)
  199. {
  200. return bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set);
  201. }
  202. static inline struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask)
  203. {
  204. return bio_clone_bioset(bio, gfp_mask, fs_bio_set);
  205. }
  206. static inline struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs)
  207. {
  208. return bio_alloc_bioset(gfp_mask, nr_iovecs, NULL);
  209. }
  210. static inline struct bio *bio_clone_kmalloc(struct bio *bio, gfp_t gfp_mask)
  211. {
  212. return bio_clone_bioset(bio, gfp_mask, NULL);
  213. }
  214. extern void bio_endio(struct bio *, int);
  215. struct request_queue;
  216. extern int bio_phys_segments(struct request_queue *, struct bio *);
  217. extern int submit_bio_wait(int rw, struct bio *bio);
  218. extern void bio_advance(struct bio *, unsigned);
  219. extern void bio_init(struct bio *);
  220. extern void bio_reset(struct bio *);
  221. extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
  222. extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,
  223. unsigned int, unsigned int);
  224. extern int bio_get_nr_vecs(struct block_device *);
  225. extern sector_t bio_sector_offset(struct bio *, unsigned short, unsigned int);
  226. extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
  227. unsigned long, unsigned int, int, gfp_t);
  228. struct sg_iovec;
  229. struct rq_map_data;
  230. extern struct bio *bio_map_user_iov(struct request_queue *,
  231. struct block_device *,
  232. struct sg_iovec *, int, int, gfp_t);
  233. extern void bio_unmap_user(struct bio *);
  234. extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
  235. gfp_t);
  236. extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int,
  237. gfp_t, int);
  238. extern void bio_set_pages_dirty(struct bio *bio);
  239. extern void bio_check_pages_dirty(struct bio *bio);
  240. #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
  241. # error "You should define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform"
  242. #endif
  243. #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
  244. extern void bio_flush_dcache_pages(struct bio *bi);
  245. #else
  246. static inline void bio_flush_dcache_pages(struct bio *bi)
  247. {
  248. }
  249. #endif
  250. extern void bio_copy_data(struct bio *dst, struct bio *src);
  251. extern int bio_alloc_pages(struct bio *bio, gfp_t gfp);
  252. extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *,
  253. unsigned long, unsigned int, int, gfp_t);
  254. extern struct bio *bio_copy_user_iov(struct request_queue *,
  255. struct rq_map_data *, struct sg_iovec *,
  256. int, int, gfp_t);
  257. extern int bio_uncopy_user(struct bio *);
  258. void zero_fill_bio(struct bio *bio);
  259. extern struct bio_vec *bvec_alloc(gfp_t, int, unsigned long *, mempool_t *);
  260. extern void bvec_free(mempool_t *, struct bio_vec *, unsigned int);
  261. extern unsigned int bvec_nr_vecs(unsigned short idx);
  262. #ifdef CONFIG_BLK_CGROUP
  263. int bio_associate_current(struct bio *bio);
  264. void bio_disassociate_task(struct bio *bio);
  265. #else /* CONFIG_BLK_CGROUP */
  266. static inline int bio_associate_current(struct bio *bio) { return -ENOENT; }
  267. static inline void bio_disassociate_task(struct bio *bio) { }
  268. #endif /* CONFIG_BLK_CGROUP */
  269. #ifdef CONFIG_HIGHMEM
  270. /*
  271. * remember never ever reenable interrupts between a bvec_kmap_irq and
  272. * bvec_kunmap_irq!
  273. */
  274. static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
  275. {
  276. unsigned long addr;
  277. /*
  278. * might not be a highmem page, but the preempt/irq count
  279. * balancing is a lot nicer this way
  280. */
  281. local_irq_save(*flags);
  282. addr = (unsigned long) kmap_atomic(bvec->bv_page);
  283. BUG_ON(addr & ~PAGE_MASK);
  284. return (char *) addr + bvec->bv_offset;
  285. }
  286. static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
  287. {
  288. unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
  289. kunmap_atomic((void *) ptr);
  290. local_irq_restore(*flags);
  291. }
  292. #else
  293. static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
  294. {
  295. return page_address(bvec->bv_page) + bvec->bv_offset;
  296. }
  297. static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
  298. {
  299. *flags = 0;
  300. }
  301. #endif
  302. static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
  303. unsigned long *flags)
  304. {
  305. return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags);
  306. }
  307. #define __bio_kunmap_irq(buf, flags) bvec_kunmap_irq(buf, flags)
  308. #define bio_kmap_irq(bio, flags) \
  309. __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
  310. #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
  311. /*
  312. * Check whether this bio carries any data or not. A NULL bio is allowed.
  313. */
  314. static inline bool bio_has_data(struct bio *bio)
  315. {
  316. if (bio && bio->bi_vcnt)
  317. return true;
  318. return false;
  319. }
  320. static inline bool bio_is_rw(struct bio *bio)
  321. {
  322. if (!bio_has_data(bio))
  323. return false;
  324. if (bio->bi_rw & REQ_WRITE_SAME)
  325. return false;
  326. return true;
  327. }
  328. static inline bool bio_mergeable(struct bio *bio)
  329. {
  330. if (bio->bi_rw & REQ_NOMERGE_FLAGS)
  331. return false;
  332. return true;
  333. }
  334. /*
  335. * BIO list management for use by remapping drivers (e.g. DM or MD) and loop.
  336. *
  337. * A bio_list anchors a singly-linked list of bios chained through the bi_next
  338. * member of the bio. The bio_list also caches the last list member to allow
  339. * fast access to the tail.
  340. */
  341. struct bio_list {
  342. struct bio *head;
  343. struct bio *tail;
  344. };
  345. static inline int bio_list_empty(const struct bio_list *bl)
  346. {
  347. return bl->head == NULL;
  348. }
  349. static inline void bio_list_init(struct bio_list *bl)
  350. {
  351. bl->head = bl->tail = NULL;
  352. }
  353. #define bio_list_for_each(bio, bl) \
  354. for (bio = (bl)->head; bio; bio = bio->bi_next)
  355. static inline unsigned bio_list_size(const struct bio_list *bl)
  356. {
  357. unsigned sz = 0;
  358. struct bio *bio;
  359. bio_list_for_each(bio, bl)
  360. sz++;
  361. return sz;
  362. }
  363. static inline void bio_list_add(struct bio_list *bl, struct bio *bio)
  364. {
  365. bio->bi_next = NULL;
  366. if (bl->tail)
  367. bl->tail->bi_next = bio;
  368. else
  369. bl->head = bio;
  370. bl->tail = bio;
  371. }
  372. static inline void bio_list_add_head(struct bio_list *bl, struct bio *bio)
  373. {
  374. bio->bi_next = bl->head;
  375. bl->head = bio;
  376. if (!bl->tail)
  377. bl->tail = bio;
  378. }
  379. static inline void bio_list_merge(struct bio_list *bl, struct bio_list *bl2)
  380. {
  381. if (!bl2->head)
  382. return;
  383. if (bl->tail)
  384. bl->tail->bi_next = bl2->head;
  385. else
  386. bl->head = bl2->head;
  387. bl->tail = bl2->tail;
  388. }
  389. static inline void bio_list_merge_head(struct bio_list *bl,
  390. struct bio_list *bl2)
  391. {
  392. if (!bl2->head)
  393. return;
  394. if (bl->head)
  395. bl2->tail->bi_next = bl->head;
  396. else
  397. bl->tail = bl2->tail;
  398. bl->head = bl2->head;
  399. }
  400. static inline struct bio *bio_list_peek(struct bio_list *bl)
  401. {
  402. return bl->head;
  403. }
  404. static inline struct bio *bio_list_pop(struct bio_list *bl)
  405. {
  406. struct bio *bio = bl->head;
  407. if (bio) {
  408. bl->head = bl->head->bi_next;
  409. if (!bl->head)
  410. bl->tail = NULL;
  411. bio->bi_next = NULL;
  412. }
  413. return bio;
  414. }
  415. static inline struct bio *bio_list_get(struct bio_list *bl)
  416. {
  417. struct bio *bio = bl->head;
  418. bl->head = bl->tail = NULL;
  419. return bio;
  420. }
  421. /*
  422. * bio_set is used to allow other portions of the IO system to
  423. * allocate their own private memory pools for bio and iovec structures.
  424. * These memory pools in turn all allocate from the bio_slab
  425. * and the bvec_slabs[].
  426. */
  427. #define BIO_POOL_SIZE 2
  428. #define BIOVEC_NR_POOLS 6
  429. #define BIOVEC_MAX_IDX (BIOVEC_NR_POOLS - 1)
  430. struct bio_set {
  431. struct kmem_cache *bio_slab;
  432. unsigned int front_pad;
  433. mempool_t *bio_pool;
  434. mempool_t *bvec_pool;
  435. #if defined(CONFIG_BLK_DEV_INTEGRITY)
  436. mempool_t *bio_integrity_pool;
  437. mempool_t *bvec_integrity_pool;
  438. #endif
  439. /*
  440. * Deadlock avoidance for stacking block drivers: see comments in
  441. * bio_alloc_bioset() for details
  442. */
  443. spinlock_t rescue_lock;
  444. struct bio_list rescue_list;
  445. struct work_struct rescue_work;
  446. struct workqueue_struct *rescue_workqueue;
  447. };
  448. struct biovec_slab {
  449. int nr_vecs;
  450. char *name;
  451. struct kmem_cache *slab;
  452. };
  453. /*
  454. * a small number of entries is fine, not going to be performance critical.
  455. * basically we just need to survive
  456. */
  457. #define BIO_SPLIT_ENTRIES 2
  458. #if defined(CONFIG_BLK_DEV_INTEGRITY)
  459. #define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)]))
  460. #define bip_vec(bip) bip_vec_idx(bip, 0)
  461. #define __bip_for_each_vec(bvl, bip, i, start_idx) \
  462. for (bvl = bip_vec_idx((bip), (start_idx)), i = (start_idx); \
  463. i < (bip)->bip_vcnt; \
  464. bvl++, i++)
  465. #define bip_for_each_vec(bvl, bip, i) \
  466. __bip_for_each_vec(bvl, bip, i, (bip)->bip_idx)
  467. #define bio_for_each_integrity_vec(_bvl, _bio, _iter) \
  468. for_each_bio(_bio) \
  469. bip_for_each_vec(_bvl, _bio->bi_integrity, _iter)
  470. #define bio_integrity(bio) (bio->bi_integrity != NULL)
  471. extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
  472. extern void bio_integrity_free(struct bio *);
  473. extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int);
  474. extern int bio_integrity_enabled(struct bio *bio);
  475. extern int bio_integrity_set_tag(struct bio *, void *, unsigned int);
  476. extern int bio_integrity_get_tag(struct bio *, void *, unsigned int);
  477. extern int bio_integrity_prep(struct bio *);
  478. extern void bio_integrity_endio(struct bio *, int);
  479. extern void bio_integrity_advance(struct bio *, unsigned int);
  480. extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int);
  481. extern void bio_integrity_split(struct bio *, struct bio_pair *, int);
  482. extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t);
  483. extern int bioset_integrity_create(struct bio_set *, int);
  484. extern void bioset_integrity_free(struct bio_set *);
  485. extern void bio_integrity_init(void);
  486. #else /* CONFIG_BLK_DEV_INTEGRITY */
  487. static inline int bio_integrity(struct bio *bio)
  488. {
  489. return 0;
  490. }
  491. static inline int bio_integrity_enabled(struct bio *bio)
  492. {
  493. return 0;
  494. }
  495. static inline int bioset_integrity_create(struct bio_set *bs, int pool_size)
  496. {
  497. return 0;
  498. }
  499. static inline void bioset_integrity_free (struct bio_set *bs)
  500. {
  501. return;
  502. }
  503. static inline int bio_integrity_prep(struct bio *bio)
  504. {
  505. return 0;
  506. }
  507. static inline void bio_integrity_free(struct bio *bio)
  508. {
  509. return;
  510. }
  511. static inline int bio_integrity_clone(struct bio *bio, struct bio *bio_src,
  512. gfp_t gfp_mask)
  513. {
  514. return 0;
  515. }
  516. static inline void bio_integrity_split(struct bio *bio, struct bio_pair *bp,
  517. int sectors)
  518. {
  519. return;
  520. }
  521. static inline void bio_integrity_advance(struct bio *bio,
  522. unsigned int bytes_done)
  523. {
  524. return;
  525. }
  526. static inline void bio_integrity_trim(struct bio *bio, unsigned int offset,
  527. unsigned int sectors)
  528. {
  529. return;
  530. }
  531. static inline void bio_integrity_init(void)
  532. {
  533. return;
  534. }
  535. #endif /* CONFIG_BLK_DEV_INTEGRITY */
  536. #endif /* CONFIG_BLOCK */
  537. #endif /* __LINUX_BIO_H */