diff options
Diffstat (limited to 'mm/tiny-shmem.c')
-rw-r--r-- | mm/tiny-shmem.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/mm/tiny-shmem.c b/mm/tiny-shmem.c index ae532f501943..8d7a27a6335c 100644 --- a/mm/tiny-shmem.c +++ b/mm/tiny-shmem.c | |||
@@ -65,31 +65,31 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags) | |||
65 | if (!dentry) | 65 | if (!dentry) |
66 | goto put_memory; | 66 | goto put_memory; |
67 | 67 | ||
68 | error = -ENFILE; | ||
69 | file = get_empty_filp(); | ||
70 | if (!file) | ||
71 | goto put_dentry; | ||
72 | |||
68 | error = -ENOSPC; | 73 | error = -ENOSPC; |
69 | inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0); | 74 | inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0); |
70 | if (!inode) | 75 | if (!inode) |
71 | goto put_dentry; | 76 | goto close_file; |
72 | 77 | ||
73 | d_instantiate(dentry, inode); | 78 | d_instantiate(dentry, inode); |
74 | error = -ENFILE; | 79 | inode->i_size = size; |
75 | file = alloc_file(shm_mnt, dentry, FMODE_WRITE | FMODE_READ, | ||
76 | &ramfs_file_operations); | ||
77 | if (!file) | ||
78 | goto put_dentry; | ||
79 | |||
80 | inode->i_nlink = 0; /* It is unlinked */ | 80 | inode->i_nlink = 0; /* It is unlinked */ |
81 | init_file(file, shm_mnt, dentry, FMODE_WRITE | FMODE_READ, | ||
82 | &ramfs_file_operations); | ||
81 | 83 | ||
82 | /* notify everyone as to the change of file size */ | 84 | #ifndef CONFIG_MMU |
83 | error = do_truncate(dentry, size, 0, file); | 85 | error = ramfs_nommu_expand_for_mapping(inode, size); |
84 | if (error < 0) | 86 | if (error) |
85 | goto close_file; | 87 | goto close_file; |
86 | 88 | #endif | |
87 | return file; | 89 | return file; |
88 | 90 | ||
89 | close_file: | 91 | close_file: |
90 | put_filp(file); | 92 | put_filp(file); |
91 | return ERR_PTR(error); | ||
92 | |||
93 | put_dentry: | 93 | put_dentry: |
94 | dput(dentry); | 94 | dput(dentry); |
95 | put_memory: | 95 | put_memory: |