diff options
author | David Sterba <dsterba@suse.cz> | 2011-04-13 09:41:04 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-11-06 03:04:01 -0500 |
commit | 6c41761fc6efe1503103a1afe03a6635c0b5d4ec (patch) | |
tree | 08ad34d43aac48e8f8143a0b1fa07141df8f202a /fs/btrfs/volumes.c | |
parent | c8174313a8102e874aaa321e2fc4c7c460a87151 (diff) |
btrfs: separate superblock items out of fs_info
fs_info has now ~9kb, more than fits into one page. This will cause
mount failure when memory is too fragmented. Top space consumers are
super block structures super_copy and super_for_commit, ~2.8kb each.
Allocate them dynamically. fs_info will be ~3.5kb. (measured on x86_64)
Add a wrapper for freeing fs_info and all of it's dynamically allocated
members.
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c6938b45e0fd..c3b45564048e 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1395,8 +1395,8 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1395 | call_rcu(&device->rcu, free_device); | 1395 | call_rcu(&device->rcu, free_device); |
1396 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | 1396 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); |
1397 | 1397 | ||
1398 | num_devices = btrfs_super_num_devices(&root->fs_info->super_copy) - 1; | 1398 | num_devices = btrfs_super_num_devices(root->fs_info->super_copy) - 1; |
1399 | btrfs_set_super_num_devices(&root->fs_info->super_copy, num_devices); | 1399 | btrfs_set_super_num_devices(root->fs_info->super_copy, num_devices); |
1400 | 1400 | ||
1401 | if (cur_devices->open_devices == 0) { | 1401 | if (cur_devices->open_devices == 0) { |
1402 | struct btrfs_fs_devices *fs_devices; | 1402 | struct btrfs_fs_devices *fs_devices; |
@@ -1458,7 +1458,7 @@ static int btrfs_prepare_sprout(struct btrfs_trans_handle *trans, | |||
1458 | struct btrfs_fs_devices *fs_devices = root->fs_info->fs_devices; | 1458 | struct btrfs_fs_devices *fs_devices = root->fs_info->fs_devices; |
1459 | struct btrfs_fs_devices *old_devices; | 1459 | struct btrfs_fs_devices *old_devices; |
1460 | struct btrfs_fs_devices *seed_devices; | 1460 | struct btrfs_fs_devices *seed_devices; |
1461 | struct btrfs_super_block *disk_super = &root->fs_info->super_copy; | 1461 | struct btrfs_super_block *disk_super = root->fs_info->super_copy; |
1462 | struct btrfs_device *device; | 1462 | struct btrfs_device *device; |
1463 | u64 super_flags; | 1463 | u64 super_flags; |
1464 | 1464 | ||
@@ -1706,12 +1706,12 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1706 | if (!blk_queue_nonrot(bdev_get_queue(bdev))) | 1706 | if (!blk_queue_nonrot(bdev_get_queue(bdev))) |
1707 | root->fs_info->fs_devices->rotating = 1; | 1707 | root->fs_info->fs_devices->rotating = 1; |
1708 | 1708 | ||
1709 | total_bytes = btrfs_super_total_bytes(&root->fs_info->super_copy); | 1709 | total_bytes = btrfs_super_total_bytes(root->fs_info->super_copy); |
1710 | btrfs_set_super_total_bytes(&root->fs_info->super_copy, | 1710 | btrfs_set_super_total_bytes(root->fs_info->super_copy, |
1711 | total_bytes + device->total_bytes); | 1711 | total_bytes + device->total_bytes); |
1712 | 1712 | ||
1713 | total_bytes = btrfs_super_num_devices(&root->fs_info->super_copy); | 1713 | total_bytes = btrfs_super_num_devices(root->fs_info->super_copy); |
1714 | btrfs_set_super_num_devices(&root->fs_info->super_copy, | 1714 | btrfs_set_super_num_devices(root->fs_info->super_copy, |
1715 | total_bytes + 1); | 1715 | total_bytes + 1); |
1716 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | 1716 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); |
1717 | 1717 | ||
@@ -1802,7 +1802,7 @@ static int __btrfs_grow_device(struct btrfs_trans_handle *trans, | |||
1802 | struct btrfs_device *device, u64 new_size) | 1802 | struct btrfs_device *device, u64 new_size) |
1803 | { | 1803 | { |
1804 | struct btrfs_super_block *super_copy = | 1804 | struct btrfs_super_block *super_copy = |
1805 | &device->dev_root->fs_info->super_copy; | 1805 | device->dev_root->fs_info->super_copy; |
1806 | u64 old_total = btrfs_super_total_bytes(super_copy); | 1806 | u64 old_total = btrfs_super_total_bytes(super_copy); |
1807 | u64 diff = new_size - device->total_bytes; | 1807 | u64 diff = new_size - device->total_bytes; |
1808 | 1808 | ||
@@ -1861,7 +1861,7 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans, | |||
1861 | static int btrfs_del_sys_chunk(struct btrfs_root *root, u64 chunk_objectid, u64 | 1861 | static int btrfs_del_sys_chunk(struct btrfs_root *root, u64 chunk_objectid, u64 |
1862 | chunk_offset) | 1862 | chunk_offset) |
1863 | { | 1863 | { |
1864 | struct btrfs_super_block *super_copy = &root->fs_info->super_copy; | 1864 | struct btrfs_super_block *super_copy = root->fs_info->super_copy; |
1865 | struct btrfs_disk_key *disk_key; | 1865 | struct btrfs_disk_key *disk_key; |
1866 | struct btrfs_chunk *chunk; | 1866 | struct btrfs_chunk *chunk; |
1867 | u8 *ptr; | 1867 | u8 *ptr; |
@@ -2187,7 +2187,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) | |||
2187 | bool retried = false; | 2187 | bool retried = false; |
2188 | struct extent_buffer *l; | 2188 | struct extent_buffer *l; |
2189 | struct btrfs_key key; | 2189 | struct btrfs_key key; |
2190 | struct btrfs_super_block *super_copy = &root->fs_info->super_copy; | 2190 | struct btrfs_super_block *super_copy = root->fs_info->super_copy; |
2191 | u64 old_total = btrfs_super_total_bytes(super_copy); | 2191 | u64 old_total = btrfs_super_total_bytes(super_copy); |
2192 | u64 old_size = device->total_bytes; | 2192 | u64 old_size = device->total_bytes; |
2193 | u64 diff = device->total_bytes - new_size; | 2193 | u64 diff = device->total_bytes - new_size; |
@@ -2311,7 +2311,7 @@ static int btrfs_add_system_chunk(struct btrfs_trans_handle *trans, | |||
2311 | struct btrfs_key *key, | 2311 | struct btrfs_key *key, |
2312 | struct btrfs_chunk *chunk, int item_size) | 2312 | struct btrfs_chunk *chunk, int item_size) |
2313 | { | 2313 | { |
2314 | struct btrfs_super_block *super_copy = &root->fs_info->super_copy; | 2314 | struct btrfs_super_block *super_copy = root->fs_info->super_copy; |
2315 | struct btrfs_disk_key disk_key; | 2315 | struct btrfs_disk_key disk_key; |
2316 | u32 array_size; | 2316 | u32 array_size; |
2317 | u8 *ptr; | 2317 | u8 *ptr; |
@@ -3653,7 +3653,7 @@ static int read_one_dev(struct btrfs_root *root, | |||
3653 | 3653 | ||
3654 | int btrfs_read_sys_array(struct btrfs_root *root) | 3654 | int btrfs_read_sys_array(struct btrfs_root *root) |
3655 | { | 3655 | { |
3656 | struct btrfs_super_block *super_copy = &root->fs_info->super_copy; | 3656 | struct btrfs_super_block *super_copy = root->fs_info->super_copy; |
3657 | struct extent_buffer *sb; | 3657 | struct extent_buffer *sb; |
3658 | struct btrfs_disk_key *disk_key; | 3658 | struct btrfs_disk_key *disk_key; |
3659 | struct btrfs_chunk *chunk; | 3659 | struct btrfs_chunk *chunk; |