18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci#ifndef BTRFS_EXTENT_IO_H
48c2ecf20Sopenharmony_ci#define BTRFS_EXTENT_IO_H
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#include <linux/rbtree.h>
78c2ecf20Sopenharmony_ci#include <linux/refcount.h>
88c2ecf20Sopenharmony_ci#include <linux/fiemap.h>
98c2ecf20Sopenharmony_ci#include "ulist.h"
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/*
128c2ecf20Sopenharmony_ci * flags for bio submission. The high bits indicate the compression
138c2ecf20Sopenharmony_ci * type for this bio
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_ci#define EXTENT_BIO_COMPRESSED 1
168c2ecf20Sopenharmony_ci#define EXTENT_BIO_FLAG_SHIFT 16
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cienum {
198c2ecf20Sopenharmony_ci	EXTENT_BUFFER_UPTODATE,
208c2ecf20Sopenharmony_ci	EXTENT_BUFFER_DIRTY,
218c2ecf20Sopenharmony_ci	EXTENT_BUFFER_CORRUPT,
228c2ecf20Sopenharmony_ci	/* this got triggered by readahead */
238c2ecf20Sopenharmony_ci	EXTENT_BUFFER_READAHEAD,
248c2ecf20Sopenharmony_ci	EXTENT_BUFFER_TREE_REF,
258c2ecf20Sopenharmony_ci	EXTENT_BUFFER_STALE,
268c2ecf20Sopenharmony_ci	EXTENT_BUFFER_WRITEBACK,
278c2ecf20Sopenharmony_ci	/* read IO error */
288c2ecf20Sopenharmony_ci	EXTENT_BUFFER_READ_ERR,
298c2ecf20Sopenharmony_ci	EXTENT_BUFFER_UNMAPPED,
308c2ecf20Sopenharmony_ci	EXTENT_BUFFER_IN_TREE,
318c2ecf20Sopenharmony_ci	/* write IO error */
328c2ecf20Sopenharmony_ci	EXTENT_BUFFER_WRITE_ERR,
338c2ecf20Sopenharmony_ci};
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci/* these are flags for __process_pages_contig */
368c2ecf20Sopenharmony_ci#define PAGE_UNLOCK		(1 << 0)
378c2ecf20Sopenharmony_ci#define PAGE_CLEAR_DIRTY	(1 << 1)
388c2ecf20Sopenharmony_ci#define PAGE_SET_WRITEBACK	(1 << 2)
398c2ecf20Sopenharmony_ci#define PAGE_END_WRITEBACK	(1 << 3)
408c2ecf20Sopenharmony_ci#define PAGE_SET_PRIVATE2	(1 << 4)
418c2ecf20Sopenharmony_ci#define PAGE_SET_ERROR		(1 << 5)
428c2ecf20Sopenharmony_ci#define PAGE_LOCK		(1 << 6)
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/*
458c2ecf20Sopenharmony_ci * page->private values.  Every page that is controlled by the extent
468c2ecf20Sopenharmony_ci * map has page->private set to one.
478c2ecf20Sopenharmony_ci */
488c2ecf20Sopenharmony_ci#define EXTENT_PAGE_PRIVATE 1
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/*
518c2ecf20Sopenharmony_ci * The extent buffer bitmap operations are done with byte granularity instead of
528c2ecf20Sopenharmony_ci * word granularity for two reasons:
538c2ecf20Sopenharmony_ci * 1. The bitmaps must be little-endian on disk.
548c2ecf20Sopenharmony_ci * 2. Bitmap items are not guaranteed to be aligned to a word and therefore a
558c2ecf20Sopenharmony_ci *    single word in a bitmap may straddle two pages in the extent buffer.
568c2ecf20Sopenharmony_ci */
578c2ecf20Sopenharmony_ci#define BIT_BYTE(nr) ((nr) / BITS_PER_BYTE)
588c2ecf20Sopenharmony_ci#define BYTE_MASK ((1 << BITS_PER_BYTE) - 1)
598c2ecf20Sopenharmony_ci#define BITMAP_FIRST_BYTE_MASK(start) \
608c2ecf20Sopenharmony_ci	((BYTE_MASK << ((start) & (BITS_PER_BYTE - 1))) & BYTE_MASK)
618c2ecf20Sopenharmony_ci#define BITMAP_LAST_BYTE_MASK(nbits) \
628c2ecf20Sopenharmony_ci	(BYTE_MASK >> (-(nbits) & (BITS_PER_BYTE - 1)))
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cistruct btrfs_root;
658c2ecf20Sopenharmony_cistruct btrfs_inode;
668c2ecf20Sopenharmony_cistruct btrfs_io_bio;
678c2ecf20Sopenharmony_cistruct io_failure_record;
688c2ecf20Sopenharmony_cistruct extent_io_tree;
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_citypedef blk_status_t (submit_bio_hook_t)(struct inode *inode, struct bio *bio,
718c2ecf20Sopenharmony_ci					 int mirror_num,
728c2ecf20Sopenharmony_ci					 unsigned long bio_flags);
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_citypedef blk_status_t (extent_submit_bio_start_t)(void *private_data,
758c2ecf20Sopenharmony_ci		struct bio *bio, u64 bio_offset);
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#define INLINE_EXTENT_BUFFER_PAGES 16
788c2ecf20Sopenharmony_ci#define MAX_INLINE_EXTENT_BUFFER_SIZE (INLINE_EXTENT_BUFFER_PAGES * PAGE_SIZE)
798c2ecf20Sopenharmony_cistruct extent_buffer {
808c2ecf20Sopenharmony_ci	u64 start;
818c2ecf20Sopenharmony_ci	unsigned long len;
828c2ecf20Sopenharmony_ci	unsigned long bflags;
838c2ecf20Sopenharmony_ci	struct btrfs_fs_info *fs_info;
848c2ecf20Sopenharmony_ci	spinlock_t refs_lock;
858c2ecf20Sopenharmony_ci	atomic_t refs;
868c2ecf20Sopenharmony_ci	atomic_t io_pages;
878c2ecf20Sopenharmony_ci	int read_mirror;
888c2ecf20Sopenharmony_ci	struct rcu_head rcu_head;
898c2ecf20Sopenharmony_ci	pid_t lock_owner;
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci	int blocking_writers;
928c2ecf20Sopenharmony_ci	atomic_t blocking_readers;
938c2ecf20Sopenharmony_ci	bool lock_recursed;
948c2ecf20Sopenharmony_ci	/* >= 0 if eb belongs to a log tree, -1 otherwise */
958c2ecf20Sopenharmony_ci	short log_index;
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci	/* protects write locks */
988c2ecf20Sopenharmony_ci	rwlock_t lock;
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci	/* readers use lock_wq while they wait for the write
1018c2ecf20Sopenharmony_ci	 * lock holders to unlock
1028c2ecf20Sopenharmony_ci	 */
1038c2ecf20Sopenharmony_ci	wait_queue_head_t write_lock_wq;
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	/* writers use read_lock_wq while they wait for readers
1068c2ecf20Sopenharmony_ci	 * to unlock
1078c2ecf20Sopenharmony_ci	 */
1088c2ecf20Sopenharmony_ci	wait_queue_head_t read_lock_wq;
1098c2ecf20Sopenharmony_ci	struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
1108c2ecf20Sopenharmony_ci#ifdef CONFIG_BTRFS_DEBUG
1118c2ecf20Sopenharmony_ci	int spinning_writers;
1128c2ecf20Sopenharmony_ci	atomic_t spinning_readers;
1138c2ecf20Sopenharmony_ci	atomic_t read_locks;
1148c2ecf20Sopenharmony_ci	int write_locks;
1158c2ecf20Sopenharmony_ci	struct list_head leak_list;
1168c2ecf20Sopenharmony_ci#endif
1178c2ecf20Sopenharmony_ci};
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci/*
1208c2ecf20Sopenharmony_ci * Structure to record how many bytes and which ranges are set/cleared
1218c2ecf20Sopenharmony_ci */
1228c2ecf20Sopenharmony_cistruct extent_changeset {
1238c2ecf20Sopenharmony_ci	/* How many bytes are set/cleared in this operation */
1248c2ecf20Sopenharmony_ci	u64 bytes_changed;
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci	/* Changed ranges */
1278c2ecf20Sopenharmony_ci	struct ulist range_changed;
1288c2ecf20Sopenharmony_ci};
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_cistatic inline void extent_changeset_init(struct extent_changeset *changeset)
1318c2ecf20Sopenharmony_ci{
1328c2ecf20Sopenharmony_ci	changeset->bytes_changed = 0;
1338c2ecf20Sopenharmony_ci	ulist_init(&changeset->range_changed);
1348c2ecf20Sopenharmony_ci}
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_cistatic inline struct extent_changeset *extent_changeset_alloc(void)
1378c2ecf20Sopenharmony_ci{
1388c2ecf20Sopenharmony_ci	struct extent_changeset *ret;
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci	ret = kmalloc(sizeof(*ret), GFP_KERNEL);
1418c2ecf20Sopenharmony_ci	if (!ret)
1428c2ecf20Sopenharmony_ci		return NULL;
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci	extent_changeset_init(ret);
1458c2ecf20Sopenharmony_ci	return ret;
1468c2ecf20Sopenharmony_ci}
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_cistatic inline void extent_changeset_release(struct extent_changeset *changeset)
1498c2ecf20Sopenharmony_ci{
1508c2ecf20Sopenharmony_ci	if (!changeset)
1518c2ecf20Sopenharmony_ci		return;
1528c2ecf20Sopenharmony_ci	changeset->bytes_changed = 0;
1538c2ecf20Sopenharmony_ci	ulist_release(&changeset->range_changed);
1548c2ecf20Sopenharmony_ci}
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_cistatic inline void extent_changeset_free(struct extent_changeset *changeset)
1578c2ecf20Sopenharmony_ci{
1588c2ecf20Sopenharmony_ci	if (!changeset)
1598c2ecf20Sopenharmony_ci		return;
1608c2ecf20Sopenharmony_ci	extent_changeset_release(changeset);
1618c2ecf20Sopenharmony_ci	kfree(changeset);
1628c2ecf20Sopenharmony_ci}
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_cistatic inline void extent_set_compress_type(unsigned long *bio_flags,
1658c2ecf20Sopenharmony_ci					    int compress_type)
1668c2ecf20Sopenharmony_ci{
1678c2ecf20Sopenharmony_ci	*bio_flags |= compress_type << EXTENT_BIO_FLAG_SHIFT;
1688c2ecf20Sopenharmony_ci}
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_cistatic inline int extent_compress_type(unsigned long bio_flags)
1718c2ecf20Sopenharmony_ci{
1728c2ecf20Sopenharmony_ci	return bio_flags >> EXTENT_BIO_FLAG_SHIFT;
1738c2ecf20Sopenharmony_ci}
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_cistruct extent_map_tree;
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_citypedef struct extent_map *(get_extent_t)(struct btrfs_inode *inode,
1788c2ecf20Sopenharmony_ci					  struct page *page, size_t pg_offset,
1798c2ecf20Sopenharmony_ci					  u64 start, u64 len);
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ciint try_release_extent_mapping(struct page *page, gfp_t mask);
1828c2ecf20Sopenharmony_ciint try_release_extent_buffer(struct page *page);
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ciint __must_check submit_one_bio(struct bio *bio, int mirror_num,
1858c2ecf20Sopenharmony_ci				unsigned long bio_flags);
1868c2ecf20Sopenharmony_ciint btrfs_do_readpage(struct page *page, struct extent_map **em_cached,
1878c2ecf20Sopenharmony_ci		      struct bio **bio, unsigned long *bio_flags,
1888c2ecf20Sopenharmony_ci		      unsigned int read_flags, u64 *prev_em_start);
1898c2ecf20Sopenharmony_ciint extent_write_full_page(struct page *page, struct writeback_control *wbc);
1908c2ecf20Sopenharmony_ciint extent_write_locked_range(struct inode *inode, u64 start, u64 end,
1918c2ecf20Sopenharmony_ci			      int mode);
1928c2ecf20Sopenharmony_ciint extent_writepages(struct address_space *mapping,
1938c2ecf20Sopenharmony_ci		      struct writeback_control *wbc);
1948c2ecf20Sopenharmony_ciint btree_write_cache_pages(struct address_space *mapping,
1958c2ecf20Sopenharmony_ci			    struct writeback_control *wbc);
1968c2ecf20Sopenharmony_civoid extent_readahead(struct readahead_control *rac);
1978c2ecf20Sopenharmony_ciint extent_fiemap(struct btrfs_inode *inode, struct fiemap_extent_info *fieinfo,
1988c2ecf20Sopenharmony_ci		  u64 start, u64 len);
1998c2ecf20Sopenharmony_civoid set_page_extent_mapped(struct page *page);
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_cistruct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
2028c2ecf20Sopenharmony_ci					  u64 start);
2038c2ecf20Sopenharmony_cistruct extent_buffer *__alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info,
2048c2ecf20Sopenharmony_ci						  u64 start, unsigned long len);
2058c2ecf20Sopenharmony_cistruct extent_buffer *alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info,
2068c2ecf20Sopenharmony_ci						u64 start);
2078c2ecf20Sopenharmony_cistruct extent_buffer *btrfs_clone_extent_buffer(const struct extent_buffer *src);
2088c2ecf20Sopenharmony_cistruct extent_buffer *find_extent_buffer(struct btrfs_fs_info *fs_info,
2098c2ecf20Sopenharmony_ci					 u64 start);
2108c2ecf20Sopenharmony_civoid free_extent_buffer(struct extent_buffer *eb);
2118c2ecf20Sopenharmony_civoid free_extent_buffer_stale(struct extent_buffer *eb);
2128c2ecf20Sopenharmony_ci#define WAIT_NONE	0
2138c2ecf20Sopenharmony_ci#define WAIT_COMPLETE	1
2148c2ecf20Sopenharmony_ci#define WAIT_PAGE_LOCK	2
2158c2ecf20Sopenharmony_ciint read_extent_buffer_pages(struct extent_buffer *eb, int wait,
2168c2ecf20Sopenharmony_ci			     int mirror_num);
2178c2ecf20Sopenharmony_civoid wait_on_extent_buffer_writeback(struct extent_buffer *eb);
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_cistatic inline int num_extent_pages(const struct extent_buffer *eb)
2208c2ecf20Sopenharmony_ci{
2218c2ecf20Sopenharmony_ci	return (round_up(eb->start + eb->len, PAGE_SIZE) >> PAGE_SHIFT) -
2228c2ecf20Sopenharmony_ci	       (eb->start >> PAGE_SHIFT);
2238c2ecf20Sopenharmony_ci}
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_cistatic inline int extent_buffer_uptodate(const struct extent_buffer *eb)
2268c2ecf20Sopenharmony_ci{
2278c2ecf20Sopenharmony_ci	return test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
2288c2ecf20Sopenharmony_ci}
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ciint memcmp_extent_buffer(const struct extent_buffer *eb, const void *ptrv,
2318c2ecf20Sopenharmony_ci			 unsigned long start, unsigned long len);
2328c2ecf20Sopenharmony_civoid read_extent_buffer(const struct extent_buffer *eb, void *dst,
2338c2ecf20Sopenharmony_ci			unsigned long start,
2348c2ecf20Sopenharmony_ci			unsigned long len);
2358c2ecf20Sopenharmony_ciint read_extent_buffer_to_user_nofault(const struct extent_buffer *eb,
2368c2ecf20Sopenharmony_ci				       void __user *dst, unsigned long start,
2378c2ecf20Sopenharmony_ci				       unsigned long len);
2388c2ecf20Sopenharmony_civoid write_extent_buffer_fsid(const struct extent_buffer *eb, const void *src);
2398c2ecf20Sopenharmony_civoid write_extent_buffer_chunk_tree_uuid(const struct extent_buffer *eb,
2408c2ecf20Sopenharmony_ci		const void *src);
2418c2ecf20Sopenharmony_civoid write_extent_buffer(const struct extent_buffer *eb, const void *src,
2428c2ecf20Sopenharmony_ci			 unsigned long start, unsigned long len);
2438c2ecf20Sopenharmony_civoid copy_extent_buffer_full(const struct extent_buffer *dst,
2448c2ecf20Sopenharmony_ci			     const struct extent_buffer *src);
2458c2ecf20Sopenharmony_civoid copy_extent_buffer(const struct extent_buffer *dst,
2468c2ecf20Sopenharmony_ci			const struct extent_buffer *src,
2478c2ecf20Sopenharmony_ci			unsigned long dst_offset, unsigned long src_offset,
2488c2ecf20Sopenharmony_ci			unsigned long len);
2498c2ecf20Sopenharmony_civoid memcpy_extent_buffer(const struct extent_buffer *dst,
2508c2ecf20Sopenharmony_ci			  unsigned long dst_offset, unsigned long src_offset,
2518c2ecf20Sopenharmony_ci			  unsigned long len);
2528c2ecf20Sopenharmony_civoid memmove_extent_buffer(const struct extent_buffer *dst,
2538c2ecf20Sopenharmony_ci			   unsigned long dst_offset, unsigned long src_offset,
2548c2ecf20Sopenharmony_ci			   unsigned long len);
2558c2ecf20Sopenharmony_civoid memzero_extent_buffer(const struct extent_buffer *eb, unsigned long start,
2568c2ecf20Sopenharmony_ci			   unsigned long len);
2578c2ecf20Sopenharmony_ciint extent_buffer_test_bit(const struct extent_buffer *eb, unsigned long start,
2588c2ecf20Sopenharmony_ci			   unsigned long pos);
2598c2ecf20Sopenharmony_civoid extent_buffer_bitmap_set(const struct extent_buffer *eb, unsigned long start,
2608c2ecf20Sopenharmony_ci			      unsigned long pos, unsigned long len);
2618c2ecf20Sopenharmony_civoid extent_buffer_bitmap_clear(const struct extent_buffer *eb,
2628c2ecf20Sopenharmony_ci				unsigned long start, unsigned long pos,
2638c2ecf20Sopenharmony_ci				unsigned long len);
2648c2ecf20Sopenharmony_civoid clear_extent_buffer_dirty(const struct extent_buffer *eb);
2658c2ecf20Sopenharmony_cibool set_extent_buffer_dirty(struct extent_buffer *eb);
2668c2ecf20Sopenharmony_civoid set_extent_buffer_uptodate(struct extent_buffer *eb);
2678c2ecf20Sopenharmony_civoid clear_extent_buffer_uptodate(struct extent_buffer *eb);
2688c2ecf20Sopenharmony_ciint extent_buffer_under_io(const struct extent_buffer *eb);
2698c2ecf20Sopenharmony_civoid extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end);
2708c2ecf20Sopenharmony_civoid extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end);
2718c2ecf20Sopenharmony_civoid extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
2728c2ecf20Sopenharmony_ci				  struct page *locked_page,
2738c2ecf20Sopenharmony_ci				  unsigned bits_to_clear,
2748c2ecf20Sopenharmony_ci				  unsigned long page_ops);
2758c2ecf20Sopenharmony_cistruct bio *btrfs_bio_alloc(u64 first_byte);
2768c2ecf20Sopenharmony_cistruct bio *btrfs_io_bio_alloc(unsigned int nr_iovecs);
2778c2ecf20Sopenharmony_cistruct bio *btrfs_bio_clone(struct bio *bio);
2788c2ecf20Sopenharmony_cistruct bio *btrfs_bio_clone_partial(struct bio *orig, int offset, int size);
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_cistruct btrfs_fs_info;
2818c2ecf20Sopenharmony_cistruct btrfs_inode;
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ciint repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
2848c2ecf20Sopenharmony_ci		      u64 length, u64 logical, struct page *page,
2858c2ecf20Sopenharmony_ci		      unsigned int pg_offset, int mirror_num);
2868c2ecf20Sopenharmony_civoid end_extent_writepage(struct page *page, int err, u64 start, u64 end);
2878c2ecf20Sopenharmony_ciint btrfs_repair_eb_io_failure(const struct extent_buffer *eb, int mirror_num);
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci/*
2908c2ecf20Sopenharmony_ci * When IO fails, either with EIO or csum verification fails, we
2918c2ecf20Sopenharmony_ci * try other mirrors that might have a good copy of the data.  This
2928c2ecf20Sopenharmony_ci * io_failure_record is used to record state as we go through all the
2938c2ecf20Sopenharmony_ci * mirrors.  If another mirror has good data, the page is set up to date
2948c2ecf20Sopenharmony_ci * and things continue.  If a good mirror can't be found, the original
2958c2ecf20Sopenharmony_ci * bio end_io callback is called to indicate things have failed.
2968c2ecf20Sopenharmony_ci */
2978c2ecf20Sopenharmony_cistruct io_failure_record {
2988c2ecf20Sopenharmony_ci	struct page *page;
2998c2ecf20Sopenharmony_ci	u64 start;
3008c2ecf20Sopenharmony_ci	u64 len;
3018c2ecf20Sopenharmony_ci	u64 logical;
3028c2ecf20Sopenharmony_ci	unsigned long bio_flags;
3038c2ecf20Sopenharmony_ci	int this_mirror;
3048c2ecf20Sopenharmony_ci	int failed_mirror;
3058c2ecf20Sopenharmony_ci	int in_validation;
3068c2ecf20Sopenharmony_ci};
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ciblk_status_t btrfs_submit_read_repair(struct inode *inode,
3108c2ecf20Sopenharmony_ci				      struct bio *failed_bio, u64 phy_offset,
3118c2ecf20Sopenharmony_ci				      struct page *page, unsigned int pgoff,
3128c2ecf20Sopenharmony_ci				      u64 start, u64 end, int failed_mirror,
3138c2ecf20Sopenharmony_ci				      submit_bio_hook_t *submit_bio_hook);
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
3168c2ecf20Sopenharmony_cibool find_lock_delalloc_range(struct inode *inode,
3178c2ecf20Sopenharmony_ci			     struct page *locked_page, u64 *start,
3188c2ecf20Sopenharmony_ci			     u64 *end);
3198c2ecf20Sopenharmony_ci#endif
3208c2ecf20Sopenharmony_cistruct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
3218c2ecf20Sopenharmony_ci					       u64 start);
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci#ifdef CONFIG_BTRFS_DEBUG
3248c2ecf20Sopenharmony_civoid btrfs_extent_buffer_leak_debug_check(struct btrfs_fs_info *fs_info);
3258c2ecf20Sopenharmony_ci#else
3268c2ecf20Sopenharmony_ci#define btrfs_extent_buffer_leak_debug_check(fs_info)	do {} while (0)
3278c2ecf20Sopenharmony_ci#endif
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci#endif
330