diff options
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/nodemgmt.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c index bbae5b1a833a..b6bd4affd9ad 100644 --- a/fs/jffs2/nodemgmt.c +++ b/fs/jffs2/nodemgmt.c | |||
@@ -212,20 +212,25 @@ out: | |||
212 | int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, | 212 | int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, |
213 | uint32_t *len, uint32_t sumsize) | 213 | uint32_t *len, uint32_t sumsize) |
214 | { | 214 | { |
215 | int ret = -EAGAIN; | 215 | int ret; |
216 | minsize = PAD(minsize); | 216 | minsize = PAD(minsize); |
217 | 217 | ||
218 | jffs2_dbg(1, "%s(): Requested 0x%x bytes\n", __func__, minsize); | 218 | jffs2_dbg(1, "%s(): Requested 0x%x bytes\n", __func__, minsize); |
219 | 219 | ||
220 | spin_lock(&c->erase_completion_lock); | 220 | while (true) { |
221 | while(ret == -EAGAIN) { | 221 | spin_lock(&c->erase_completion_lock); |
222 | ret = jffs2_do_reserve_space(c, minsize, len, sumsize); | 222 | ret = jffs2_do_reserve_space(c, minsize, len, sumsize); |
223 | if (ret) { | 223 | if (ret) { |
224 | jffs2_dbg(1, "%s(): looping, ret is %d\n", | 224 | jffs2_dbg(1, "%s(): looping, ret is %d\n", |
225 | __func__, ret); | 225 | __func__, ret); |
226 | } | 226 | } |
227 | spin_unlock(&c->erase_completion_lock); | ||
228 | |||
229 | if (ret == -EAGAIN) | ||
230 | cond_resched(); | ||
231 | else | ||
232 | break; | ||
227 | } | 233 | } |
228 | spin_unlock(&c->erase_completion_lock); | ||
229 | if (!ret) | 234 | if (!ret) |
230 | ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, 1); | 235 | ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, 1); |
231 | 236 | ||