diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/shmem.c | 7 | ||||
-rw-r--r-- | mm/tiny-shmem.c | 19 |
2 files changed, 9 insertions, 17 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 6fa20a84daa0..289dbb0a6fd6 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2543,11 +2543,8 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags) | |||
2543 | d_instantiate(dentry, inode); | 2543 | d_instantiate(dentry, inode); |
2544 | inode->i_size = size; | 2544 | inode->i_size = size; |
2545 | inode->i_nlink = 0; /* It is unlinked */ | 2545 | inode->i_nlink = 0; /* It is unlinked */ |
2546 | file->f_path.mnt = mntget(shm_mnt); | 2546 | init_file(file, shm_mnt, dentry, FMODE_WRITE | FMODE_READ, |
2547 | file->f_path.dentry = dentry; | 2547 | &shmem_file_operations); |
2548 | file->f_mapping = inode->i_mapping; | ||
2549 | file->f_op = &shmem_file_operations; | ||
2550 | file->f_mode = FMODE_WRITE | FMODE_READ; | ||
2551 | return file; | 2548 | return file; |
2552 | 2549 | ||
2553 | close_file: | 2550 | close_file: |
diff --git a/mm/tiny-shmem.c b/mm/tiny-shmem.c index 8803471593fd..d436a9c82db7 100644 --- a/mm/tiny-shmem.c +++ b/mm/tiny-shmem.c | |||
@@ -66,24 +66,19 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags) | |||
66 | if (!dentry) | 66 | if (!dentry) |
67 | goto put_memory; | 67 | goto put_memory; |
68 | 68 | ||
69 | error = -ENFILE; | ||
70 | file = get_empty_filp(); | ||
71 | if (!file) | ||
72 | goto put_dentry; | ||
73 | |||
74 | error = -ENOSPC; | 69 | error = -ENOSPC; |
75 | inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0); | 70 | inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0); |
76 | if (!inode) | 71 | if (!inode) |
77 | goto close_file; | 72 | goto put_dentry; |
78 | 73 | ||
79 | d_instantiate(dentry, inode); | 74 | d_instantiate(dentry, inode); |
80 | inode->i_nlink = 0; /* It is unlinked */ | 75 | error = -ENFILE; |
76 | file = alloc_file(shm_mnt, dentry, FMODE_WRITE | FMODE_READ, | ||
77 | &ramfs_file_operations); | ||
78 | if (!file) | ||
79 | goto put_dentry; | ||
81 | 80 | ||
82 | file->f_path.mnt = mntget(shm_mnt); | 81 | inode->i_nlink = 0; /* It is unlinked */ |
83 | file->f_path.dentry = dentry; | ||
84 | file->f_mapping = inode->i_mapping; | ||
85 | file->f_op = &ramfs_file_operations; | ||
86 | file->f_mode = FMODE_WRITE | FMODE_READ; | ||
87 | 82 | ||
88 | /* notify everyone as to the change of file size */ | 83 | /* notify everyone as to the change of file size */ |
89 | error = do_truncate(dentry, size, 0, file); | 84 | error = do_truncate(dentry, size, 0, file); |