diff options
Diffstat (limited to 'fs/jffs2/gc.c')
-rw-r--r-- | fs/jffs2/gc.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c index 59aeb9820435..26c7992c45ca 100644 --- a/fs/jffs2/gc.c +++ b/fs/jffs2/gc.c | |||
@@ -126,7 +126,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
126 | int ret = 0, inum, nlink; | 126 | int ret = 0, inum, nlink; |
127 | int xattr = 0; | 127 | int xattr = 0; |
128 | 128 | ||
129 | if (down_interruptible(&c->alloc_sem)) | 129 | if (mutex_lock_interruptible(&c->alloc_sem)) |
130 | return -EINTR; | 130 | return -EINTR; |
131 | 131 | ||
132 | for (;;) { | 132 | for (;;) { |
@@ -143,7 +143,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
143 | c->unchecked_size); | 143 | c->unchecked_size); |
144 | jffs2_dbg_dump_block_lists_nolock(c); | 144 | jffs2_dbg_dump_block_lists_nolock(c); |
145 | spin_unlock(&c->erase_completion_lock); | 145 | spin_unlock(&c->erase_completion_lock); |
146 | up(&c->alloc_sem); | 146 | mutex_unlock(&c->alloc_sem); |
147 | return -ENOSPC; | 147 | return -ENOSPC; |
148 | } | 148 | } |
149 | 149 | ||
@@ -190,7 +190,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
190 | made no progress in this case, but that should be OK */ | 190 | made no progress in this case, but that should be OK */ |
191 | c->checked_ino--; | 191 | c->checked_ino--; |
192 | 192 | ||
193 | up(&c->alloc_sem); | 193 | mutex_unlock(&c->alloc_sem); |
194 | sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock); | 194 | sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock); |
195 | return 0; | 195 | return 0; |
196 | 196 | ||
@@ -210,7 +210,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
210 | printk(KERN_WARNING "Returned error for crccheck of ino #%u. Expect badness...\n", ic->ino); | 210 | printk(KERN_WARNING "Returned error for crccheck of ino #%u. Expect badness...\n", ic->ino); |
211 | 211 | ||
212 | jffs2_set_inocache_state(c, ic, INO_STATE_CHECKEDABSENT); | 212 | jffs2_set_inocache_state(c, ic, INO_STATE_CHECKEDABSENT); |
213 | up(&c->alloc_sem); | 213 | mutex_unlock(&c->alloc_sem); |
214 | return ret; | 214 | return ret; |
215 | } | 215 | } |
216 | 216 | ||
@@ -223,7 +223,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
223 | if (!jeb) { | 223 | if (!jeb) { |
224 | D1 (printk(KERN_NOTICE "jffs2: Couldn't find erase block to garbage collect!\n")); | 224 | D1 (printk(KERN_NOTICE "jffs2: Couldn't find erase block to garbage collect!\n")); |
225 | spin_unlock(&c->erase_completion_lock); | 225 | spin_unlock(&c->erase_completion_lock); |
226 | up(&c->alloc_sem); | 226 | mutex_unlock(&c->alloc_sem); |
227 | return -EIO; | 227 | return -EIO; |
228 | } | 228 | } |
229 | 229 | ||
@@ -232,7 +232,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
232 | printk(KERN_DEBUG "Nextblock at %08x, used_size %08x, dirty_size %08x, wasted_size %08x, free_size %08x\n", c->nextblock->offset, c->nextblock->used_size, c->nextblock->dirty_size, c->nextblock->wasted_size, c->nextblock->free_size)); | 232 | printk(KERN_DEBUG "Nextblock at %08x, used_size %08x, dirty_size %08x, wasted_size %08x, free_size %08x\n", c->nextblock->offset, c->nextblock->used_size, c->nextblock->dirty_size, c->nextblock->wasted_size, c->nextblock->free_size)); |
233 | 233 | ||
234 | if (!jeb->used_size) { | 234 | if (!jeb->used_size) { |
235 | up(&c->alloc_sem); | 235 | mutex_unlock(&c->alloc_sem); |
236 | goto eraseit; | 236 | goto eraseit; |
237 | } | 237 | } |
238 | 238 | ||
@@ -248,7 +248,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
248 | jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size); | 248 | jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size); |
249 | jeb->gc_node = raw; | 249 | jeb->gc_node = raw; |
250 | spin_unlock(&c->erase_completion_lock); | 250 | spin_unlock(&c->erase_completion_lock); |
251 | up(&c->alloc_sem); | 251 | mutex_unlock(&c->alloc_sem); |
252 | BUG(); | 252 | BUG(); |
253 | } | 253 | } |
254 | } | 254 | } |
@@ -266,7 +266,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
266 | /* Just mark it obsolete */ | 266 | /* Just mark it obsolete */ |
267 | jffs2_mark_node_obsolete(c, raw); | 267 | jffs2_mark_node_obsolete(c, raw); |
268 | } | 268 | } |
269 | up(&c->alloc_sem); | 269 | mutex_unlock(&c->alloc_sem); |
270 | goto eraseit_lock; | 270 | goto eraseit_lock; |
271 | } | 271 | } |
272 | 272 | ||
@@ -334,7 +334,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
334 | */ | 334 | */ |
335 | printk(KERN_CRIT "Inode #%u already in state %d in jffs2_garbage_collect_pass()!\n", | 335 | printk(KERN_CRIT "Inode #%u already in state %d in jffs2_garbage_collect_pass()!\n", |
336 | ic->ino, ic->state); | 336 | ic->ino, ic->state); |
337 | up(&c->alloc_sem); | 337 | mutex_unlock(&c->alloc_sem); |
338 | spin_unlock(&c->inocache_lock); | 338 | spin_unlock(&c->inocache_lock); |
339 | BUG(); | 339 | BUG(); |
340 | 340 | ||
@@ -345,7 +345,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
345 | the alloc_sem() (for marking nodes invalid) so we must | 345 | the alloc_sem() (for marking nodes invalid) so we must |
346 | drop the alloc_sem before sleeping. */ | 346 | drop the alloc_sem before sleeping. */ |
347 | 347 | ||
348 | up(&c->alloc_sem); | 348 | mutex_unlock(&c->alloc_sem); |
349 | D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass() waiting for ino #%u in state %d\n", | 349 | D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass() waiting for ino #%u in state %d\n", |
350 | ic->ino, ic->state)); | 350 | ic->ino, ic->state)); |
351 | sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock); | 351 | sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock); |
@@ -416,7 +416,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
416 | ret = -ENOSPC; | 416 | ret = -ENOSPC; |
417 | } | 417 | } |
418 | release_sem: | 418 | release_sem: |
419 | up(&c->alloc_sem); | 419 | mutex_unlock(&c->alloc_sem); |
420 | 420 | ||
421 | eraseit_lock: | 421 | eraseit_lock: |
422 | /* If we've finished this block, start it erasing */ | 422 | /* If we've finished this block, start it erasing */ |
@@ -445,7 +445,7 @@ static int jffs2_garbage_collect_live(struct jffs2_sb_info *c, struct jffs2_era | |||
445 | uint32_t start = 0, end = 0, nrfrags = 0; | 445 | uint32_t start = 0, end = 0, nrfrags = 0; |
446 | int ret = 0; | 446 | int ret = 0; |
447 | 447 | ||
448 | down(&f->sem); | 448 | mutex_lock(&f->sem); |
449 | 449 | ||
450 | /* Now we have the lock for this inode. Check that it's still the one at the head | 450 | /* Now we have the lock for this inode. Check that it's still the one at the head |
451 | of the list. */ | 451 | of the list. */ |
@@ -525,7 +525,7 @@ static int jffs2_garbage_collect_live(struct jffs2_sb_info *c, struct jffs2_era | |||
525 | } | 525 | } |
526 | } | 526 | } |
527 | upnout: | 527 | upnout: |
528 | up(&f->sem); | 528 | mutex_unlock(&f->sem); |
529 | 529 | ||
530 | return ret; | 530 | return ret; |
531 | } | 531 | } |
@@ -846,7 +846,7 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct | |||
846 | /* Prevent the erase code from nicking the obsolete node refs while | 846 | /* Prevent the erase code from nicking the obsolete node refs while |
847 | we're looking at them. I really don't like this extra lock but | 847 | we're looking at them. I really don't like this extra lock but |
848 | can't see any alternative. Suggestions on a postcard to... */ | 848 | can't see any alternative. Suggestions on a postcard to... */ |
849 | down(&c->erase_free_sem); | 849 | mutex_lock(&c->erase_free_sem); |
850 | 850 | ||
851 | for (raw = f->inocache->nodes; raw != (void *)f->inocache; raw = raw->next_in_ino) { | 851 | for (raw = f->inocache->nodes; raw != (void *)f->inocache; raw = raw->next_in_ino) { |
852 | 852 | ||
@@ -899,7 +899,7 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct | |||
899 | /* OK. The name really does match. There really is still an older node on | 899 | /* OK. The name really does match. There really is still an older node on |
900 | the flash which our deletion dirent obsoletes. So we have to write out | 900 | the flash which our deletion dirent obsoletes. So we have to write out |
901 | a new deletion dirent to replace it */ | 901 | a new deletion dirent to replace it */ |
902 | up(&c->erase_free_sem); | 902 | mutex_unlock(&c->erase_free_sem); |
903 | 903 | ||
904 | D1(printk(KERN_DEBUG "Deletion dirent at %08x still obsoletes real dirent \"%s\" at %08x for ino #%u\n", | 904 | D1(printk(KERN_DEBUG "Deletion dirent at %08x still obsoletes real dirent \"%s\" at %08x for ino #%u\n", |
905 | ref_offset(fd->raw), fd->name, ref_offset(raw), je32_to_cpu(rd->ino))); | 905 | ref_offset(fd->raw), fd->name, ref_offset(raw), je32_to_cpu(rd->ino))); |
@@ -908,7 +908,7 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct | |||
908 | return jffs2_garbage_collect_dirent(c, jeb, f, fd); | 908 | return jffs2_garbage_collect_dirent(c, jeb, f, fd); |
909 | } | 909 | } |
910 | 910 | ||
911 | up(&c->erase_free_sem); | 911 | mutex_unlock(&c->erase_free_sem); |
912 | kfree(rd); | 912 | kfree(rd); |
913 | } | 913 | } |
914 | 914 | ||