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/file-item.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/file-item.c')
-rw-r--r-- | fs/btrfs/file-item.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index a1cb7821becd..c7fb3a4247d3 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -91,8 +91,7 @@ struct btrfs_csum_item *btrfs_lookup_csum(struct btrfs_trans_handle *trans, | |||
91 | struct btrfs_csum_item *item; | 91 | struct btrfs_csum_item *item; |
92 | struct extent_buffer *leaf; | 92 | struct extent_buffer *leaf; |
93 | u64 csum_offset = 0; | 93 | u64 csum_offset = 0; |
94 | u16 csum_size = | 94 | u16 csum_size = btrfs_super_csum_size(root->fs_info->super_copy); |
95 | btrfs_super_csum_size(&root->fs_info->super_copy); | ||
96 | int csums_in_item; | 95 | int csums_in_item; |
97 | 96 | ||
98 | file_key.objectid = BTRFS_EXTENT_CSUM_OBJECTID; | 97 | file_key.objectid = BTRFS_EXTENT_CSUM_OBJECTID; |
@@ -162,8 +161,7 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root, | |||
162 | u64 item_last_offset = 0; | 161 | u64 item_last_offset = 0; |
163 | u64 disk_bytenr; | 162 | u64 disk_bytenr; |
164 | u32 diff; | 163 | u32 diff; |
165 | u16 csum_size = | 164 | u16 csum_size = btrfs_super_csum_size(root->fs_info->super_copy); |
166 | btrfs_super_csum_size(&root->fs_info->super_copy); | ||
167 | int ret; | 165 | int ret; |
168 | struct btrfs_path *path; | 166 | struct btrfs_path *path; |
169 | struct btrfs_csum_item *item = NULL; | 167 | struct btrfs_csum_item *item = NULL; |
@@ -290,7 +288,7 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, | |||
290 | int ret; | 288 | int ret; |
291 | size_t size; | 289 | size_t size; |
292 | u64 csum_end; | 290 | u64 csum_end; |
293 | u16 csum_size = btrfs_super_csum_size(&root->fs_info->super_copy); | 291 | u16 csum_size = btrfs_super_csum_size(root->fs_info->super_copy); |
294 | 292 | ||
295 | path = btrfs_alloc_path(); | 293 | path = btrfs_alloc_path(); |
296 | if (!path) | 294 | if (!path) |
@@ -492,8 +490,7 @@ static noinline int truncate_one_csum(struct btrfs_trans_handle *trans, | |||
492 | u64 bytenr, u64 len) | 490 | u64 bytenr, u64 len) |
493 | { | 491 | { |
494 | struct extent_buffer *leaf; | 492 | struct extent_buffer *leaf; |
495 | u16 csum_size = | 493 | u16 csum_size = btrfs_super_csum_size(root->fs_info->super_copy); |
496 | btrfs_super_csum_size(&root->fs_info->super_copy); | ||
497 | u64 csum_end; | 494 | u64 csum_end; |
498 | u64 end_byte = bytenr + len; | 495 | u64 end_byte = bytenr + len; |
499 | u32 blocksize_bits = root->fs_info->sb->s_blocksize_bits; | 496 | u32 blocksize_bits = root->fs_info->sb->s_blocksize_bits; |
@@ -549,8 +546,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, | |||
549 | u64 csum_end; | 546 | u64 csum_end; |
550 | struct extent_buffer *leaf; | 547 | struct extent_buffer *leaf; |
551 | int ret; | 548 | int ret; |
552 | u16 csum_size = | 549 | u16 csum_size = btrfs_super_csum_size(root->fs_info->super_copy); |
553 | btrfs_super_csum_size(&root->fs_info->super_copy); | ||
554 | int blocksize_bits = root->fs_info->sb->s_blocksize_bits; | 550 | int blocksize_bits = root->fs_info->sb->s_blocksize_bits; |
555 | 551 | ||
556 | root = root->fs_info->csum_root; | 552 | root = root->fs_info->csum_root; |
@@ -676,8 +672,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, | |||
676 | struct btrfs_sector_sum *sector_sum; | 672 | struct btrfs_sector_sum *sector_sum; |
677 | u32 nritems; | 673 | u32 nritems; |
678 | u32 ins_size; | 674 | u32 ins_size; |
679 | u16 csum_size = | 675 | u16 csum_size = btrfs_super_csum_size(root->fs_info->super_copy); |
680 | btrfs_super_csum_size(&root->fs_info->super_copy); | ||
681 | 676 | ||
682 | path = btrfs_alloc_path(); | 677 | path = btrfs_alloc_path(); |
683 | if (!path) | 678 | if (!path) |