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