On Thu,  2 Jun 2011 18:13:22 +0200
David Sterba <dste...@suse.cz> wrote:

> fs_info is 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.
> 
> Signed-off-by: David Sterba <dste...@suse.cz>
> ---
...
> @@ -801,6 +800,15 @@ static struct dentry *btrfs_mount(struct 
> file_system_type *fs_type, int flags,
>       fs_info->fs_devices = fs_devices;
>       tree_root->fs_info = fs_info;
>  
> +     fs_info->super_copy = kzalloc(sizeof(struct btrfs_super_block),
> +                     GFP_NOFS);
> +     fs_info->super_for_commit = kzalloc(sizeof(struct btrfs_super_block),
> +                     GFP_NOFS);

In light of 
http://thread.gmane.org/gmane.comp.file-systems.btrfs/11004/focus=11038
what do you think of allocating BTRFS_SUPER_INFO_SIZE instead of sizeof?

> +     if (!fs_info->super_copy || !fs_info->super_for_commit) {
> +             error = -ENOMEM;
> +             goto error_close_devices;
> +     }
> +
>       bdev = fs_devices->latest_bdev;
>       s = sget(fs_type, btrfs_test_super, btrfs_set_super, tree_root);
>       if (IS_ERR(s))

-- 

  Sergei

Attachment: signature.asc
Description: PGP signature

Reply via email to