volumes.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2007 Oracle. All rights reserved.
  4. */
  5. #ifndef BTRFS_VOLUMES_H
  6. #define BTRFS_VOLUMES_H
  7. #include <linux/bio.h>
  8. #include <linux/sort.h>
  9. #include <linux/btrfs.h>
  10. #include "async-thread.h"
  11. #define BTRFS_MAX_DATA_CHUNK_SIZE (10ULL * SZ_1G)
  12. extern struct mutex uuid_mutex;
  13. #define BTRFS_STRIPE_LEN SZ_64K
  14. struct btrfs_io_geometry {
  15. /* remaining bytes before crossing a stripe */
  16. u64 len;
  17. /* offset of logical address in chunk */
  18. u64 offset;
  19. /* length of single IO stripe */
  20. u64 stripe_len;
  21. /* number of stripe where address falls */
  22. u64 stripe_nr;
  23. /* offset of address in stripe */
  24. u64 stripe_offset;
  25. /* offset of raid56 stripe into the chunk */
  26. u64 raid56_stripe_offset;
  27. };
  28. /*
  29. * Use sequence counter to get consistent device stat data on
  30. * 32-bit processors.
  31. */
  32. #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
  33. #include <linux/seqlock.h>
  34. #define __BTRFS_NEED_DEVICE_DATA_ORDERED
  35. #define btrfs_device_data_ordered_init(device) \
  36. seqcount_init(&device->data_seqcount)
  37. #else
  38. #define btrfs_device_data_ordered_init(device) do { } while (0)
  39. #endif
  40. #define BTRFS_DEV_STATE_WRITEABLE (0)
  41. #define BTRFS_DEV_STATE_IN_FS_METADATA (1)
  42. #define BTRFS_DEV_STATE_MISSING (2)
  43. #define BTRFS_DEV_STATE_REPLACE_TGT (3)
  44. #define BTRFS_DEV_STATE_FLUSH_SENT (4)
  45. #define BTRFS_DEV_STATE_NO_READA (5)
  46. struct btrfs_device {
  47. struct list_head dev_list; /* device_list_mutex */
  48. struct list_head dev_alloc_list; /* chunk mutex */
  49. struct list_head post_commit_list; /* chunk mutex */
  50. struct btrfs_fs_devices *fs_devices;
  51. struct btrfs_fs_info *fs_info;
  52. struct rcu_string __rcu *name;
  53. u64 generation;
  54. struct block_device *bdev;
  55. /* the mode sent to blkdev_get */
  56. fmode_t mode;
  57. unsigned long dev_state;
  58. blk_status_t last_flush_error;
  59. #ifdef __BTRFS_NEED_DEVICE_DATA_ORDERED
  60. seqcount_t data_seqcount;
  61. #endif
  62. /* the internal btrfs device id */
  63. u64 devid;
  64. /* size of the device in memory */
  65. u64 total_bytes;
  66. /* size of the device on disk */
  67. u64 disk_total_bytes;
  68. /* bytes used */
  69. u64 bytes_used;
  70. /* optimal io alignment for this device */
  71. u32 io_align;
  72. /* optimal io width for this device */
  73. u32 io_width;
  74. /* type and info about this device */
  75. u64 type;
  76. /* minimal io size for this device */
  77. u32 sector_size;
  78. /* physical drive uuid (or lvm uuid) */
  79. u8 uuid[BTRFS_UUID_SIZE];
  80. /*
  81. * size of the device on the current transaction
  82. *
  83. * This variant is update when committing the transaction,
  84. * and protected by chunk mutex
  85. */
  86. u64 commit_total_bytes;
  87. /* bytes used on the current transaction */
  88. u64 commit_bytes_used;
  89. /* for sending down flush barriers */
  90. struct bio *flush_bio;
  91. struct completion flush_wait;
  92. /* per-device scrub information */
  93. struct scrub_ctx *scrub_ctx;
  94. /* readahead state */
  95. atomic_t reada_in_flight;
  96. u64 reada_next;
  97. struct reada_zone *reada_curr_zone;
  98. struct radix_tree_root reada_zones;
  99. struct radix_tree_root reada_extents;
  100. /* disk I/O failure stats. For detailed description refer to
  101. * enum btrfs_dev_stat_values in ioctl.h */
  102. int dev_stats_valid;
  103. /* Counter to record the change of device stats */
  104. atomic_t dev_stats_ccnt;
  105. atomic_t dev_stat_values[BTRFS_DEV_STAT_VALUES_MAX];
  106. struct extent_io_tree alloc_state;
  107. struct completion kobj_unregister;
  108. /* For sysfs/FSID/devinfo/devid/ */
  109. struct kobject devid_kobj;
  110. };
  111. /*
  112. * If we read those variants at the context of their own lock, we needn't
  113. * use the following helpers, reading them directly is safe.
  114. */
  115. #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
  116. #define BTRFS_DEVICE_GETSET_FUNCS(name) \
  117. static inline u64 \
  118. btrfs_device_get_##name(const struct btrfs_device *dev) \
  119. { \
  120. u64 size; \
  121. unsigned int seq; \
  122. \
  123. do { \
  124. seq = read_seqcount_begin(&dev->data_seqcount); \
  125. size = dev->name; \
  126. } while (read_seqcount_retry(&dev->data_seqcount, seq)); \
  127. return size; \
  128. } \
  129. \
  130. static inline void \
  131. btrfs_device_set_##name(struct btrfs_device *dev, u64 size) \
  132. { \
  133. preempt_disable(); \
  134. write_seqcount_begin(&dev->data_seqcount); \
  135. dev->name = size; \
  136. write_seqcount_end(&dev->data_seqcount); \
  137. preempt_enable(); \
  138. }
  139. #elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPTION)
  140. #define BTRFS_DEVICE_GETSET_FUNCS(name) \
  141. static inline u64 \
  142. btrfs_device_get_##name(const struct btrfs_device *dev) \
  143. { \
  144. u64 size; \
  145. \
  146. preempt_disable(); \
  147. size = dev->name; \
  148. preempt_enable(); \
  149. return size; \
  150. } \
  151. \
  152. static inline void \
  153. btrfs_device_set_##name(struct btrfs_device *dev, u64 size) \
  154. { \
  155. preempt_disable(); \
  156. dev->name = size; \
  157. preempt_enable(); \
  158. }
  159. #else
  160. #define BTRFS_DEVICE_GETSET_FUNCS(name) \
  161. static inline u64 \
  162. btrfs_device_get_##name(const struct btrfs_device *dev) \
  163. { \
  164. return dev->name; \
  165. } \
  166. \
  167. static inline void \
  168. btrfs_device_set_##name(struct btrfs_device *dev, u64 size) \
  169. { \
  170. dev->name = size; \
  171. }
  172. #endif
  173. BTRFS_DEVICE_GETSET_FUNCS(total_bytes);
  174. BTRFS_DEVICE_GETSET_FUNCS(disk_total_bytes);
  175. BTRFS_DEVICE_GETSET_FUNCS(bytes_used);
  176. enum btrfs_chunk_allocation_policy {
  177. BTRFS_CHUNK_ALLOC_REGULAR,
  178. };
  179. struct btrfs_fs_devices {
  180. u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
  181. u8 metadata_uuid[BTRFS_FSID_SIZE];
  182. bool fsid_change;
  183. struct list_head fs_list;
  184. u64 num_devices;
  185. u64 open_devices;
  186. u64 rw_devices;
  187. u64 missing_devices;
  188. u64 total_rw_bytes;
  189. u64 total_devices;
  190. /* Highest generation number of seen devices */
  191. u64 latest_generation;
  192. struct block_device *latest_bdev;
  193. /* all of the devices in the FS, protected by a mutex
  194. * so we can safely walk it to write out the supers without
  195. * worrying about add/remove by the multi-device code.
  196. * Scrubbing super can kick off supers writing by holding
  197. * this mutex lock.
  198. */
  199. struct mutex device_list_mutex;
  200. /* List of all devices, protected by device_list_mutex */
  201. struct list_head devices;
  202. /*
  203. * Devices which can satisfy space allocation. Protected by
  204. * chunk_mutex
  205. */
  206. struct list_head alloc_list;
  207. struct list_head seed_list;
  208. bool seeding;
  209. int opened;
  210. /* set when we find or add a device that doesn't have the
  211. * nonrot flag set
  212. */
  213. bool rotating;
  214. struct btrfs_fs_info *fs_info;
  215. /* sysfs kobjects */
  216. struct kobject fsid_kobj;
  217. struct kobject *devices_kobj;
  218. struct kobject *devinfo_kobj;
  219. struct completion kobj_unregister;
  220. enum btrfs_chunk_allocation_policy chunk_alloc_policy;
  221. };
  222. #define BTRFS_BIO_INLINE_CSUM_SIZE 64
  223. #define BTRFS_MAX_DEVS(info) ((BTRFS_MAX_ITEM_SIZE(info) \
  224. - sizeof(struct btrfs_chunk)) \
  225. / sizeof(struct btrfs_stripe) + 1)
  226. #define BTRFS_MAX_DEVS_SYS_CHUNK ((BTRFS_SYSTEM_CHUNK_ARRAY_SIZE \
  227. - 2 * sizeof(struct btrfs_disk_key) \
  228. - 2 * sizeof(struct btrfs_chunk)) \
  229. / sizeof(struct btrfs_stripe) + 1)
  230. /*
  231. * we need the mirror number and stripe index to be passed around
  232. * the call chain while we are processing end_io (especially errors).
  233. * Really, what we need is a btrfs_bio structure that has this info
  234. * and is properly sized with its stripe array, but we're not there
  235. * quite yet. We have our own btrfs bioset, and all of the bios
  236. * we allocate are actually btrfs_io_bios. We'll cram as much of
  237. * struct btrfs_bio as we can into this over time.
  238. */
  239. struct btrfs_io_bio {
  240. unsigned int mirror_num;
  241. struct btrfs_device *device;
  242. u64 logical;
  243. u8 *csum;
  244. u8 csum_inline[BTRFS_BIO_INLINE_CSUM_SIZE];
  245. struct bvec_iter iter;
  246. /*
  247. * This member must come last, bio_alloc_bioset will allocate enough
  248. * bytes for entire btrfs_io_bio but relies on bio being last.
  249. */
  250. struct bio bio;
  251. };
  252. static inline struct btrfs_io_bio *btrfs_io_bio(struct bio *bio)
  253. {
  254. return container_of(bio, struct btrfs_io_bio, bio);
  255. }
  256. static inline void btrfs_io_bio_free_csum(struct btrfs_io_bio *io_bio)
  257. {
  258. if (io_bio->csum != io_bio->csum_inline) {
  259. kfree(io_bio->csum);
  260. io_bio->csum = NULL;
  261. }
  262. }
  263. struct btrfs_bio_stripe {
  264. struct btrfs_device *dev;
  265. u64 physical;
  266. u64 length; /* only used for discard mappings */
  267. };
  268. struct btrfs_bio {
  269. refcount_t refs;
  270. atomic_t stripes_pending;
  271. struct btrfs_fs_info *fs_info;
  272. u64 map_type; /* get from map_lookup->type */
  273. bio_end_io_t *end_io;
  274. struct bio *orig_bio;
  275. void *private;
  276. atomic_t error;
  277. int max_errors;
  278. int num_stripes;
  279. int mirror_num;
  280. int num_tgtdevs;
  281. int *tgtdev_map;
  282. /*
  283. * logical block numbers for the start of each stripe
  284. * The last one or two are p/q. These are sorted,
  285. * so raid_map[0] is the start of our full stripe
  286. */
  287. u64 *raid_map;
  288. struct btrfs_bio_stripe stripes[];
  289. };
  290. struct btrfs_device_info {
  291. struct btrfs_device *dev;
  292. u64 dev_offset;
  293. u64 max_avail;
  294. u64 total_avail;
  295. };
  296. struct btrfs_raid_attr {
  297. u8 sub_stripes; /* sub_stripes info for map */
  298. u8 dev_stripes; /* stripes per dev */
  299. u8 devs_max; /* max devs to use */
  300. u8 devs_min; /* min devs needed */
  301. u8 tolerated_failures; /* max tolerated fail devs */
  302. u8 devs_increment; /* ndevs has to be a multiple of this */
  303. u8 ncopies; /* how many copies to data has */
  304. u8 nparity; /* number of stripes worth of bytes to store
  305. * parity information */
  306. u8 mindev_error; /* error code if min devs requisite is unmet */
  307. const char raid_name[8]; /* name of the raid */
  308. u64 bg_flag; /* block group flag of the raid */
  309. };
  310. extern const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES];
  311. struct map_lookup {
  312. u64 type;
  313. int io_align;
  314. int io_width;
  315. u64 stripe_len;
  316. int num_stripes;
  317. int sub_stripes;
  318. int verified_stripes; /* For mount time dev extent verification */
  319. struct btrfs_bio_stripe stripes[];
  320. };
  321. #define map_lookup_size(n) (sizeof(struct map_lookup) + \
  322. (sizeof(struct btrfs_bio_stripe) * (n)))
  323. struct btrfs_balance_args;
  324. struct btrfs_balance_progress;
  325. struct btrfs_balance_control {
  326. struct btrfs_balance_args data;
  327. struct btrfs_balance_args meta;
  328. struct btrfs_balance_args sys;
  329. u64 flags;
  330. struct btrfs_balance_progress stat;
  331. };
  332. enum btrfs_map_op {
  333. BTRFS_MAP_READ,
  334. BTRFS_MAP_WRITE,
  335. BTRFS_MAP_DISCARD,
  336. BTRFS_MAP_GET_READ_MIRRORS,
  337. };
  338. static inline enum btrfs_map_op btrfs_op(struct bio *bio)
  339. {
  340. switch (bio_op(bio)) {
  341. case REQ_OP_DISCARD:
  342. return BTRFS_MAP_DISCARD;
  343. case REQ_OP_WRITE:
  344. return BTRFS_MAP_WRITE;
  345. default:
  346. WARN_ON_ONCE(1);
  347. fallthrough;
  348. case REQ_OP_READ:
  349. return BTRFS_MAP_READ;
  350. }
  351. }
  352. void btrfs_get_bbio(struct btrfs_bio *bbio);
  353. void btrfs_put_bbio(struct btrfs_bio *bbio);
  354. int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
  355. u64 logical, u64 *length,
  356. struct btrfs_bio **bbio_ret, int mirror_num);
  357. int btrfs_map_sblock(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
  358. u64 logical, u64 *length,
  359. struct btrfs_bio **bbio_ret);
  360. int btrfs_get_io_geometry(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
  361. u64 logical, u64 len, struct btrfs_io_geometry *io_geom);
  362. int btrfs_read_sys_array(struct btrfs_fs_info *fs_info);
  363. int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info);
  364. int btrfs_alloc_chunk(struct btrfs_trans_handle *trans, u64 type);
  365. void btrfs_mapping_tree_free(struct extent_map_tree *tree);
  366. blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
  367. int mirror_num);
  368. int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
  369. fmode_t flags, void *holder);
  370. struct btrfs_device *btrfs_scan_one_device(const char *path,
  371. fmode_t flags, void *holder);
  372. int btrfs_forget_devices(const char *path);
  373. void btrfs_close_devices(struct btrfs_fs_devices *fs_devices);
  374. void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices, int step);
  375. void btrfs_assign_next_active_device(struct btrfs_device *device,
  376. struct btrfs_device *this_dev);
  377. struct btrfs_device *btrfs_find_device_by_devspec(struct btrfs_fs_info *fs_info,
  378. u64 devid,
  379. const char *devpath);
  380. struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info,
  381. const u64 *devid,
  382. const u8 *uuid);
  383. void btrfs_free_device(struct btrfs_device *device);
  384. int btrfs_rm_device(struct btrfs_fs_info *fs_info,
  385. const char *device_path, u64 devid);
  386. void __exit btrfs_cleanup_fs_uuids(void);
  387. int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len);
  388. int btrfs_grow_device(struct btrfs_trans_handle *trans,
  389. struct btrfs_device *device, u64 new_size);
  390. struct btrfs_device *btrfs_find_device(struct btrfs_fs_devices *fs_devices,
  391. u64 devid, u8 *uuid, u8 *fsid, bool seed);
  392. int btrfs_shrink_device(struct btrfs_device *device, u64 new_size);
  393. int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *path);
  394. int btrfs_balance(struct btrfs_fs_info *fs_info,
  395. struct btrfs_balance_control *bctl,
  396. struct btrfs_ioctl_balance_args *bargs);
  397. void btrfs_describe_block_groups(u64 flags, char *buf, u32 size_buf);
  398. int btrfs_resume_balance_async(struct btrfs_fs_info *fs_info);
  399. int btrfs_recover_balance(struct btrfs_fs_info *fs_info);
  400. int btrfs_pause_balance(struct btrfs_fs_info *fs_info);
  401. int btrfs_cancel_balance(struct btrfs_fs_info *fs_info);
  402. int btrfs_create_uuid_tree(struct btrfs_fs_info *fs_info);
  403. int btrfs_uuid_scan_kthread(void *data);
  404. int btrfs_chunk_readonly(struct btrfs_fs_info *fs_info, u64 chunk_offset);
  405. int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes,
  406. u64 *start, u64 *max_avail);
  407. void btrfs_dev_stat_inc_and_print(struct btrfs_device *dev, int index);
  408. int btrfs_get_dev_stats(struct btrfs_fs_info *fs_info,
  409. struct btrfs_ioctl_get_dev_stats *stats);
  410. void btrfs_init_devices_late(struct btrfs_fs_info *fs_info);
  411. int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info);
  412. int btrfs_run_dev_stats(struct btrfs_trans_handle *trans);
  413. void btrfs_rm_dev_replace_remove_srcdev(struct btrfs_device *srcdev);
  414. void btrfs_rm_dev_replace_free_srcdev(struct btrfs_device *srcdev);
  415. void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev);
  416. int btrfs_is_parity_mirror(struct btrfs_fs_info *fs_info,
  417. u64 logical, u64 len);
  418. unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
  419. u64 logical);
  420. int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans,
  421. u64 chunk_offset, u64 chunk_size);
  422. int btrfs_remove_chunk(struct btrfs_trans_handle *trans, u64 chunk_offset);
  423. struct extent_map *btrfs_get_chunk_map(struct btrfs_fs_info *fs_info,
  424. u64 logical, u64 length);
  425. void btrfs_release_disk_super(struct btrfs_super_block *super);
  426. static inline void btrfs_dev_stat_inc(struct btrfs_device *dev,
  427. int index)
  428. {
  429. atomic_inc(dev->dev_stat_values + index);
  430. /*
  431. * This memory barrier orders stores updating statistics before stores
  432. * updating dev_stats_ccnt.
  433. *
  434. * It pairs with smp_rmb() in btrfs_run_dev_stats().
  435. */
  436. smp_mb__before_atomic();
  437. atomic_inc(&dev->dev_stats_ccnt);
  438. }
  439. static inline int btrfs_dev_stat_read(struct btrfs_device *dev,
  440. int index)
  441. {
  442. return atomic_read(dev->dev_stat_values + index);
  443. }
  444. static inline int btrfs_dev_stat_read_and_reset(struct btrfs_device *dev,
  445. int index)
  446. {
  447. int ret;
  448. ret = atomic_xchg(dev->dev_stat_values + index, 0);
  449. /*
  450. * atomic_xchg implies a full memory barriers as per atomic_t.txt:
  451. * - RMW operations that have a return value are fully ordered;
  452. *
  453. * This implicit memory barriers is paired with the smp_rmb in
  454. * btrfs_run_dev_stats
  455. */
  456. atomic_inc(&dev->dev_stats_ccnt);
  457. return ret;
  458. }
  459. static inline void btrfs_dev_stat_set(struct btrfs_device *dev,
  460. int index, unsigned long val)
  461. {
  462. atomic_set(dev->dev_stat_values + index, val);
  463. /*
  464. * This memory barrier orders stores updating statistics before stores
  465. * updating dev_stats_ccnt.
  466. *
  467. * It pairs with smp_rmb() in btrfs_run_dev_stats().
  468. */
  469. smp_mb__before_atomic();
  470. atomic_inc(&dev->dev_stats_ccnt);
  471. }
  472. /*
  473. * Convert block group flags (BTRFS_BLOCK_GROUP_*) to btrfs_raid_types, which
  474. * can be used as index to access btrfs_raid_array[].
  475. */
  476. static inline enum btrfs_raid_types btrfs_bg_flags_to_raid_index(u64 flags)
  477. {
  478. if (flags & BTRFS_BLOCK_GROUP_RAID10)
  479. return BTRFS_RAID_RAID10;
  480. else if (flags & BTRFS_BLOCK_GROUP_RAID1)
  481. return BTRFS_RAID_RAID1;
  482. else if (flags & BTRFS_BLOCK_GROUP_RAID1C3)
  483. return BTRFS_RAID_RAID1C3;
  484. else if (flags & BTRFS_BLOCK_GROUP_RAID1C4)
  485. return BTRFS_RAID_RAID1C4;
  486. else if (flags & BTRFS_BLOCK_GROUP_DUP)
  487. return BTRFS_RAID_DUP;
  488. else if (flags & BTRFS_BLOCK_GROUP_RAID0)
  489. return BTRFS_RAID_RAID0;
  490. else if (flags & BTRFS_BLOCK_GROUP_RAID5)
  491. return BTRFS_RAID_RAID5;
  492. else if (flags & BTRFS_BLOCK_GROUP_RAID6)
  493. return BTRFS_RAID_RAID6;
  494. return BTRFS_RAID_SINGLE; /* BTRFS_BLOCK_GROUP_SINGLE */
  495. }
  496. void btrfs_commit_device_sizes(struct btrfs_transaction *trans);
  497. struct list_head * __attribute_const__ btrfs_get_fs_uuids(void);
  498. bool btrfs_check_rw_degradable(struct btrfs_fs_info *fs_info,
  499. struct btrfs_device *failing_dev);
  500. void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info,
  501. struct block_device *bdev,
  502. const char *device_path);
  503. int btrfs_bg_type_to_factor(u64 flags);
  504. const char *btrfs_bg_type_to_raid_name(u64 flags);
  505. int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info);
  506. #endif