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/ioctl.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/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 33aae13cc74b..8f6e14279409 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -282,7 +282,7 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg) | |||
282 | struct fstrim_range range; | 282 | struct fstrim_range range; |
283 | u64 minlen = ULLONG_MAX; | 283 | u64 minlen = ULLONG_MAX; |
284 | u64 num_devices = 0; | 284 | u64 num_devices = 0; |
285 | u64 total_bytes = btrfs_super_total_bytes(&root->fs_info->super_copy); | 285 | u64 total_bytes = btrfs_super_total_bytes(root->fs_info->super_copy); |
286 | int ret; | 286 | int ret; |
287 | 287 | ||
288 | if (!capable(CAP_SYS_ADMIN)) | 288 | if (!capable(CAP_SYS_ADMIN)) |
@@ -1164,7 +1164,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file, | |||
1164 | mutex_unlock(&inode->i_mutex); | 1164 | mutex_unlock(&inode->i_mutex); |
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | disk_super = &root->fs_info->super_copy; | 1167 | disk_super = root->fs_info->super_copy; |
1168 | features = btrfs_super_incompat_flags(disk_super); | 1168 | features = btrfs_super_incompat_flags(disk_super); |
1169 | if (range->compress_type == BTRFS_COMPRESS_LZO) { | 1169 | if (range->compress_type == BTRFS_COMPRESS_LZO) { |
1170 | features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO; | 1170 | features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO; |
@@ -2613,7 +2613,7 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp) | |||
2613 | return PTR_ERR(trans); | 2613 | return PTR_ERR(trans); |
2614 | } | 2614 | } |
2615 | 2615 | ||
2616 | dir_id = btrfs_super_root_dir(&root->fs_info->super_copy); | 2616 | dir_id = btrfs_super_root_dir(root->fs_info->super_copy); |
2617 | di = btrfs_lookup_dir_item(trans, root->fs_info->tree_root, path, | 2617 | di = btrfs_lookup_dir_item(trans, root->fs_info->tree_root, path, |
2618 | dir_id, "default", 7, 1); | 2618 | dir_id, "default", 7, 1); |
2619 | if (IS_ERR_OR_NULL(di)) { | 2619 | if (IS_ERR_OR_NULL(di)) { |
@@ -2629,7 +2629,7 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp) | |||
2629 | btrfs_mark_buffer_dirty(path->nodes[0]); | 2629 | btrfs_mark_buffer_dirty(path->nodes[0]); |
2630 | btrfs_free_path(path); | 2630 | btrfs_free_path(path); |
2631 | 2631 | ||
2632 | disk_super = &root->fs_info->super_copy; | 2632 | disk_super = root->fs_info->super_copy; |
2633 | features = btrfs_super_incompat_flags(disk_super); | 2633 | features = btrfs_super_incompat_flags(disk_super); |
2634 | if (!(features & BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL)) { | 2634 | if (!(features & BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL)) { |
2635 | features |= BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL; | 2635 | features |= BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL; |