aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-04 15:40:00 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:01 -0400
commitd18a2c447524751137a12cc8ccaf9d1e0b7fa1b3 (patch)
treef331995fdac5f2550c8c3fccf74a94a66d642893
parent6bc34676c0b5836655ec1c7998e2647cabb933ec (diff)
Btrfs: Fix allocation profile init
Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r--fs/btrfs/ctree.h13
-rw-r--r--fs/btrfs/disk-io.c11
-rw-r--r--fs/btrfs/extent-tree.c10
3 files changed, 13 insertions, 21 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 72deae63ec28..4b3b20459f6e 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -506,12 +506,13 @@ struct btrfs_fs_info {
506 u64 delalloc_bytes; 506 u64 delalloc_bytes;
507 u64 last_alloc; 507 u64 last_alloc;
508 u64 last_data_alloc; 508 u64 last_data_alloc;
509 int avail_data_alloc_bits; 509
510 int avail_metadata_alloc_bits; 510 u64 avail_data_alloc_bits;
511 int avail_system_alloc_bits; 511 u64 avail_metadata_alloc_bits;
512 int data_alloc_profile; 512 u64 avail_system_alloc_bits;
513 int metadata_alloc_profile; 513 u64 data_alloc_profile;
514 int system_alloc_profile; 514 u64 metadata_alloc_profile;
515 u64 system_alloc_profile;
515}; 516};
516 517
517/* 518/*
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 42522232fde4..bc5bd5abb28a 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -912,13 +912,10 @@ struct btrfs_root *open_ctree(struct super_block *sb,
912 btrfs_read_block_groups(extent_root); 912 btrfs_read_block_groups(extent_root);
913 913
914 fs_info->generation = btrfs_super_generation(disk_super) + 1; 914 fs_info->generation = btrfs_super_generation(disk_super) + 1;
915 if (btrfs_super_num_devices(disk_super) > 0) { 915 fs_info->data_alloc_profile = (u64)-1;
916 fs_info->data_alloc_profile = BTRFS_BLOCK_GROUP_RAID0 | 916 fs_info->metadata_alloc_profile = (u64)-1;
917 BTRFS_BLOCK_GROUP_RAID1; 917 fs_info->system_alloc_profile = fs_info->metadata_alloc_profile;
918 fs_info->metadata_alloc_profile = BTRFS_BLOCK_GROUP_RAID1 | 918
919 BTRFS_BLOCK_GROUP_DUP;
920 fs_info->system_alloc_profile = fs_info->metadata_alloc_profile;
921 }
922 mutex_unlock(&fs_info->fs_mutex); 919 mutex_unlock(&fs_info->fs_mutex);
923 return tree_root; 920 return tree_root;
924 921
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 0c0dde6d9614..0cb742884cdf 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1100,7 +1100,6 @@ printk("space info full %Lu\n", flags);
1100 start, num_bytes); 1100 start, num_bytes);
1101 BUG_ON(ret); 1101 BUG_ON(ret);
1102 1102
1103 set_avail_alloc_bits(extent_root->fs_info, flags);
1104 return 0; 1103 return 0;
1105} 1104}
1106 1105
@@ -2813,13 +2812,7 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans,
2813 &cache->space_info); 2812 &cache->space_info);
2814 BUG_ON(ret); 2813 BUG_ON(ret);
2815 2814
2816 if (type & BTRFS_BLOCK_GROUP_DATA) { 2815 bit = block_group_state_bits(type);
2817 bit = BLOCK_GROUP_DATA;
2818 } else if (type & BTRFS_BLOCK_GROUP_SYSTEM) {
2819 bit = BLOCK_GROUP_SYSTEM;
2820 } else if (type & BTRFS_BLOCK_GROUP_METADATA) {
2821 bit = BLOCK_GROUP_METADATA;
2822 }
2823 set_extent_bits(block_group_cache, chunk_objectid, 2816 set_extent_bits(block_group_cache, chunk_objectid,
2824 chunk_objectid + size - 1, 2817 chunk_objectid + size - 1,
2825 bit | EXTENT_LOCKED, GFP_NOFS); 2818 bit | EXTENT_LOCKED, GFP_NOFS);
@@ -2833,5 +2826,6 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans,
2833 finish_current_insert(trans, extent_root); 2826 finish_current_insert(trans, extent_root);
2834 ret = del_pending_extents(trans, extent_root); 2827 ret = del_pending_extents(trans, extent_root);
2835 BUG_ON(ret); 2828 BUG_ON(ret);
2829 set_avail_alloc_bits(extent_root->fs_info, type);
2836 return 0; 2830 return 0;
2837} 2831}