Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359155
b: refs/heads/master
c: 6b4d0b2
h: refs/heads/master
i:
  359153: 3b7a2f8
  359151: 014ef23
v: v3
  • Loading branch information
Al Viro committed Feb 23, 2013
1 parent b7cd75d commit d08bb53
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 39b652527457452f09b35044fb4f8b3b0eabafdf
refs/heads/master: 6b4d0b2793337cc8943cd2948388218e2777400c
19 changes: 9 additions & 10 deletions trunk/mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -2873,23 +2873,22 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range);
*/
struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags)
{
int error;
struct file *file;
struct file *res;
struct inode *inode;
struct path path;
struct dentry *root;
struct qstr this;

if (IS_ERR(shm_mnt))
return (void *)shm_mnt;
return ERR_CAST(shm_mnt);

if (size < 0 || size > MAX_LFS_FILESIZE)
return ERR_PTR(-EINVAL);

if (shmem_acct_size(flags, size))
return ERR_PTR(-ENOMEM);

error = -ENOMEM;
res = ERR_PTR(-ENOMEM);
this.name = name;
this.len = strlen(name);
this.hash = 0; /* will go */
Expand All @@ -2899,7 +2898,7 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
goto put_memory;
path.mnt = mntget(shm_mnt);

error = -ENOSPC;
res = ERR_PTR(-ENOSPC);
inode = shmem_get_inode(root->d_sb, NULL, S_IFREG | S_IRWXUGO, 0, flags);
if (!inode)
goto put_dentry;
Expand All @@ -2909,23 +2908,23 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
clear_nlink(inode); /* It is unlinked */
#ifndef CONFIG_MMU
error = ramfs_nommu_expand_for_mapping(inode, size);
res = ERR_PTR(error);
if (error)
goto put_dentry;
#endif

file = alloc_file(&path, FMODE_WRITE | FMODE_READ,
res = alloc_file(&path, FMODE_WRITE | FMODE_READ,
&shmem_file_operations);
error = PTR_ERR(file);
if (IS_ERR(file))
if (IS_ERR(res))
goto put_dentry;

return file;
return res;

put_dentry:
path_put(&path);
put_memory:
shmem_unacct_size(flags, size);
return ERR_PTR(error);
return res;
}
EXPORT_SYMBOL_GPL(shmem_file_setup);

Expand Down

0 comments on commit d08bb53

Please sign in to comment.