diff options
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/coredump.c | 4 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/file.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/inode.c | 66 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/syscalls.c | 2 |
4 files changed, 28 insertions, 50 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c index 657e3f233a64..c9500ea7be2f 100644 --- a/arch/powerpc/platforms/cell/spufs/coredump.c +++ b/arch/powerpc/platforms/cell/spufs/coredump.c | |||
@@ -111,7 +111,7 @@ static int match_context(const void *v, struct file *file, unsigned fd) | |||
111 | struct spu_context *ctx; | 111 | struct spu_context *ctx; |
112 | if (file->f_op != &spufs_context_fops) | 112 | if (file->f_op != &spufs_context_fops) |
113 | return 0; | 113 | return 0; |
114 | ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx; | 114 | ctx = SPUFS_I(file_inode(file))->i_ctx; |
115 | if (ctx->flags & SPU_CREATE_NOSCHED) | 115 | if (ctx->flags & SPU_CREATE_NOSCHED) |
116 | return 0; | 116 | return 0; |
117 | return fd + 1; | 117 | return fd + 1; |
@@ -137,7 +137,7 @@ static struct spu_context *coredump_next_context(int *fd) | |||
137 | return NULL; | 137 | return NULL; |
138 | *fd = n - 1; | 138 | *fd = n - 1; |
139 | file = fcheck(*fd); | 139 | file = fcheck(*fd); |
140 | return SPUFS_I(file->f_dentry->d_inode)->i_ctx; | 140 | return SPUFS_I(file_inode(file))->i_ctx; |
141 | } | 141 | } |
142 | 142 | ||
143 | int spufs_coredump_extra_notes_size(void) | 143 | int spufs_coredump_extra_notes_size(void) |
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index 0cfece4cf6ef..68c57d38745a 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c | |||
@@ -1852,7 +1852,7 @@ out: | |||
1852 | 1852 | ||
1853 | static int spufs_mfc_fsync(struct file *file, loff_t start, loff_t end, int datasync) | 1853 | static int spufs_mfc_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
1854 | { | 1854 | { |
1855 | struct inode *inode = file->f_path.dentry->d_inode; | 1855 | struct inode *inode = file_inode(file); |
1856 | int err = filemap_write_and_wait_range(inode->i_mapping, start, end); | 1856 | int err = filemap_write_and_wait_range(inode->i_mapping, start, end); |
1857 | if (!err) { | 1857 | if (!err) { |
1858 | mutex_lock(&inode->i_mutex); | 1858 | mutex_lock(&inode->i_mutex); |
@@ -2501,7 +2501,7 @@ static int switch_log_sprint(struct spu_context *ctx, char *tbuf, int n) | |||
2501 | static ssize_t spufs_switch_log_read(struct file *file, char __user *buf, | 2501 | static ssize_t spufs_switch_log_read(struct file *file, char __user *buf, |
2502 | size_t len, loff_t *ppos) | 2502 | size_t len, loff_t *ppos) |
2503 | { | 2503 | { |
2504 | struct inode *inode = file->f_path.dentry->d_inode; | 2504 | struct inode *inode = file_inode(file); |
2505 | struct spu_context *ctx = SPUFS_I(inode)->i_ctx; | 2505 | struct spu_context *ctx = SPUFS_I(inode)->i_ctx; |
2506 | int error = 0, cnt = 0; | 2506 | int error = 0, cnt = 0; |
2507 | 2507 | ||
@@ -2571,7 +2571,7 @@ static ssize_t spufs_switch_log_read(struct file *file, char __user *buf, | |||
2571 | 2571 | ||
2572 | static unsigned int spufs_switch_log_poll(struct file *file, poll_table *wait) | 2572 | static unsigned int spufs_switch_log_poll(struct file *file, poll_table *wait) |
2573 | { | 2573 | { |
2574 | struct inode *inode = file->f_path.dentry->d_inode; | 2574 | struct inode *inode = file_inode(file); |
2575 | struct spu_context *ctx = SPUFS_I(inode)->i_ctx; | 2575 | struct spu_context *ctx = SPUFS_I(inode)->i_ctx; |
2576 | unsigned int mask = 0; | 2576 | unsigned int mask = 0; |
2577 | int rc; | 2577 | int rc; |
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index dba1ce235da5..863184b182f4 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
@@ -199,37 +199,18 @@ static int spufs_fill_dir(struct dentry *dir, | |||
199 | const struct spufs_tree_descr *files, umode_t mode, | 199 | const struct spufs_tree_descr *files, umode_t mode, |
200 | struct spu_context *ctx) | 200 | struct spu_context *ctx) |
201 | { | 201 | { |
202 | struct dentry *dentry, *tmp; | ||
203 | int ret; | ||
204 | |||
205 | while (files->name && files->name[0]) { | 202 | while (files->name && files->name[0]) { |
206 | ret = -ENOMEM; | 203 | int ret; |
207 | dentry = d_alloc_name(dir, files->name); | 204 | struct dentry *dentry = d_alloc_name(dir, files->name); |
208 | if (!dentry) | 205 | if (!dentry) |
209 | goto out; | 206 | return -ENOMEM; |
210 | ret = spufs_new_file(dir->d_sb, dentry, files->ops, | 207 | ret = spufs_new_file(dir->d_sb, dentry, files->ops, |
211 | files->mode & mode, files->size, ctx); | 208 | files->mode & mode, files->size, ctx); |
212 | if (ret) | 209 | if (ret) |
213 | goto out; | 210 | return ret; |
214 | files++; | 211 | files++; |
215 | } | 212 | } |
216 | return 0; | 213 | return 0; |
217 | out: | ||
218 | /* | ||
219 | * remove all children from dir. dir->inode is not set so don't | ||
220 | * just simply use spufs_prune_dir() and panic afterwards :) | ||
221 | * dput() looks like it will do the right thing: | ||
222 | * - dec parent's ref counter | ||
223 | * - remove child from parent's child list | ||
224 | * - free child's inode if possible | ||
225 | * - free child | ||
226 | */ | ||
227 | list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) { | ||
228 | dput(dentry); | ||
229 | } | ||
230 | |||
231 | shrink_dcache_parent(dir); | ||
232 | return ret; | ||
233 | } | 214 | } |
234 | 215 | ||
235 | static int spufs_dir_close(struct inode *inode, struct file *file) | 216 | static int spufs_dir_close(struct inode *inode, struct file *file) |
@@ -269,10 +250,9 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags, | |||
269 | struct inode *inode; | 250 | struct inode *inode; |
270 | struct spu_context *ctx; | 251 | struct spu_context *ctx; |
271 | 252 | ||
272 | ret = -ENOSPC; | ||
273 | inode = spufs_new_inode(dir->i_sb, mode | S_IFDIR); | 253 | inode = spufs_new_inode(dir->i_sb, mode | S_IFDIR); |
274 | if (!inode) | 254 | if (!inode) |
275 | goto out; | 255 | return -ENOSPC; |
276 | 256 | ||
277 | if (dir->i_mode & S_ISGID) { | 257 | if (dir->i_mode & S_ISGID) { |
278 | inode->i_gid = dir->i_gid; | 258 | inode->i_gid = dir->i_gid; |
@@ -280,40 +260,38 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags, | |||
280 | } | 260 | } |
281 | ctx = alloc_spu_context(SPUFS_I(dir)->i_gang); /* XXX gang */ | 261 | ctx = alloc_spu_context(SPUFS_I(dir)->i_gang); /* XXX gang */ |
282 | SPUFS_I(inode)->i_ctx = ctx; | 262 | SPUFS_I(inode)->i_ctx = ctx; |
283 | if (!ctx) | 263 | if (!ctx) { |
284 | goto out_iput; | 264 | iput(inode); |
265 | return -ENOSPC; | ||
266 | } | ||
285 | 267 | ||
286 | ctx->flags = flags; | 268 | ctx->flags = flags; |
287 | inode->i_op = &simple_dir_inode_operations; | 269 | inode->i_op = &simple_dir_inode_operations; |
288 | inode->i_fop = &simple_dir_operations; | 270 | inode->i_fop = &simple_dir_operations; |
271 | |||
272 | mutex_lock(&inode->i_mutex); | ||
273 | |||
274 | dget(dentry); | ||
275 | inc_nlink(dir); | ||
276 | inc_nlink(inode); | ||
277 | |||
278 | d_instantiate(dentry, inode); | ||
279 | |||
289 | if (flags & SPU_CREATE_NOSCHED) | 280 | if (flags & SPU_CREATE_NOSCHED) |
290 | ret = spufs_fill_dir(dentry, spufs_dir_nosched_contents, | 281 | ret = spufs_fill_dir(dentry, spufs_dir_nosched_contents, |
291 | mode, ctx); | 282 | mode, ctx); |
292 | else | 283 | else |
293 | ret = spufs_fill_dir(dentry, spufs_dir_contents, mode, ctx); | 284 | ret = spufs_fill_dir(dentry, spufs_dir_contents, mode, ctx); |
294 | 285 | ||
295 | if (ret) | 286 | if (!ret && spufs_get_sb_info(dir->i_sb)->debug) |
296 | goto out_free_ctx; | ||
297 | |||
298 | if (spufs_get_sb_info(dir->i_sb)->debug) | ||
299 | ret = spufs_fill_dir(dentry, spufs_dir_debug_contents, | 287 | ret = spufs_fill_dir(dentry, spufs_dir_debug_contents, |
300 | mode, ctx); | 288 | mode, ctx); |
301 | 289 | ||
302 | if (ret) | 290 | if (ret) |
303 | goto out_free_ctx; | 291 | spufs_rmdir(dir, dentry); |
304 | 292 | ||
305 | d_instantiate(dentry, inode); | 293 | mutex_unlock(&inode->i_mutex); |
306 | dget(dentry); | ||
307 | inc_nlink(dir); | ||
308 | inc_nlink(dentry->d_inode); | ||
309 | goto out; | ||
310 | 294 | ||
311 | out_free_ctx: | ||
312 | spu_forget(ctx); | ||
313 | put_spu_context(ctx); | ||
314 | out_iput: | ||
315 | iput(inode); | ||
316 | out: | ||
317 | return ret; | 295 | return ret; |
318 | } | 296 | } |
319 | 297 | ||
@@ -368,7 +346,7 @@ spufs_assert_affinity(unsigned int flags, struct spu_gang *gang, | |||
368 | return ERR_PTR(-EINVAL); | 346 | return ERR_PTR(-EINVAL); |
369 | 347 | ||
370 | neighbor = get_spu_context( | 348 | neighbor = get_spu_context( |
371 | SPUFS_I(filp->f_dentry->d_inode)->i_ctx); | 349 | SPUFS_I(file_inode(filp))->i_ctx); |
372 | 350 | ||
373 | if (!list_empty(&neighbor->aff_list) && !(neighbor->aff_head) && | 351 | if (!list_empty(&neighbor->aff_list) && !(neighbor->aff_head) && |
374 | !list_is_last(&neighbor->aff_list, &gang->aff_list_head) && | 352 | !list_is_last(&neighbor->aff_list, &gang->aff_list_head) && |
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c index baee994fe810..b045fdda4845 100644 --- a/arch/powerpc/platforms/cell/spufs/syscalls.c +++ b/arch/powerpc/platforms/cell/spufs/syscalls.c | |||
@@ -47,7 +47,7 @@ static long do_spu_run(struct file *filp, | |||
47 | if (filp->f_op != &spufs_context_fops) | 47 | if (filp->f_op != &spufs_context_fops) |
48 | goto out; | 48 | goto out; |
49 | 49 | ||
50 | i = SPUFS_I(filp->f_path.dentry->d_inode); | 50 | i = SPUFS_I(file_inode(filp)); |
51 | ret = spufs_run_spu(i->i_ctx, &npc, &status); | 51 | ret = spufs_run_spu(i->i_ctx, &npc, &status); |
52 | 52 | ||
53 | if (put_user(npc, unpc)) | 53 | if (put_user(npc, unpc)) |