diff options
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index eb65fd808883..730aae3bc181 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -483,7 +483,6 @@ struct btrfs_csum_item { | |||
483 | #define BTRFS_BLOCK_GROUP_DUP (1 << 5) | 483 | #define BTRFS_BLOCK_GROUP_DUP (1 << 5) |
484 | #define BTRFS_BLOCK_GROUP_RAID10 (1 << 6) | 484 | #define BTRFS_BLOCK_GROUP_RAID10 (1 << 6) |
485 | 485 | ||
486 | |||
487 | struct btrfs_block_group_item { | 486 | struct btrfs_block_group_item { |
488 | __le64 used; | 487 | __le64 used; |
489 | __le64 chunk_objectid; | 488 | __le64 chunk_objectid; |
@@ -498,17 +497,40 @@ struct btrfs_space_info { | |||
498 | int full; | 497 | int full; |
499 | int force_alloc; | 498 | int force_alloc; |
500 | struct list_head list; | 499 | struct list_head list; |
500 | |||
501 | /* for block groups in our same type */ | ||
502 | struct list_head block_groups; | ||
503 | spinlock_t lock; | ||
504 | }; | ||
505 | |||
506 | struct btrfs_free_space { | ||
507 | struct rb_node bytes_index; | ||
508 | struct rb_node offset_index; | ||
509 | u64 offset; | ||
510 | u64 bytes; | ||
501 | }; | 511 | }; |
502 | 512 | ||
503 | struct btrfs_block_group_cache { | 513 | struct btrfs_block_group_cache { |
504 | struct btrfs_key key; | 514 | struct btrfs_key key; |
505 | struct btrfs_block_group_item item; | 515 | struct btrfs_block_group_item item; |
506 | struct btrfs_space_info *space_info; | ||
507 | spinlock_t lock; | 516 | spinlock_t lock; |
508 | u64 pinned; | 517 | u64 pinned; |
509 | u64 flags; | 518 | u64 flags; |
510 | int cached; | 519 | int cached; |
511 | int ro; | 520 | int ro; |
521 | int dirty; | ||
522 | |||
523 | struct btrfs_space_info *space_info; | ||
524 | |||
525 | /* free space cache stuff */ | ||
526 | struct rb_root free_space_bytes; | ||
527 | struct rb_root free_space_offset; | ||
528 | |||
529 | /* block group cache stuff */ | ||
530 | struct rb_node cache_node; | ||
531 | |||
532 | /* for block groups in the same raid type */ | ||
533 | struct list_head list; | ||
512 | }; | 534 | }; |
513 | 535 | ||
514 | struct btrfs_device; | 536 | struct btrfs_device; |
@@ -525,8 +547,10 @@ struct btrfs_fs_info { | |||
525 | struct btrfs_root *log_root_tree; | 547 | struct btrfs_root *log_root_tree; |
526 | struct radix_tree_root fs_roots_radix; | 548 | struct radix_tree_root fs_roots_radix; |
527 | 549 | ||
528 | struct extent_io_tree free_space_cache; | 550 | /* block group cache stuff */ |
529 | struct extent_io_tree block_group_cache; | 551 | spinlock_t block_group_cache_lock; |
552 | struct rb_root block_group_cache_tree; | ||
553 | |||
530 | struct extent_io_tree pinned_extents; | 554 | struct extent_io_tree pinned_extents; |
531 | struct extent_io_tree pending_del; | 555 | struct extent_io_tree pending_del; |
532 | struct extent_io_tree extent_ins; | 556 | struct extent_io_tree extent_ins; |
@@ -1814,4 +1838,18 @@ int btrfs_sync_fs(struct super_block *sb, int wait); | |||
1814 | int btrfs_check_acl(struct inode *inode, int mask); | 1838 | int btrfs_check_acl(struct inode *inode, int mask); |
1815 | int btrfs_init_acl(struct inode *inode, struct inode *dir); | 1839 | int btrfs_init_acl(struct inode *inode, struct inode *dir); |
1816 | int btrfs_acl_chmod(struct inode *inode); | 1840 | int btrfs_acl_chmod(struct inode *inode); |
1841 | |||
1842 | /* free-space-cache.c */ | ||
1843 | int btrfs_add_free_space(struct btrfs_block_group_cache *block_group, | ||
1844 | u64 bytenr, u64 size); | ||
1845 | int btrfs_remove_free_space(struct btrfs_block_group_cache *block_group, | ||
1846 | u64 bytenr, u64 size); | ||
1847 | void btrfs_remove_free_space_cache(struct btrfs_block_group_cache | ||
1848 | *block_group); | ||
1849 | struct btrfs_free_space *btrfs_find_free_space(struct btrfs_block_group_cache | ||
1850 | *block_group, u64 offset, | ||
1851 | u64 bytes); | ||
1852 | void btrfs_dump_free_space(struct btrfs_block_group_cache *block_group, | ||
1853 | u64 bytes); | ||
1854 | u64 btrfs_block_group_free_space(struct btrfs_block_group_cache *block_group); | ||
1817 | #endif | 1855 | #endif |