extent_io.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef BTRFS_EXTENT_IO_H
  3. #define BTRFS_EXTENT_IO_H
  4. #include <linux/rbtree.h>
  5. #include <linux/refcount.h>
  6. #include "ulist.h"
  7. /* bits for the extent state */
  8. #define EXTENT_DIRTY (1U << 0)
  9. #define EXTENT_WRITEBACK (1U << 1)
  10. #define EXTENT_UPTODATE (1U << 2)
  11. #define EXTENT_LOCKED (1U << 3)
  12. #define EXTENT_NEW (1U << 4)
  13. #define EXTENT_DELALLOC (1U << 5)
  14. #define EXTENT_DEFRAG (1U << 6)
  15. #define EXTENT_BOUNDARY (1U << 9)
  16. #define EXTENT_NODATASUM (1U << 10)
  17. #define EXTENT_CLEAR_META_RESV (1U << 11)
  18. #define EXTENT_FIRST_DELALLOC (1U << 12)
  19. #define EXTENT_NEED_WAIT (1U << 13)
  20. #define EXTENT_DAMAGED (1U << 14)
  21. #define EXTENT_NORESERVE (1U << 15)
  22. #define EXTENT_QGROUP_RESERVED (1U << 16)
  23. #define EXTENT_CLEAR_DATA_RESV (1U << 17)
  24. #define EXTENT_DELALLOC_NEW (1U << 18)
  25. #define EXTENT_IOBITS (EXTENT_LOCKED | EXTENT_WRITEBACK)
  26. #define EXTENT_DO_ACCOUNTING (EXTENT_CLEAR_META_RESV | \
  27. EXTENT_CLEAR_DATA_RESV)
  28. #define EXTENT_CTLBITS (EXTENT_DO_ACCOUNTING | EXTENT_FIRST_DELALLOC)
  29. /*
  30. * flags for bio submission. The high bits indicate the compression
  31. * type for this bio
  32. */
  33. #define EXTENT_BIO_COMPRESSED 1
  34. #define EXTENT_BIO_FLAG_SHIFT 16
  35. /* these are bit numbers for test/set bit */
  36. #define EXTENT_BUFFER_UPTODATE 0
  37. #define EXTENT_BUFFER_DIRTY 2
  38. #define EXTENT_BUFFER_CORRUPT 3
  39. #define EXTENT_BUFFER_READAHEAD 4 /* this got triggered by readahead */
  40. #define EXTENT_BUFFER_TREE_REF 5
  41. #define EXTENT_BUFFER_STALE 6
  42. #define EXTENT_BUFFER_WRITEBACK 7
  43. #define EXTENT_BUFFER_READ_ERR 8 /* read IO error */
  44. #define EXTENT_BUFFER_UNMAPPED 9
  45. #define EXTENT_BUFFER_IN_TREE 10
  46. #define EXTENT_BUFFER_WRITE_ERR 11 /* write IO error */
  47. /* these are flags for __process_pages_contig */
  48. #define PAGE_UNLOCK (1 << 0)
  49. #define PAGE_CLEAR_DIRTY (1 << 1)
  50. #define PAGE_SET_WRITEBACK (1 << 2)
  51. #define PAGE_END_WRITEBACK (1 << 3)
  52. #define PAGE_SET_PRIVATE2 (1 << 4)
  53. #define PAGE_SET_ERROR (1 << 5)
  54. #define PAGE_LOCK (1 << 6)
  55. /*
  56. * page->private values. Every page that is controlled by the extent
  57. * map has page->private set to one.
  58. */
  59. #define EXTENT_PAGE_PRIVATE 1
  60. /*
  61. * The extent buffer bitmap operations are done with byte granularity instead of
  62. * word granularity for two reasons:
  63. * 1. The bitmaps must be little-endian on disk.
  64. * 2. Bitmap items are not guaranteed to be aligned to a word and therefore a
  65. * single word in a bitmap may straddle two pages in the extent buffer.
  66. */
  67. #define BIT_BYTE(nr) ((nr) / BITS_PER_BYTE)
  68. #define BYTE_MASK ((1 << BITS_PER_BYTE) - 1)
  69. #define BITMAP_FIRST_BYTE_MASK(start) \
  70. ((BYTE_MASK << ((start) & (BITS_PER_BYTE - 1))) & BYTE_MASK)
  71. #define BITMAP_LAST_BYTE_MASK(nbits) \
  72. (BYTE_MASK >> (-(nbits) & (BITS_PER_BYTE - 1)))
  73. struct extent_state;
  74. struct btrfs_root;
  75. struct btrfs_inode;
  76. struct btrfs_io_bio;
  77. struct io_failure_record;
  78. typedef blk_status_t (extent_submit_bio_hook_t)(void *private_data, struct bio *bio,
  79. int mirror_num, unsigned long bio_flags,
  80. u64 bio_offset);
  81. typedef blk_status_t (extent_submit_bio_start_t)(void *private_data,
  82. struct bio *bio, u64 bio_offset);
  83. struct extent_io_ops {
  84. /*
  85. * The following callbacks must be allways defined, the function
  86. * pointer will be called unconditionally.
  87. */
  88. extent_submit_bio_hook_t *submit_bio_hook;
  89. int (*readpage_end_io_hook)(struct btrfs_io_bio *io_bio, u64 phy_offset,
  90. struct page *page, u64 start, u64 end,
  91. int mirror);
  92. int (*readpage_io_failed_hook)(struct page *page, int failed_mirror);
  93. /*
  94. * Optional hooks, called if the pointer is not NULL
  95. */
  96. int (*writepage_start_hook)(struct page *page, u64 start, u64 end);
  97. void (*writepage_end_io_hook)(struct page *page, u64 start, u64 end,
  98. struct extent_state *state, int uptodate);
  99. void (*set_bit_hook)(void *private_data, struct extent_state *state,
  100. unsigned *bits);
  101. void (*clear_bit_hook)(void *private_data,
  102. struct extent_state *state,
  103. unsigned *bits);
  104. void (*merge_extent_hook)(void *private_data,
  105. struct extent_state *new,
  106. struct extent_state *other);
  107. void (*split_extent_hook)(void *private_data,
  108. struct extent_state *orig, u64 split);
  109. void (*check_extent_io_range)(void *private_data, const char *caller,
  110. u64 start, u64 end);
  111. };
  112. struct extent_io_tree {
  113. struct rb_root state;
  114. void *private_data;
  115. u64 dirty_bytes;
  116. int track_uptodate;
  117. spinlock_t lock;
  118. const struct extent_io_ops *ops;
  119. };
  120. struct extent_state {
  121. u64 start;
  122. u64 end; /* inclusive */
  123. struct rb_node rb_node;
  124. /* ADD NEW ELEMENTS AFTER THIS */
  125. wait_queue_head_t wq;
  126. refcount_t refs;
  127. unsigned state;
  128. struct io_failure_record *failrec;
  129. #ifdef CONFIG_BTRFS_DEBUG
  130. struct list_head leak_list;
  131. #endif
  132. };
  133. #define INLINE_EXTENT_BUFFER_PAGES 16
  134. #define MAX_INLINE_EXTENT_BUFFER_SIZE (INLINE_EXTENT_BUFFER_PAGES * PAGE_SIZE)
  135. struct extent_buffer {
  136. u64 start;
  137. unsigned long len;
  138. unsigned long bflags;
  139. struct btrfs_fs_info *fs_info;
  140. spinlock_t refs_lock;
  141. atomic_t refs;
  142. atomic_t io_pages;
  143. int read_mirror;
  144. struct rcu_head rcu_head;
  145. pid_t lock_owner;
  146. /* count of read lock holders on the extent buffer */
  147. atomic_t write_locks;
  148. atomic_t read_locks;
  149. atomic_t blocking_writers;
  150. atomic_t blocking_readers;
  151. atomic_t spinning_readers;
  152. atomic_t spinning_writers;
  153. short lock_nested;
  154. /* >= 0 if eb belongs to a log tree, -1 otherwise */
  155. short log_index;
  156. /* protects write locks */
  157. rwlock_t lock;
  158. /* readers use lock_wq while they wait for the write
  159. * lock holders to unlock
  160. */
  161. wait_queue_head_t write_lock_wq;
  162. /* writers use read_lock_wq while they wait for readers
  163. * to unlock
  164. */
  165. wait_queue_head_t read_lock_wq;
  166. struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
  167. #ifdef CONFIG_BTRFS_DEBUG
  168. struct list_head leak_list;
  169. #endif
  170. };
  171. /*
  172. * Structure to record how many bytes and which ranges are set/cleared
  173. */
  174. struct extent_changeset {
  175. /* How many bytes are set/cleared in this operation */
  176. unsigned int bytes_changed;
  177. /* Changed ranges */
  178. struct ulist range_changed;
  179. };
  180. static inline void extent_changeset_init(struct extent_changeset *changeset)
  181. {
  182. changeset->bytes_changed = 0;
  183. ulist_init(&changeset->range_changed);
  184. }
  185. static inline struct extent_changeset *extent_changeset_alloc(void)
  186. {
  187. struct extent_changeset *ret;
  188. ret = kmalloc(sizeof(*ret), GFP_KERNEL);
  189. if (!ret)
  190. return NULL;
  191. extent_changeset_init(ret);
  192. return ret;
  193. }
  194. static inline void extent_changeset_release(struct extent_changeset *changeset)
  195. {
  196. if (!changeset)
  197. return;
  198. changeset->bytes_changed = 0;
  199. ulist_release(&changeset->range_changed);
  200. }
  201. static inline void extent_changeset_free(struct extent_changeset *changeset)
  202. {
  203. if (!changeset)
  204. return;
  205. extent_changeset_release(changeset);
  206. kfree(changeset);
  207. }
  208. static inline void extent_set_compress_type(unsigned long *bio_flags,
  209. int compress_type)
  210. {
  211. *bio_flags |= compress_type << EXTENT_BIO_FLAG_SHIFT;
  212. }
  213. static inline int extent_compress_type(unsigned long bio_flags)
  214. {
  215. return bio_flags >> EXTENT_BIO_FLAG_SHIFT;
  216. }
  217. struct extent_map_tree;
  218. typedef struct extent_map *(get_extent_t)(struct btrfs_inode *inode,
  219. struct page *page,
  220. size_t pg_offset,
  221. u64 start, u64 len,
  222. int create);
  223. void extent_io_tree_init(struct extent_io_tree *tree, void *private_data);
  224. int try_release_extent_mapping(struct page *page, gfp_t mask);
  225. int try_release_extent_buffer(struct page *page);
  226. int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
  227. struct extent_state **cached);
  228. static inline int lock_extent(struct extent_io_tree *tree, u64 start, u64 end)
  229. {
  230. return lock_extent_bits(tree, start, end, NULL);
  231. }
  232. int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end);
  233. int extent_read_full_page(struct extent_io_tree *tree, struct page *page,
  234. get_extent_t *get_extent, int mirror_num);
  235. int __init extent_io_init(void);
  236. void __cold extent_io_exit(void);
  237. u64 count_range_bits(struct extent_io_tree *tree,
  238. u64 *start, u64 search_end,
  239. u64 max_bytes, unsigned bits, int contig);
  240. void free_extent_state(struct extent_state *state);
  241. int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end,
  242. unsigned bits, int filled,
  243. struct extent_state *cached_state);
  244. int clear_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
  245. unsigned bits, struct extent_changeset *changeset);
  246. int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
  247. unsigned bits, int wake, int delete,
  248. struct extent_state **cached);
  249. int __clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
  250. unsigned bits, int wake, int delete,
  251. struct extent_state **cached, gfp_t mask,
  252. struct extent_changeset *changeset);
  253. static inline int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end)
  254. {
  255. return clear_extent_bit(tree, start, end, EXTENT_LOCKED, 1, 0, NULL);
  256. }
  257. static inline int unlock_extent_cached(struct extent_io_tree *tree, u64 start,
  258. u64 end, struct extent_state **cached)
  259. {
  260. return __clear_extent_bit(tree, start, end, EXTENT_LOCKED, 1, 0, cached,
  261. GFP_NOFS, NULL);
  262. }
  263. static inline int unlock_extent_cached_atomic(struct extent_io_tree *tree,
  264. u64 start, u64 end, struct extent_state **cached)
  265. {
  266. return __clear_extent_bit(tree, start, end, EXTENT_LOCKED, 1, 0, cached,
  267. GFP_ATOMIC, NULL);
  268. }
  269. static inline int clear_extent_bits(struct extent_io_tree *tree, u64 start,
  270. u64 end, unsigned bits)
  271. {
  272. int wake = 0;
  273. if (bits & EXTENT_LOCKED)
  274. wake = 1;
  275. return clear_extent_bit(tree, start, end, bits, wake, 0, NULL);
  276. }
  277. int set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
  278. unsigned bits, struct extent_changeset *changeset);
  279. int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
  280. unsigned bits, u64 *failed_start,
  281. struct extent_state **cached_state, gfp_t mask);
  282. static inline int set_extent_bits(struct extent_io_tree *tree, u64 start,
  283. u64 end, unsigned bits)
  284. {
  285. return set_extent_bit(tree, start, end, bits, NULL, NULL, GFP_NOFS);
  286. }
  287. static inline int clear_extent_uptodate(struct extent_io_tree *tree, u64 start,
  288. u64 end, struct extent_state **cached_state)
  289. {
  290. return __clear_extent_bit(tree, start, end, EXTENT_UPTODATE, 0, 0,
  291. cached_state, GFP_NOFS, NULL);
  292. }
  293. static inline int set_extent_dirty(struct extent_io_tree *tree, u64 start,
  294. u64 end, gfp_t mask)
  295. {
  296. return set_extent_bit(tree, start, end, EXTENT_DIRTY, NULL,
  297. NULL, mask);
  298. }
  299. static inline int clear_extent_dirty(struct extent_io_tree *tree, u64 start,
  300. u64 end, struct extent_state **cached)
  301. {
  302. return clear_extent_bit(tree, start, end,
  303. EXTENT_DIRTY | EXTENT_DELALLOC |
  304. EXTENT_DO_ACCOUNTING, 0, 0, cached);
  305. }
  306. int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
  307. unsigned bits, unsigned clear_bits,
  308. struct extent_state **cached_state);
  309. static inline int set_extent_delalloc(struct extent_io_tree *tree, u64 start,
  310. u64 end, unsigned int extra_bits,
  311. struct extent_state **cached_state)
  312. {
  313. return set_extent_bit(tree, start, end,
  314. EXTENT_DELALLOC | EXTENT_UPTODATE | extra_bits,
  315. NULL, cached_state, GFP_NOFS);
  316. }
  317. static inline int set_extent_defrag(struct extent_io_tree *tree, u64 start,
  318. u64 end, struct extent_state **cached_state)
  319. {
  320. return set_extent_bit(tree, start, end,
  321. EXTENT_DELALLOC | EXTENT_UPTODATE | EXTENT_DEFRAG,
  322. NULL, cached_state, GFP_NOFS);
  323. }
  324. static inline int set_extent_new(struct extent_io_tree *tree, u64 start,
  325. u64 end)
  326. {
  327. return set_extent_bit(tree, start, end, EXTENT_NEW, NULL, NULL,
  328. GFP_NOFS);
  329. }
  330. static inline int set_extent_uptodate(struct extent_io_tree *tree, u64 start,
  331. u64 end, struct extent_state **cached_state, gfp_t mask)
  332. {
  333. return set_extent_bit(tree, start, end, EXTENT_UPTODATE, NULL,
  334. cached_state, mask);
  335. }
  336. int find_first_extent_bit(struct extent_io_tree *tree, u64 start,
  337. u64 *start_ret, u64 *end_ret, unsigned bits,
  338. struct extent_state **cached_state);
  339. int extent_invalidatepage(struct extent_io_tree *tree,
  340. struct page *page, unsigned long offset);
  341. int extent_write_full_page(struct page *page, struct writeback_control *wbc);
  342. int extent_write_locked_range(struct inode *inode, u64 start, u64 end,
  343. int mode);
  344. int extent_writepages(struct address_space *mapping,
  345. struct writeback_control *wbc);
  346. int btree_write_cache_pages(struct address_space *mapping,
  347. struct writeback_control *wbc);
  348. int extent_readpages(struct address_space *mapping, struct list_head *pages,
  349. unsigned nr_pages);
  350. int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
  351. __u64 start, __u64 len);
  352. void set_page_extent_mapped(struct page *page);
  353. struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
  354. u64 start);
  355. struct extent_buffer *__alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info,
  356. u64 start, unsigned long len);
  357. struct extent_buffer *alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info,
  358. u64 start);
  359. struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src);
  360. struct extent_buffer *find_extent_buffer(struct btrfs_fs_info *fs_info,
  361. u64 start);
  362. void free_extent_buffer(struct extent_buffer *eb);
  363. void free_extent_buffer_stale(struct extent_buffer *eb);
  364. #define WAIT_NONE 0
  365. #define WAIT_COMPLETE 1
  366. #define WAIT_PAGE_LOCK 2
  367. int read_extent_buffer_pages(struct extent_io_tree *tree,
  368. struct extent_buffer *eb, int wait,
  369. int mirror_num);
  370. void wait_on_extent_buffer_writeback(struct extent_buffer *eb);
  371. static inline int num_extent_pages(const struct extent_buffer *eb)
  372. {
  373. return (round_up(eb->start + eb->len, PAGE_SIZE) >> PAGE_SHIFT) -
  374. (eb->start >> PAGE_SHIFT);
  375. }
  376. static inline void extent_buffer_get(struct extent_buffer *eb)
  377. {
  378. atomic_inc(&eb->refs);
  379. }
  380. static inline int extent_buffer_uptodate(struct extent_buffer *eb)
  381. {
  382. return test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
  383. }
  384. int memcmp_extent_buffer(const struct extent_buffer *eb, const void *ptrv,
  385. unsigned long start, unsigned long len);
  386. void read_extent_buffer(const struct extent_buffer *eb, void *dst,
  387. unsigned long start,
  388. unsigned long len);
  389. int read_extent_buffer_to_user(const struct extent_buffer *eb,
  390. void __user *dst, unsigned long start,
  391. unsigned long len);
  392. void write_extent_buffer_fsid(struct extent_buffer *eb, const void *src);
  393. void write_extent_buffer_chunk_tree_uuid(struct extent_buffer *eb,
  394. const void *src);
  395. void write_extent_buffer(struct extent_buffer *eb, const void *src,
  396. unsigned long start, unsigned long len);
  397. void copy_extent_buffer_full(struct extent_buffer *dst,
  398. struct extent_buffer *src);
  399. void copy_extent_buffer(struct extent_buffer *dst, struct extent_buffer *src,
  400. unsigned long dst_offset, unsigned long src_offset,
  401. unsigned long len);
  402. void memcpy_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
  403. unsigned long src_offset, unsigned long len);
  404. void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
  405. unsigned long src_offset, unsigned long len);
  406. void memzero_extent_buffer(struct extent_buffer *eb, unsigned long start,
  407. unsigned long len);
  408. int extent_buffer_test_bit(struct extent_buffer *eb, unsigned long start,
  409. unsigned long pos);
  410. void extent_buffer_bitmap_set(struct extent_buffer *eb, unsigned long start,
  411. unsigned long pos, unsigned long len);
  412. void extent_buffer_bitmap_clear(struct extent_buffer *eb, unsigned long start,
  413. unsigned long pos, unsigned long len);
  414. void clear_extent_buffer_dirty(struct extent_buffer *eb);
  415. int set_extent_buffer_dirty(struct extent_buffer *eb);
  416. void set_extent_buffer_uptodate(struct extent_buffer *eb);
  417. void clear_extent_buffer_uptodate(struct extent_buffer *eb);
  418. int extent_buffer_under_io(struct extent_buffer *eb);
  419. int map_private_extent_buffer(const struct extent_buffer *eb,
  420. unsigned long offset, unsigned long min_len,
  421. char **map, unsigned long *map_start,
  422. unsigned long *map_len);
  423. void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end);
  424. void extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end);
  425. void extent_clear_unlock_delalloc(struct inode *inode, u64 start, u64 end,
  426. u64 delalloc_end, struct page *locked_page,
  427. unsigned bits_to_clear,
  428. unsigned long page_ops);
  429. struct bio *btrfs_bio_alloc(struct block_device *bdev, u64 first_byte);
  430. struct bio *btrfs_io_bio_alloc(unsigned int nr_iovecs);
  431. struct bio *btrfs_bio_clone(struct bio *bio);
  432. struct bio *btrfs_bio_clone_partial(struct bio *orig, int offset, int size);
  433. struct btrfs_fs_info;
  434. struct btrfs_inode;
  435. int repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
  436. u64 length, u64 logical, struct page *page,
  437. unsigned int pg_offset, int mirror_num);
  438. int clean_io_failure(struct btrfs_fs_info *fs_info,
  439. struct extent_io_tree *failure_tree,
  440. struct extent_io_tree *io_tree, u64 start,
  441. struct page *page, u64 ino, unsigned int pg_offset);
  442. void end_extent_writepage(struct page *page, int err, u64 start, u64 end);
  443. int repair_eb_io_failure(struct btrfs_fs_info *fs_info,
  444. struct extent_buffer *eb, int mirror_num);
  445. /*
  446. * When IO fails, either with EIO or csum verification fails, we
  447. * try other mirrors that might have a good copy of the data. This
  448. * io_failure_record is used to record state as we go through all the
  449. * mirrors. If another mirror has good data, the page is set up to date
  450. * and things continue. If a good mirror can't be found, the original
  451. * bio end_io callback is called to indicate things have failed.
  452. */
  453. struct io_failure_record {
  454. struct page *page;
  455. u64 start;
  456. u64 len;
  457. u64 logical;
  458. unsigned long bio_flags;
  459. int this_mirror;
  460. int failed_mirror;
  461. int in_validation;
  462. };
  463. void btrfs_free_io_failure_record(struct btrfs_inode *inode, u64 start,
  464. u64 end);
  465. int btrfs_get_io_failure_record(struct inode *inode, u64 start, u64 end,
  466. struct io_failure_record **failrec_ret);
  467. bool btrfs_check_repairable(struct inode *inode, unsigned failed_bio_pages,
  468. struct io_failure_record *failrec, int fail_mirror);
  469. struct bio *btrfs_create_repair_bio(struct inode *inode, struct bio *failed_bio,
  470. struct io_failure_record *failrec,
  471. struct page *page, int pg_offset, int icsum,
  472. bio_end_io_t *endio_func, void *data);
  473. int free_io_failure(struct extent_io_tree *failure_tree,
  474. struct extent_io_tree *io_tree,
  475. struct io_failure_record *rec);
  476. #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
  477. noinline u64 find_lock_delalloc_range(struct inode *inode,
  478. struct extent_io_tree *tree,
  479. struct page *locked_page, u64 *start,
  480. u64 *end, u64 max_bytes);
  481. #endif
  482. struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
  483. u64 start);
  484. #endif