Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359167
b: refs/heads/master
c: 2248b87
h: refs/heads/master
i:
  359165: 2b0f6a3
  359163: 36567b5
  359159: ca76e7b
  359151: 014ef23
  359135: 9a530c5
  359103: b555320
  359039: b53b21b
  358911: 2072241
v: v3
  • Loading branch information
Al Viro committed Feb 23, 2013
1 parent 8c92e25 commit 417edc1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 44 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: 4e6b8973282829e0d5898d9721880556957f0f98
refs/heads/master: 2248b87ec1d9f59001d8c69513b2892ac04a2a3d
64 changes: 21 additions & 43 deletions trunk/arch/powerpc/platforms/cell/spufs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,37 +199,18 @@ static int spufs_fill_dir(struct dentry *dir,
const struct spufs_tree_descr *files, umode_t mode,
struct spu_context *ctx)
{
struct dentry *dentry, *tmp;
int ret;

while (files->name && files->name[0]) {
ret = -ENOMEM;
dentry = d_alloc_name(dir, files->name);
int ret;
struct dentry *dentry = d_alloc_name(dir, files->name);
if (!dentry)
goto out;
return -ENOMEM;
ret = spufs_new_file(dir->d_sb, dentry, files->ops,
files->mode & mode, files->size, ctx);
if (ret)
goto out;
return ret;
files++;
}
return 0;
out:
/*
* remove all children from dir. dir->inode is not set so don't
* just simply use spufs_prune_dir() and panic afterwards :)
* dput() looks like it will do the right thing:
* - dec parent's ref counter
* - remove child from parent's child list
* - free child's inode if possible
* - free child
*/
list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) {
dput(dentry);
}

shrink_dcache_parent(dir);
return ret;
}

static int spufs_dir_close(struct inode *inode, struct file *file)
Expand Down Expand Up @@ -269,51 +250,48 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
struct inode *inode;
struct spu_context *ctx;

ret = -ENOSPC;
inode = spufs_new_inode(dir->i_sb, mode | S_IFDIR);
if (!inode)
goto out;
return -ENOSPC;

if (dir->i_mode & S_ISGID) {
inode->i_gid = dir->i_gid;
inode->i_mode &= S_ISGID;
}
ctx = alloc_spu_context(SPUFS_I(dir)->i_gang); /* XXX gang */
SPUFS_I(inode)->i_ctx = ctx;
if (!ctx)
goto out_iput;
if (!ctx) {
iput(inode);
return -ENOSPC;
}

ctx->flags = flags;
inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations;

mutex_lock(&inode->i_mutex);

dget(dentry);
inc_nlink(dir);
inc_nlink(inode);

d_instantiate(dentry, inode);

if (flags & SPU_CREATE_NOSCHED)
ret = spufs_fill_dir(dentry, spufs_dir_nosched_contents,
mode, ctx);
else
ret = spufs_fill_dir(dentry, spufs_dir_contents, mode, ctx);

if (ret)
goto out_free_ctx;

if (spufs_get_sb_info(dir->i_sb)->debug)
if (!ret && spufs_get_sb_info(dir->i_sb)->debug)
ret = spufs_fill_dir(dentry, spufs_dir_debug_contents,
mode, ctx);

if (ret)
goto out_free_ctx;
spufs_rmdir(dir, dentry);

d_instantiate(dentry, inode);
dget(dentry);
inc_nlink(dir);
inc_nlink(dentry->d_inode);
goto out;
mutex_unlock(&inode->i_mutex);

out_free_ctx:
spu_forget(ctx);
put_spu_context(ctx);
out_iput:
iput(inode);
out:
return ret;
}

Expand Down

0 comments on commit 417edc1

Please sign in to comment.