aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorYan, Zheng <zheng.yan@oracle.com>2010-05-16 10:46:24 -0400
committerChris Mason <chris.mason@oracle.com>2010-05-25 10:34:47 -0400
commitb742bb82f1676d50103ade0ba89bfb79debabe73 (patch)
treeceac53988a3c158571fb91d54e3027403363fb47 /fs/btrfs/ctree.h
parente40152ee1e1c7a63f4777791863215e3faa37a86 (diff)
Btrfs: Link block groups of different raid types
The size of reserved space is stored in space_info. If block groups of different raid types are linked to separate space_info, changing allocation profile will corrupt reserved space accounting. Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 746a7248678e..6132088a577c 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -663,6 +663,7 @@ struct btrfs_csum_item {
663#define BTRFS_BLOCK_GROUP_RAID1 (1 << 4) 663#define BTRFS_BLOCK_GROUP_RAID1 (1 << 4)
664#define BTRFS_BLOCK_GROUP_DUP (1 << 5) 664#define BTRFS_BLOCK_GROUP_DUP (1 << 5)
665#define BTRFS_BLOCK_GROUP_RAID10 (1 << 6) 665#define BTRFS_BLOCK_GROUP_RAID10 (1 << 6)
666#define BTRFS_NR_RAID_TYPES 5
666 667
667struct btrfs_block_group_item { 668struct btrfs_block_group_item {
668 __le64 used; 669 __le64 used;
@@ -674,7 +675,8 @@ struct btrfs_space_info {
674 u64 flags; 675 u64 flags;
675 676
676 u64 total_bytes; /* total bytes in the space */ 677 u64 total_bytes; /* total bytes in the space */
677 u64 bytes_used; /* total bytes used on disk */ 678 u64 bytes_used; /* total bytes used,
679 this does't take mirrors into account */
678 u64 bytes_pinned; /* total bytes pinned, will be freed when the 680 u64 bytes_pinned; /* total bytes pinned, will be freed when the
679 transaction finishes */ 681 transaction finishes */
680 u64 bytes_reserved; /* total bytes the allocator has reserved for 682 u64 bytes_reserved; /* total bytes the allocator has reserved for
@@ -687,6 +689,7 @@ struct btrfs_space_info {
687 delalloc/allocations */ 689 delalloc/allocations */
688 u64 bytes_delalloc; /* number of bytes currently reserved for 690 u64 bytes_delalloc; /* number of bytes currently reserved for
689 delayed allocation */ 691 delayed allocation */
692 u64 disk_used; /* total bytes used on disk */
690 693
691 int full; /* indicates that we cannot allocate any more 694 int full; /* indicates that we cannot allocate any more
692 chunks for this space */ 695 chunks for this space */
@@ -704,7 +707,7 @@ struct btrfs_space_info {
704 int flushing; 707 int flushing;
705 708
706 /* for block groups in our same type */ 709 /* for block groups in our same type */
707 struct list_head block_groups; 710 struct list_head block_groups[BTRFS_NR_RAID_TYPES];
708 spinlock_t lock; 711 spinlock_t lock;
709 struct rw_semaphore groups_sem; 712 struct rw_semaphore groups_sem;
710 atomic_t caching_threads; 713 atomic_t caching_threads;