aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/fs.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2008-04-22 10:13:40 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2008-04-22 10:13:40 -0400
commitced22070363ef50e4a47aadd003a81ebeaa3f917 (patch)
tree66f094dce47a5a0f8f9936308fffe57e2c50255a /fs/jffs2/fs.c
parent52f8301437a0ba744265e0549ee7239eb85426fc (diff)
[JFFS2] semaphore->mutex conversion
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/fs.c')
-rw-r--r--fs/jffs2/fs.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 9dafb53fb1d..3eb1c84b0a3 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -51,20 +51,20 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
51 mdata = (char *)&dev; 51 mdata = (char *)&dev;
52 D1(printk(KERN_DEBUG "jffs2_setattr(): Writing %d bytes of kdev_t\n", mdatalen)); 52 D1(printk(KERN_DEBUG "jffs2_setattr(): Writing %d bytes of kdev_t\n", mdatalen));
53 } else if (S_ISLNK(inode->i_mode)) { 53 } else if (S_ISLNK(inode->i_mode)) {
54 down(&f->sem); 54 mutex_lock(&f->sem);
55 mdatalen = f->metadata->size; 55 mdatalen = f->metadata->size;
56 mdata = kmalloc(f->metadata->size, GFP_USER); 56 mdata = kmalloc(f->metadata->size, GFP_USER);
57 if (!mdata) { 57 if (!mdata) {
58 up(&f->sem); 58 mutex_unlock(&f->sem);
59 return -ENOMEM; 59 return -ENOMEM;
60 } 60 }
61 ret = jffs2_read_dnode(c, f, f->metadata, mdata, 0, mdatalen); 61 ret = jffs2_read_dnode(c, f, f->metadata, mdata, 0, mdatalen);
62 if (ret) { 62 if (ret) {
63 up(&f->sem); 63 mutex_unlock(&f->sem);
64 kfree(mdata); 64 kfree(mdata);
65 return ret; 65 return ret;
66 } 66 }
67 up(&f->sem); 67 mutex_unlock(&f->sem);
68 D1(printk(KERN_DEBUG "jffs2_setattr(): Writing %d bytes of symlink target\n", mdatalen)); 68 D1(printk(KERN_DEBUG "jffs2_setattr(): Writing %d bytes of symlink target\n", mdatalen));
69 } 69 }
70 70
@@ -83,7 +83,7 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
83 kfree(mdata); 83 kfree(mdata);
84 return ret; 84 return ret;
85 } 85 }
86 down(&f->sem); 86 mutex_lock(&f->sem);
87 ivalid = iattr->ia_valid; 87 ivalid = iattr->ia_valid;
88 88
89 ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); 89 ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
@@ -134,7 +134,7 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
134 if (IS_ERR(new_metadata)) { 134 if (IS_ERR(new_metadata)) {
135 jffs2_complete_reservation(c); 135 jffs2_complete_reservation(c);
136 jffs2_free_raw_inode(ri); 136 jffs2_free_raw_inode(ri);
137 up(&f->sem); 137 mutex_unlock(&f->sem);
138 return PTR_ERR(new_metadata); 138 return PTR_ERR(new_metadata);
139 } 139 }
140 /* It worked. Update the inode */ 140 /* It worked. Update the inode */
@@ -165,7 +165,7 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
165 } 165 }
166 jffs2_free_raw_inode(ri); 166 jffs2_free_raw_inode(ri);
167 167
168 up(&f->sem); 168 mutex_unlock(&f->sem);
169 jffs2_complete_reservation(c); 169 jffs2_complete_reservation(c);
170 170
171 /* We have to do the vmtruncate() without f->sem held, since 171 /* We have to do the vmtruncate() without f->sem held, since
@@ -256,12 +256,12 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
256 c = JFFS2_SB_INFO(inode->i_sb); 256 c = JFFS2_SB_INFO(inode->i_sb);
257 257
258 jffs2_init_inode_info(f); 258 jffs2_init_inode_info(f);
259 down(&f->sem); 259 mutex_lock(&f->sem);
260 260
261 ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node); 261 ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node);
262 262
263 if (ret) { 263 if (ret) {
264 up(&f->sem); 264 mutex_unlock(&f->sem);
265 iget_failed(inode); 265 iget_failed(inode);
266 return ERR_PTR(ret); 266 return ERR_PTR(ret);
267 } 267 }
@@ -338,7 +338,7 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
338 printk(KERN_WARNING "jffs2_read_inode(): Bogus imode %o for ino %lu\n", inode->i_mode, (unsigned long)inode->i_ino); 338 printk(KERN_WARNING "jffs2_read_inode(): Bogus imode %o for ino %lu\n", inode->i_mode, (unsigned long)inode->i_ino);
339 } 339 }
340 340
341 up(&f->sem); 341 mutex_unlock(&f->sem);
342 342
343 D1(printk(KERN_DEBUG "jffs2_read_inode() returning\n")); 343 D1(printk(KERN_DEBUG "jffs2_read_inode() returning\n"));
344 unlock_new_inode(inode); 344 unlock_new_inode(inode);
@@ -347,7 +347,7 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
347error_io: 347error_io:
348 ret = -EIO; 348 ret = -EIO;
349error: 349error:
350 up(&f->sem); 350 mutex_unlock(&f->sem);
351 jffs2_do_clear_inode(c, f); 351 jffs2_do_clear_inode(c, f);
352 iget_failed(inode); 352 iget_failed(inode);
353 return ERR_PTR(ret); 353 return ERR_PTR(ret);
@@ -388,9 +388,9 @@ int jffs2_remount_fs (struct super_block *sb, int *flags, char *data)
388 Flush the writebuffer, if neccecary, else we loose it */ 388 Flush the writebuffer, if neccecary, else we loose it */
389 if (!(sb->s_flags & MS_RDONLY)) { 389 if (!(sb->s_flags & MS_RDONLY)) {
390 jffs2_stop_garbage_collect_thread(c); 390 jffs2_stop_garbage_collect_thread(c);
391 down(&c->alloc_sem); 391 mutex_lock(&c->alloc_sem);
392 jffs2_flush_wbuf_pad(c); 392 jffs2_flush_wbuf_pad(c);
393 up(&c->alloc_sem); 393 mutex_unlock(&c->alloc_sem);
394 } 394 }
395 395
396 if (!(*flags & MS_RDONLY)) 396 if (!(*flags & MS_RDONLY))
@@ -437,7 +437,7 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i
437 437
438 f = JFFS2_INODE_INFO(inode); 438 f = JFFS2_INODE_INFO(inode);
439 jffs2_init_inode_info(f); 439 jffs2_init_inode_info(f);
440 down(&f->sem); 440 mutex_lock(&f->sem);
441 441
442 memset(ri, 0, sizeof(*ri)); 442 memset(ri, 0, sizeof(*ri));
443 /* Set OS-specific defaults for new inodes */ 443 /* Set OS-specific defaults for new inodes */