aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h150
1 files changed, 118 insertions, 32 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 547b7b05727f..0d82922179db 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -31,10 +31,10 @@
31#include <trace/events/btrfs.h> 31#include <trace/events/btrfs.h>
32#include <asm/kmap_types.h> 32#include <asm/kmap_types.h>
33#include <linux/pagemap.h> 33#include <linux/pagemap.h>
34#include <linux/btrfs.h>
34#include "extent_io.h" 35#include "extent_io.h"
35#include "extent_map.h" 36#include "extent_map.h"
36#include "async-thread.h" 37#include "async-thread.h"
37#include "ioctl.h"
38 38
39struct btrfs_trans_handle; 39struct btrfs_trans_handle;
40struct btrfs_transaction; 40struct btrfs_transaction;
@@ -46,7 +46,7 @@ extern struct kmem_cache *btrfs_path_cachep;
46extern struct kmem_cache *btrfs_free_space_cachep; 46extern struct kmem_cache *btrfs_free_space_cachep;
47struct btrfs_ordered_sum; 47struct btrfs_ordered_sum;
48 48
49#define BTRFS_MAGIC "_BHRfS_M" 49#define BTRFS_MAGIC 0x4D5F53665248425FULL /* ascii _BHRfS_M, no null */
50 50
51#define BTRFS_MAX_MIRRORS 3 51#define BTRFS_MAX_MIRRORS 3
52 52
@@ -191,6 +191,8 @@ static int btrfs_csum_sizes[] = { 4, 0 };
191/* ioprio of readahead is set to idle */ 191/* ioprio of readahead is set to idle */
192#define BTRFS_IOPRIO_READA (IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0)) 192#define BTRFS_IOPRIO_READA (IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0))
193 193
194#define BTRFS_DIRTY_METADATA_THRESH (32 * 1024 * 1024)
195
194/* 196/*
195 * The key defines the order in the tree, and so it also defines (optimal) 197 * The key defines the order in the tree, and so it also defines (optimal)
196 * block layout. 198 * block layout.
@@ -336,7 +338,10 @@ static inline unsigned long btrfs_chunk_item_size(int num_stripes)
336/* 338/*
337 * File system states 339 * File system states
338 */ 340 */
341#define BTRFS_FS_STATE_ERROR 0
342#define BTRFS_FS_STATE_REMOUNTING 1
339 343
344/* Super block flags */
340/* Errors detected */ 345/* Errors detected */
341#define BTRFS_SUPER_FLAG_ERROR (1ULL << 2) 346#define BTRFS_SUPER_FLAG_ERROR (1ULL << 2)
342 347
@@ -502,6 +507,7 @@ struct btrfs_super_block {
502#define BTRFS_FEATURE_INCOMPAT_BIG_METADATA (1ULL << 5) 507#define BTRFS_FEATURE_INCOMPAT_BIG_METADATA (1ULL << 5)
503 508
504#define BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF (1ULL << 6) 509#define BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF (1ULL << 6)
510#define BTRFS_FEATURE_INCOMPAT_RAID56 (1ULL << 7)
505 511
506#define BTRFS_FEATURE_COMPAT_SUPP 0ULL 512#define BTRFS_FEATURE_COMPAT_SUPP 0ULL
507#define BTRFS_FEATURE_COMPAT_RO_SUPP 0ULL 513#define BTRFS_FEATURE_COMPAT_RO_SUPP 0ULL
@@ -511,6 +517,7 @@ struct btrfs_super_block {
511 BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS | \ 517 BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS | \
512 BTRFS_FEATURE_INCOMPAT_BIG_METADATA | \ 518 BTRFS_FEATURE_INCOMPAT_BIG_METADATA | \
513 BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO | \ 519 BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO | \
520 BTRFS_FEATURE_INCOMPAT_RAID56 | \
514 BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF) 521 BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF)
515 522
516/* 523/*
@@ -952,8 +959,20 @@ struct btrfs_dev_replace_item {
952#define BTRFS_BLOCK_GROUP_RAID1 (1ULL << 4) 959#define BTRFS_BLOCK_GROUP_RAID1 (1ULL << 4)
953#define BTRFS_BLOCK_GROUP_DUP (1ULL << 5) 960#define BTRFS_BLOCK_GROUP_DUP (1ULL << 5)
954#define BTRFS_BLOCK_GROUP_RAID10 (1ULL << 6) 961#define BTRFS_BLOCK_GROUP_RAID10 (1ULL << 6)
962#define BTRFS_BLOCK_GROUP_RAID5 (1 << 7)
963#define BTRFS_BLOCK_GROUP_RAID6 (1 << 8)
955#define BTRFS_BLOCK_GROUP_RESERVED BTRFS_AVAIL_ALLOC_BIT_SINGLE 964#define BTRFS_BLOCK_GROUP_RESERVED BTRFS_AVAIL_ALLOC_BIT_SINGLE
956#define BTRFS_NR_RAID_TYPES 5 965
966enum btrfs_raid_types {
967 BTRFS_RAID_RAID10,
968 BTRFS_RAID_RAID1,
969 BTRFS_RAID_DUP,
970 BTRFS_RAID_RAID0,
971 BTRFS_RAID_SINGLE,
972 BTRFS_RAID_RAID5,
973 BTRFS_RAID_RAID6,
974 BTRFS_NR_RAID_TYPES
975};
957 976
958#define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | \ 977#define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | \
959 BTRFS_BLOCK_GROUP_SYSTEM | \ 978 BTRFS_BLOCK_GROUP_SYSTEM | \
@@ -961,6 +980,8 @@ struct btrfs_dev_replace_item {
961 980
962#define BTRFS_BLOCK_GROUP_PROFILE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \ 981#define BTRFS_BLOCK_GROUP_PROFILE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \
963 BTRFS_BLOCK_GROUP_RAID1 | \ 982 BTRFS_BLOCK_GROUP_RAID1 | \
983 BTRFS_BLOCK_GROUP_RAID5 | \
984 BTRFS_BLOCK_GROUP_RAID6 | \
964 BTRFS_BLOCK_GROUP_DUP | \ 985 BTRFS_BLOCK_GROUP_DUP | \
965 BTRFS_BLOCK_GROUP_RAID10) 986 BTRFS_BLOCK_GROUP_RAID10)
966/* 987/*
@@ -1185,6 +1206,10 @@ struct btrfs_block_group_cache {
1185 u64 flags; 1206 u64 flags;
1186 u64 sectorsize; 1207 u64 sectorsize;
1187 u64 cache_generation; 1208 u64 cache_generation;
1209
1210 /* for raid56, this is a full stripe, without parity */
1211 unsigned long full_stripe_len;
1212
1188 unsigned int ro:1; 1213 unsigned int ro:1;
1189 unsigned int dirty:1; 1214 unsigned int dirty:1;
1190 unsigned int iref:1; 1215 unsigned int iref:1;
@@ -1225,6 +1250,28 @@ struct seq_list {
1225 u64 seq; 1250 u64 seq;
1226}; 1251};
1227 1252
1253enum btrfs_orphan_cleanup_state {
1254 ORPHAN_CLEANUP_STARTED = 1,
1255 ORPHAN_CLEANUP_DONE = 2,
1256};
1257
1258/* used by the raid56 code to lock stripes for read/modify/write */
1259struct btrfs_stripe_hash {
1260 struct list_head hash_list;
1261 wait_queue_head_t wait;
1262 spinlock_t lock;
1263};
1264
1265/* used by the raid56 code to lock stripes for read/modify/write */
1266struct btrfs_stripe_hash_table {
1267 struct list_head stripe_cache;
1268 spinlock_t cache_lock;
1269 int cache_size;
1270 struct btrfs_stripe_hash table[];
1271};
1272
1273#define BTRFS_STRIPE_HASH_TABLE_BITS 11
1274
1228/* fs_info */ 1275/* fs_info */
1229struct reloc_control; 1276struct reloc_control;
1230struct btrfs_device; 1277struct btrfs_device;
@@ -1250,6 +1297,7 @@ struct btrfs_fs_info {
1250 1297
1251 /* block group cache stuff */ 1298 /* block group cache stuff */
1252 spinlock_t block_group_cache_lock; 1299 spinlock_t block_group_cache_lock;
1300 u64 first_logical_byte;
1253 struct rb_root block_group_cache_tree; 1301 struct rb_root block_group_cache_tree;
1254 1302
1255 /* keep track of unallocated space */ 1303 /* keep track of unallocated space */
@@ -1288,7 +1336,23 @@ struct btrfs_fs_info {
1288 u64 last_trans_log_full_commit; 1336 u64 last_trans_log_full_commit;
1289 unsigned long mount_opt; 1337 unsigned long mount_opt;
1290 unsigned long compress_type:4; 1338 unsigned long compress_type:4;
1339 /*
1340 * It is a suggestive number, the read side is safe even it gets a
1341 * wrong number because we will write out the data into a regular
1342 * extent. The write side(mount/remount) is under ->s_umount lock,
1343 * so it is also safe.
1344 */
1291 u64 max_inline; 1345 u64 max_inline;
1346 /*
1347 * Protected by ->chunk_mutex and sb->s_umount.
1348 *
1349 * The reason that we use two lock to protect it is because only
1350 * remount and mount operations can change it and these two operations
1351 * are under sb->s_umount, but the read side (chunk allocation) can not
1352 * acquire sb->s_umount or the deadlock would happen. So we use two
1353 * locks to protect it. On the write side, we must acquire two locks,
1354 * and on the read side, we just need acquire one of them.
1355 */
1292 u64 alloc_start; 1356 u64 alloc_start;
1293 struct btrfs_transaction *running_transaction; 1357 struct btrfs_transaction *running_transaction;
1294 wait_queue_head_t transaction_throttle; 1358 wait_queue_head_t transaction_throttle;
@@ -1307,6 +1371,13 @@ struct btrfs_fs_info {
1307 struct mutex cleaner_mutex; 1371 struct mutex cleaner_mutex;
1308 struct mutex chunk_mutex; 1372 struct mutex chunk_mutex;
1309 struct mutex volume_mutex; 1373 struct mutex volume_mutex;
1374
1375 /* this is used during read/modify/write to make sure
1376 * no two ios are trying to mod the same stripe at the same
1377 * time
1378 */
1379 struct btrfs_stripe_hash_table *stripe_hash_table;
1380
1310 /* 1381 /*
1311 * this protects the ordered operations list only while we are 1382 * this protects the ordered operations list only while we are
1312 * processing all of the entries on it. This way we make 1383 * processing all of the entries on it. This way we make
@@ -1365,6 +1436,7 @@ struct btrfs_fs_info {
1365 */ 1436 */
1366 struct list_head ordered_extents; 1437 struct list_head ordered_extents;
1367 1438
1439 spinlock_t delalloc_lock;
1368 /* 1440 /*
1369 * all of the inodes that have delalloc bytes. It is possible for 1441 * all of the inodes that have delalloc bytes. It is possible for
1370 * this list to be empty even when there is still dirty data=ordered 1442 * this list to be empty even when there is still dirty data=ordered
@@ -1373,13 +1445,6 @@ struct btrfs_fs_info {
1373 struct list_head delalloc_inodes; 1445 struct list_head delalloc_inodes;
1374 1446
1375 /* 1447 /*
1376 * special rename and truncate targets that must be on disk before
1377 * we're allowed to commit. This is basically the ext3 style
1378 * data=ordered list.
1379 */
1380 struct list_head ordered_operations;
1381
1382 /*
1383 * there is a pool of worker threads for checksumming during writes 1448 * there is a pool of worker threads for checksumming during writes
1384 * and a pool for checksumming after reads. This is because readers 1449 * and a pool for checksumming after reads. This is because readers
1385 * can run with FS locks held, and the writers may be waiting for 1450 * can run with FS locks held, and the writers may be waiting for
@@ -1395,6 +1460,8 @@ struct btrfs_fs_info {
1395 struct btrfs_workers flush_workers; 1460 struct btrfs_workers flush_workers;
1396 struct btrfs_workers endio_workers; 1461 struct btrfs_workers endio_workers;
1397 struct btrfs_workers endio_meta_workers; 1462 struct btrfs_workers endio_meta_workers;
1463 struct btrfs_workers endio_raid56_workers;
1464 struct btrfs_workers rmw_workers;
1398 struct btrfs_workers endio_meta_write_workers; 1465 struct btrfs_workers endio_meta_write_workers;
1399 struct btrfs_workers endio_write_workers; 1466 struct btrfs_workers endio_write_workers;
1400 struct btrfs_workers endio_freespace_worker; 1467 struct btrfs_workers endio_freespace_worker;
@@ -1423,10 +1490,12 @@ struct btrfs_fs_info {
1423 1490
1424 u64 total_pinned; 1491 u64 total_pinned;
1425 1492
1426 /* protected by the delalloc lock, used to keep from writing 1493 /* used to keep from writing metadata until there is a nice batch */
1427 * metadata until there is a nice batch 1494 struct percpu_counter dirty_metadata_bytes;
1428 */ 1495 struct percpu_counter delalloc_bytes;
1429 u64 dirty_metadata_bytes; 1496 s32 dirty_metadata_batch;
1497 s32 delalloc_batch;
1498
1430 struct list_head dirty_cowonly_roots; 1499 struct list_head dirty_cowonly_roots;
1431 1500
1432 struct btrfs_fs_devices *fs_devices; 1501 struct btrfs_fs_devices *fs_devices;
@@ -1442,9 +1511,6 @@ struct btrfs_fs_info {
1442 1511
1443 struct reloc_control *reloc_ctl; 1512 struct reloc_control *reloc_ctl;
1444 1513
1445 spinlock_t delalloc_lock;
1446 u64 delalloc_bytes;
1447
1448 /* data_alloc_cluster is only used in ssd mode */ 1514 /* data_alloc_cluster is only used in ssd mode */
1449 struct btrfs_free_cluster data_alloc_cluster; 1515 struct btrfs_free_cluster data_alloc_cluster;
1450 1516
@@ -1456,6 +1522,8 @@ struct btrfs_fs_info {
1456 struct rb_root defrag_inodes; 1522 struct rb_root defrag_inodes;
1457 atomic_t defrag_running; 1523 atomic_t defrag_running;
1458 1524
1525 /* Used to protect avail_{data, metadata, system}_alloc_bits */
1526 seqlock_t profiles_lock;
1459 /* 1527 /*
1460 * these three are in extended format (availability of single 1528 * these three are in extended format (availability of single
1461 * chunks is denoted by BTRFS_AVAIL_ALLOC_BIT_SINGLE bit, other 1529 * chunks is denoted by BTRFS_AVAIL_ALLOC_BIT_SINGLE bit, other
@@ -1520,7 +1588,7 @@ struct btrfs_fs_info {
1520 u64 qgroup_seq; 1588 u64 qgroup_seq;
1521 1589
1522 /* filesystem state */ 1590 /* filesystem state */
1523 u64 fs_state; 1591 unsigned long fs_state;
1524 1592
1525 struct btrfs_delayed_root *delayed_root; 1593 struct btrfs_delayed_root *delayed_root;
1526 1594
@@ -1623,6 +1691,9 @@ struct btrfs_root {
1623 1691
1624 struct list_head root_list; 1692 struct list_head root_list;
1625 1693
1694 spinlock_t log_extents_lock[2];
1695 struct list_head logged_list[2];
1696
1626 spinlock_t orphan_lock; 1697 spinlock_t orphan_lock;
1627 atomic_t orphan_inodes; 1698 atomic_t orphan_inodes;
1628 struct btrfs_block_rsv *orphan_block_rsv; 1699 struct btrfs_block_rsv *orphan_block_rsv;
@@ -1832,6 +1903,7 @@ struct btrfs_ioctl_defrag_range_args {
1832 1903
1833#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) 1904#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt)
1834#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) 1905#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt)
1906#define btrfs_raw_test_opt(o, opt) ((o) & BTRFS_MOUNT_##opt)
1835#define btrfs_test_opt(root, opt) ((root)->fs_info->mount_opt & \ 1907#define btrfs_test_opt(root, opt) ((root)->fs_info->mount_opt & \
1836 BTRFS_MOUNT_##opt) 1908 BTRFS_MOUNT_##opt)
1837/* 1909/*
@@ -2936,8 +3008,7 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
2936 u64 num_bytes, u64 *refs, u64 *flags); 3008 u64 num_bytes, u64 *refs, u64 *flags);
2937int btrfs_pin_extent(struct btrfs_root *root, 3009int btrfs_pin_extent(struct btrfs_root *root,
2938 u64 bytenr, u64 num, int reserved); 3010 u64 bytenr, u64 num, int reserved);
2939int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans, 3011int btrfs_pin_extent_for_log_replay(struct btrfs_root *root,
2940 struct btrfs_root *root,
2941 u64 bytenr, u64 num_bytes); 3012 u64 bytenr, u64 num_bytes);
2942int btrfs_cross_ref_exist(struct btrfs_trans_handle *trans, 3013int btrfs_cross_ref_exist(struct btrfs_trans_handle *trans,
2943 struct btrfs_root *root, 3014 struct btrfs_root *root,
@@ -3035,8 +3106,13 @@ void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans,
3035int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans, 3106int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans,
3036 struct inode *inode); 3107 struct inode *inode);
3037void btrfs_orphan_release_metadata(struct inode *inode); 3108void btrfs_orphan_release_metadata(struct inode *inode);
3038int btrfs_snap_reserve_metadata(struct btrfs_trans_handle *trans, 3109int btrfs_subvolume_reserve_metadata(struct btrfs_root *root,
3039 struct btrfs_pending_snapshot *pending); 3110 struct btrfs_block_rsv *rsv,
3111 int nitems,
3112 u64 *qgroup_reserved);
3113void btrfs_subvolume_release_metadata(struct btrfs_root *root,
3114 struct btrfs_block_rsv *rsv,
3115 u64 qgroup_reserved);
3040int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes); 3116int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes);
3041void btrfs_delalloc_release_metadata(struct inode *inode, u64 num_bytes); 3117void btrfs_delalloc_release_metadata(struct inode *inode, u64 num_bytes);
3042int btrfs_delalloc_reserve_space(struct inode *inode, u64 num_bytes); 3118int btrfs_delalloc_reserve_space(struct inode *inode, u64 num_bytes);
@@ -3092,10 +3168,10 @@ struct extent_buffer *btrfs_root_node(struct btrfs_root *root);
3092struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root); 3168struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root);
3093int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path, 3169int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path,
3094 struct btrfs_key *key, int lowest_level, 3170 struct btrfs_key *key, int lowest_level,
3095 int cache_only, u64 min_trans); 3171 u64 min_trans);
3096int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key, 3172int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
3097 struct btrfs_key *max_key, 3173 struct btrfs_key *max_key,
3098 struct btrfs_path *path, int cache_only, 3174 struct btrfs_path *path,
3099 u64 min_trans); 3175 u64 min_trans);
3100enum btrfs_compare_tree_result { 3176enum btrfs_compare_tree_result {
3101 BTRFS_COMPARE_TREE_NEW, 3177 BTRFS_COMPARE_TREE_NEW,
@@ -3148,7 +3224,7 @@ int btrfs_search_slot_for_read(struct btrfs_root *root,
3148 int find_higher, int return_any); 3224 int find_higher, int return_any);
3149int btrfs_realloc_node(struct btrfs_trans_handle *trans, 3225int btrfs_realloc_node(struct btrfs_trans_handle *trans,
3150 struct btrfs_root *root, struct extent_buffer *parent, 3226 struct btrfs_root *root, struct extent_buffer *parent,
3151 int start_slot, int cache_only, u64 *last_ret, 3227 int start_slot, u64 *last_ret,
3152 struct btrfs_key *progress); 3228 struct btrfs_key *progress);
3153void btrfs_release_path(struct btrfs_path *p); 3229void btrfs_release_path(struct btrfs_path *p);
3154struct btrfs_path *btrfs_alloc_path(void); 3230struct btrfs_path *btrfs_alloc_path(void);
@@ -3459,9 +3535,9 @@ int btrfs_writepages(struct address_space *mapping,
3459 struct writeback_control *wbc); 3535 struct writeback_control *wbc);
3460int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, 3536int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
3461 struct btrfs_root *new_root, u64 new_dirid); 3537 struct btrfs_root *new_root, u64 new_dirid);
3462int btrfs_merge_bio_hook(struct page *page, unsigned long offset, 3538int btrfs_merge_bio_hook(int rw, struct page *page, unsigned long offset,
3463 size_t size, struct bio *bio, unsigned long bio_flags); 3539 size_t size, struct bio *bio,
3464 3540 unsigned long bio_flags);
3465int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); 3541int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
3466int btrfs_readpage(struct file *file, struct page *page); 3542int btrfs_readpage(struct file *file, struct page *page);
3467void btrfs_evict_inode(struct inode *inode); 3543void btrfs_evict_inode(struct inode *inode);
@@ -3543,7 +3619,7 @@ int btrfs_dirty_pages(struct btrfs_root *root, struct inode *inode,
3543 3619
3544/* tree-defrag.c */ 3620/* tree-defrag.c */
3545int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, 3621int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
3546 struct btrfs_root *root, int cache_only); 3622 struct btrfs_root *root);
3547 3623
3548/* sysfs.c */ 3624/* sysfs.c */
3549int btrfs_init_sysfs(void); 3625int btrfs_init_sysfs(void);
@@ -3620,11 +3696,14 @@ __printf(5, 6)
3620void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, 3696void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function,
3621 unsigned int line, int errno, const char *fmt, ...); 3697 unsigned int line, int errno, const char *fmt, ...);
3622 3698
3699/*
3700 * If BTRFS_MOUNT_PANIC_ON_FATAL_ERROR is in mount_opt, __btrfs_panic
3701 * will panic(). Otherwise we BUG() here.
3702 */
3623#define btrfs_panic(fs_info, errno, fmt, args...) \ 3703#define btrfs_panic(fs_info, errno, fmt, args...) \
3624do { \ 3704do { \
3625 struct btrfs_fs_info *_i = (fs_info); \ 3705 __btrfs_panic(fs_info, __func__, __LINE__, errno, fmt, ##args); \
3626 __btrfs_panic(_i, __func__, __LINE__, errno, fmt, ##args); \ 3706 BUG(); \
3627 BUG_ON(!(_i->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR)); \
3628} while (0) 3707} while (0)
3629 3708
3630/* acl.c */ 3709/* acl.c */
@@ -3745,4 +3824,11 @@ static inline int is_fstree(u64 rootid)
3745 return 1; 3824 return 1;
3746 return 0; 3825 return 0;
3747} 3826}
3827
3828static inline int btrfs_defrag_cancelled(struct btrfs_fs_info *fs_info)
3829{
3830 return signal_pending(current);
3831}
3832
3833
3748#endif 3834#endif