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.h46
1 files changed, 43 insertions, 3 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index f9c89cae39ee..6f364e1d8d3d 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1061,6 +1061,12 @@ struct btrfs_block_group_item {
1061 __le64 flags; 1061 __le64 flags;
1062} __attribute__ ((__packed__)); 1062} __attribute__ ((__packed__));
1063 1063
1064#define BTRFS_QGROUP_LEVEL_SHIFT 48
1065static inline u64 btrfs_qgroup_level(u64 qgroupid)
1066{
1067 return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT;
1068}
1069
1064/* 1070/*
1065 * is subvolume quota turned on? 1071 * is subvolume quota turned on?
1066 */ 1072 */
@@ -1256,6 +1262,20 @@ struct btrfs_caching_control {
1256 atomic_t count; 1262 atomic_t count;
1257}; 1263};
1258 1264
1265struct btrfs_io_ctl {
1266 void *cur, *orig;
1267 struct page *page;
1268 struct page **pages;
1269 struct btrfs_root *root;
1270 struct inode *inode;
1271 unsigned long size;
1272 int index;
1273 int num_pages;
1274 int entries;
1275 int bitmaps;
1276 unsigned check_crcs:1;
1277};
1278
1259struct btrfs_block_group_cache { 1279struct btrfs_block_group_cache {
1260 struct btrfs_key key; 1280 struct btrfs_key key;
1261 struct btrfs_block_group_item item; 1281 struct btrfs_block_group_item item;
@@ -1321,6 +1341,9 @@ struct btrfs_block_group_cache {
1321 1341
1322 /* For dirty block groups */ 1342 /* For dirty block groups */
1323 struct list_head dirty_list; 1343 struct list_head dirty_list;
1344 struct list_head io_list;
1345
1346 struct btrfs_io_ctl io_ctl;
1324}; 1347};
1325 1348
1326/* delayed seq elem */ 1349/* delayed seq elem */
@@ -1329,6 +1352,8 @@ struct seq_list {
1329 u64 seq; 1352 u64 seq;
1330}; 1353};
1331 1354
1355#define SEQ_LIST_INIT(name) { .list = LIST_HEAD_INIT((name).list), .seq = 0 }
1356
1332enum btrfs_orphan_cleanup_state { 1357enum btrfs_orphan_cleanup_state {
1333 ORPHAN_CLEANUP_STARTED = 1, 1358 ORPHAN_CLEANUP_STARTED = 1,
1334 ORPHAN_CLEANUP_DONE = 2, 1359 ORPHAN_CLEANUP_DONE = 2,
@@ -1472,6 +1497,12 @@ struct btrfs_fs_info {
1472 struct mutex chunk_mutex; 1497 struct mutex chunk_mutex;
1473 struct mutex volume_mutex; 1498 struct mutex volume_mutex;
1474 1499
1500 /*
1501 * this is taken to make sure we don't set block groups ro after
1502 * the free space cache has been allocated on them
1503 */
1504 struct mutex ro_block_group_mutex;
1505
1475 /* this is used during read/modify/write to make sure 1506 /* this is used during read/modify/write to make sure
1476 * no two ios are trying to mod the same stripe at the same 1507 * no two ios are trying to mod the same stripe at the same
1477 * time 1508 * time
@@ -1513,6 +1544,7 @@ struct btrfs_fs_info {
1513 1544
1514 spinlock_t delayed_iput_lock; 1545 spinlock_t delayed_iput_lock;
1515 struct list_head delayed_iputs; 1546 struct list_head delayed_iputs;
1547 struct rw_semaphore delayed_iput_sem;
1516 1548
1517 /* this protects tree_mod_seq_list */ 1549 /* this protects tree_mod_seq_list */
1518 spinlock_t tree_mod_seq_lock; 1550 spinlock_t tree_mod_seq_lock;
@@ -3295,6 +3327,9 @@ static inline gfp_t btrfs_alloc_write_mask(struct address_space *mapping)
3295} 3327}
3296 3328
3297/* extent-tree.c */ 3329/* extent-tree.c */
3330
3331u64 btrfs_csum_bytes_to_leaves(struct btrfs_root *root, u64 csum_bytes);
3332
3298static inline u64 btrfs_calc_trans_metadata_size(struct btrfs_root *root, 3333static inline u64 btrfs_calc_trans_metadata_size(struct btrfs_root *root,
3299 unsigned num_items) 3334 unsigned num_items)
3300{ 3335{
@@ -3385,6 +3420,8 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
3385 u64 bytenr, u64 num_bytes, u64 parent, 3420 u64 bytenr, u64 num_bytes, u64 parent,
3386 u64 root_objectid, u64 owner, u64 offset, int no_quota); 3421 u64 root_objectid, u64 owner, u64 offset, int no_quota);
3387 3422
3423int btrfs_start_dirty_block_groups(struct btrfs_trans_handle *trans,
3424 struct btrfs_root *root);
3388int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans, 3425int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans,
3389 struct btrfs_root *root); 3426 struct btrfs_root *root);
3390int btrfs_setup_space_cache(struct btrfs_trans_handle *trans, 3427int btrfs_setup_space_cache(struct btrfs_trans_handle *trans,
@@ -3417,7 +3454,7 @@ enum btrfs_reserve_flush_enum {
3417 BTRFS_RESERVE_FLUSH_ALL, 3454 BTRFS_RESERVE_FLUSH_ALL,
3418}; 3455};
3419 3456
3420int btrfs_check_data_free_space(struct inode *inode, u64 bytes); 3457int btrfs_check_data_free_space(struct inode *inode, u64 bytes, u64 write_bytes);
3421void btrfs_free_reserved_data_space(struct inode *inode, u64 bytes); 3458void btrfs_free_reserved_data_space(struct inode *inode, u64 bytes);
3422void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans, 3459void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans,
3423 struct btrfs_root *root); 3460 struct btrfs_root *root);
@@ -3440,6 +3477,7 @@ struct btrfs_block_rsv *btrfs_alloc_block_rsv(struct btrfs_root *root,
3440 unsigned short type); 3477 unsigned short type);
3441void btrfs_free_block_rsv(struct btrfs_root *root, 3478void btrfs_free_block_rsv(struct btrfs_root *root,
3442 struct btrfs_block_rsv *rsv); 3479 struct btrfs_block_rsv *rsv);
3480void __btrfs_free_block_rsv(struct btrfs_block_rsv *rsv);
3443int btrfs_block_rsv_add(struct btrfs_root *root, 3481int btrfs_block_rsv_add(struct btrfs_root *root,
3444 struct btrfs_block_rsv *block_rsv, u64 num_bytes, 3482 struct btrfs_block_rsv *block_rsv, u64 num_bytes,
3445 enum btrfs_reserve_flush_enum flush); 3483 enum btrfs_reserve_flush_enum flush);
@@ -3486,7 +3524,8 @@ int btrfs_previous_item(struct btrfs_root *root,
3486 int type); 3524 int type);
3487int btrfs_previous_extent_item(struct btrfs_root *root, 3525int btrfs_previous_extent_item(struct btrfs_root *root,
3488 struct btrfs_path *path, u64 min_objectid); 3526 struct btrfs_path *path, u64 min_objectid);
3489void btrfs_set_item_key_safe(struct btrfs_root *root, struct btrfs_path *path, 3527void btrfs_set_item_key_safe(struct btrfs_fs_info *fs_info,
3528 struct btrfs_path *path,
3490 struct btrfs_key *new_key); 3529 struct btrfs_key *new_key);
3491struct extent_buffer *btrfs_root_node(struct btrfs_root *root); 3530struct extent_buffer *btrfs_root_node(struct btrfs_root *root);
3492struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root); 3531struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root);
@@ -4180,7 +4219,8 @@ int btree_readahead_hook(struct btrfs_root *root, struct extent_buffer *eb,
4180static inline int is_fstree(u64 rootid) 4219static inline int is_fstree(u64 rootid)
4181{ 4220{
4182 if (rootid == BTRFS_FS_TREE_OBJECTID || 4221 if (rootid == BTRFS_FS_TREE_OBJECTID ||
4183 (s64)rootid >= (s64)BTRFS_FIRST_FREE_OBJECTID) 4222 ((s64)rootid >= (s64)BTRFS_FIRST_FREE_OBJECTID &&
4223 !btrfs_qgroup_level(rootid)))
4184 return 1; 4224 return 1;
4185 return 0; 4225 return 0;
4186} 4226}