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>
This commit is contained in:
committed by
Chris Mason
parent
c8174313a8
commit
6c41761fc6
@@ -282,7 +282,7 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)
|
||||
struct fstrim_range range;
|
||||
u64 minlen = ULLONG_MAX;
|
||||
u64 num_devices = 0;
|
||||
u64 total_bytes = btrfs_super_total_bytes(&root->fs_info->super_copy);
|
||||
u64 total_bytes = btrfs_super_total_bytes(root->fs_info->super_copy);
|
||||
int ret;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
@@ -1164,7 +1164,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
}
|
||||
|
||||
disk_super = &root->fs_info->super_copy;
|
||||
disk_super = root->fs_info->super_copy;
|
||||
features = btrfs_super_incompat_flags(disk_super);
|
||||
if (range->compress_type == BTRFS_COMPRESS_LZO) {
|
||||
features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO;
|
||||
@@ -2613,7 +2613,7 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
|
||||
return PTR_ERR(trans);
|
||||
}
|
||||
|
||||
dir_id = btrfs_super_root_dir(&root->fs_info->super_copy);
|
||||
dir_id = btrfs_super_root_dir(root->fs_info->super_copy);
|
||||
di = btrfs_lookup_dir_item(trans, root->fs_info->tree_root, path,
|
||||
dir_id, "default", 7, 1);
|
||||
if (IS_ERR_OR_NULL(di)) {
|
||||
@@ -2629,7 +2629,7 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
|
||||
btrfs_mark_buffer_dirty(path->nodes[0]);
|
||||
btrfs_free_path(path);
|
||||
|
||||
disk_super = &root->fs_info->super_copy;
|
||||
disk_super = root->fs_info->super_copy;
|
||||
features = btrfs_super_incompat_flags(disk_super);
|
||||
if (!(features & BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL)) {
|
||||
features |= BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL;
|
||||
|
Reference in New Issue
Block a user