diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-05-24 20:50:35 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-24 20:50:35 -0400 |
commit | 046b8b9808127d63326a33bc6298c90eaee90eeb (patch) | |
tree | 93caaabd7ae10969acb4758634b9b1c9448ef951 /fs | |
parent | f61579c33736476e41e296a16c0d4ead4b953187 (diff) |
[JFFS2] Add 'jeb' argument to jffs2_prealloc_raw_node_refs()
Preallocation of refs is shortly going to be a per-eraseblock thing,
rather than per-filesystem. Add the required argument to the function.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jffs2/erase.c | 2 | ||||
-rw-r--r-- | fs/jffs2/malloc.c | 3 | ||||
-rw-r--r-- | fs/jffs2/nodelist.h | 3 | ||||
-rw-r--r-- | fs/jffs2/nodemgmt.c | 4 | ||||
-rw-r--r-- | fs/jffs2/scan.c | 4 | ||||
-rw-r--r-- | fs/jffs2/summary.c | 6 | ||||
-rw-r--r-- | fs/jffs2/wbuf.c | 8 |
7 files changed, 16 insertions, 14 deletions
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c index aea58ee64d23..c8386b256831 100644 --- a/fs/jffs2/erase.c +++ b/fs/jffs2/erase.c | |||
@@ -383,7 +383,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb | |||
383 | .totlen = cpu_to_je32(c->cleanmarker_size) | 383 | .totlen = cpu_to_je32(c->cleanmarker_size) |
384 | }; | 384 | }; |
385 | 385 | ||
386 | jffs2_prealloc_raw_node_refs(c, 1); | 386 | jffs2_prealloc_raw_node_refs(c, jeb, 1); |
387 | 387 | ||
388 | marker.hdr_crc = cpu_to_je32(crc32(0, &marker, sizeof(struct jffs2_unknown_node)-4)); | 388 | marker.hdr_crc = cpu_to_je32(crc32(0, &marker, sizeof(struct jffs2_unknown_node)-4)); |
389 | 389 | ||
diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c index 3df3250314a2..171483ef0e4d 100644 --- a/fs/jffs2/malloc.c +++ b/fs/jffs2/malloc.c | |||
@@ -190,7 +190,8 @@ void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x) | |||
190 | kmem_cache_free(tmp_dnode_info_slab, x); | 190 | kmem_cache_free(tmp_dnode_info_slab, x); |
191 | } | 191 | } |
192 | 192 | ||
193 | int jffs2_prealloc_raw_node_refs(struct jffs2_sb_info *c, int nr) | 193 | int jffs2_prealloc_raw_node_refs(struct jffs2_sb_info *c, |
194 | struct jffs2_eraseblock *jeb, int nr) | ||
194 | { | 195 | { |
195 | struct jffs2_raw_node_ref *p = c->refs; | 196 | struct jffs2_raw_node_ref *p = c->refs; |
196 | 197 | ||
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h index 21b0b7b6c75f..6c92dc46fe9e 100644 --- a/fs/jffs2/nodelist.h +++ b/fs/jffs2/nodelist.h | |||
@@ -378,7 +378,8 @@ struct jffs2_raw_inode *jffs2_alloc_raw_inode(void); | |||
378 | void jffs2_free_raw_inode(struct jffs2_raw_inode *); | 378 | void jffs2_free_raw_inode(struct jffs2_raw_inode *); |
379 | struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void); | 379 | struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void); |
380 | void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *); | 380 | void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *); |
381 | int jffs2_prealloc_raw_node_refs(struct jffs2_sb_info *c, int nr); | 381 | int jffs2_prealloc_raw_node_refs(struct jffs2_sb_info *c, |
382 | struct jffs2_eraseblock *jeb, int nr); | ||
382 | struct jffs2_raw_node_ref *__jffs2_alloc_raw_node_ref(void); | 383 | struct jffs2_raw_node_ref *__jffs2_alloc_raw_node_ref(void); |
383 | void __jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *); | 384 | void __jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *); |
384 | struct jffs2_node_frag *jffs2_alloc_node_frag(void); | 385 | struct jffs2_node_frag *jffs2_alloc_node_frag(void); |
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c index bbc873e20807..73a06d01db48 100644 --- a/fs/jffs2/nodemgmt.c +++ b/fs/jffs2/nodemgmt.c | |||
@@ -138,7 +138,7 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, | |||
138 | } | 138 | } |
139 | spin_unlock(&c->erase_completion_lock); | 139 | spin_unlock(&c->erase_completion_lock); |
140 | if (!ret) | 140 | if (!ret) |
141 | ret = jffs2_prealloc_raw_node_refs(c, 1); | 141 | ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, 1); |
142 | if (ret) | 142 | if (ret) |
143 | up(&c->alloc_sem); | 143 | up(&c->alloc_sem); |
144 | return ret; | 144 | return ret; |
@@ -161,7 +161,7 @@ int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, | |||
161 | } | 161 | } |
162 | spin_unlock(&c->erase_completion_lock); | 162 | spin_unlock(&c->erase_completion_lock); |
163 | if (!ret) | 163 | if (!ret) |
164 | ret = jffs2_prealloc_raw_node_refs(c, 1); | 164 | ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, 1); |
165 | 165 | ||
166 | return ret; | 166 | return ret; |
167 | } | 167 | } |
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index c25750aa85e3..5bbd4a36c75e 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c | |||
@@ -244,7 +244,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) | |||
244 | 244 | ||
245 | D1(printk(KERN_DEBUG "jffs2_scan_medium(): Skipping %d bytes in nextblock to ensure page alignment\n", | 245 | D1(printk(KERN_DEBUG "jffs2_scan_medium(): Skipping %d bytes in nextblock to ensure page alignment\n", |
246 | skip)); | 246 | skip)); |
247 | jffs2_prealloc_raw_node_refs(c, 1); | 247 | jffs2_prealloc_raw_node_refs(c, c->nextblock, 1); |
248 | jffs2_scan_dirty_space(c, c->nextblock, skip); | 248 | jffs2_scan_dirty_space(c, c->nextblock, skip); |
249 | } | 249 | } |
250 | #endif | 250 | #endif |
@@ -576,7 +576,7 @@ scan_more: | |||
576 | jffs2_dbg_acct_paranoia_check_nolock(c, jeb); | 576 | jffs2_dbg_acct_paranoia_check_nolock(c, jeb); |
577 | 577 | ||
578 | /* Make sure there are node refs available for use */ | 578 | /* Make sure there are node refs available for use */ |
579 | err = jffs2_prealloc_raw_node_refs(c, 2); | 579 | err = jffs2_prealloc_raw_node_refs(c, jeb, 2); |
580 | if (err) | 580 | if (err) |
581 | return err; | 581 | return err; |
582 | 582 | ||
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c index 0c66d16eaa22..a60bbcea5b7f 100644 --- a/fs/jffs2/summary.c +++ b/fs/jffs2/summary.c | |||
@@ -400,7 +400,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras | |||
400 | dbg_summary("processing summary index %d\n", i); | 400 | dbg_summary("processing summary index %d\n", i); |
401 | 401 | ||
402 | /* Make sure there's a spare ref for dirty space */ | 402 | /* Make sure there's a spare ref for dirty space */ |
403 | err = jffs2_prealloc_raw_node_refs(c, 2); | 403 | err = jffs2_prealloc_raw_node_refs(c, jeb, 2); |
404 | if (err) | 404 | if (err) |
405 | return err; | 405 | return err; |
406 | 406 | ||
@@ -630,7 +630,7 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb | |||
630 | return ret; /* real error */ | 630 | return ret; /* real error */ |
631 | 631 | ||
632 | /* for PARANOIA_CHECK */ | 632 | /* for PARANOIA_CHECK */ |
633 | ret = jffs2_prealloc_raw_node_refs(c, 2); | 633 | ret = jffs2_prealloc_raw_node_refs(c, jeb, 2); |
634 | if (ret) | 634 | if (ret) |
635 | return ret; | 635 | return ret; |
636 | 636 | ||
@@ -815,9 +815,9 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c) | |||
815 | dbg_summary("called\n"); | 815 | dbg_summary("called\n"); |
816 | 816 | ||
817 | spin_unlock(&c->erase_completion_lock); | 817 | spin_unlock(&c->erase_completion_lock); |
818 | jffs2_prealloc_raw_node_refs(c, 1); | ||
819 | 818 | ||
820 | jeb = c->nextblock; | 819 | jeb = c->nextblock; |
820 | jffs2_prealloc_raw_node_refs(c, jeb, 1); | ||
821 | 821 | ||
822 | if (!c->summary->sum_num || !c->summary->sum_list_head) { | 822 | if (!c->summary->sum_num || !c->summary->sum_list_head) { |
823 | JFFS2_WARNING("Empty summary info!!!\n"); | 823 | JFFS2_WARNING("Empty summary info!!!\n"); |
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c index 1871140e1e78..e16e45ea0474 100644 --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c | |||
@@ -179,13 +179,13 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) | |||
179 | unsigned char *buf; | 179 | unsigned char *buf; |
180 | uint32_t start, end, ofs, len; | 180 | uint32_t start, end, ofs, len; |
181 | 181 | ||
182 | if (jffs2_prealloc_raw_node_refs(c, c->reserved_refs + 1)) | 182 | jeb = &c->blocks[c->wbuf_ofs / c->sector_size]; |
183 | |||
184 | if (jffs2_prealloc_raw_node_refs(c, jeb, c->reserved_refs + 1)) | ||
183 | return; | 185 | return; |
184 | 186 | ||
185 | spin_lock(&c->erase_completion_lock); | 187 | spin_lock(&c->erase_completion_lock); |
186 | 188 | ||
187 | jeb = &c->blocks[c->wbuf_ofs / c->sector_size]; | ||
188 | |||
189 | jffs2_block_refile(c, jeb, REFILE_NOTEMPTY); | 189 | jffs2_block_refile(c, jeb, REFILE_NOTEMPTY); |
190 | 190 | ||
191 | /* Find the first node to be recovered, by skipping over every | 191 | /* Find the first node to be recovered, by skipping over every |
@@ -417,7 +417,7 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad) | |||
417 | if (!c->wbuf_len) /* already checked c->wbuf above */ | 417 | if (!c->wbuf_len) /* already checked c->wbuf above */ |
418 | return 0; | 418 | return 0; |
419 | 419 | ||
420 | if (jffs2_prealloc_raw_node_refs(c, c->reserved_refs + 1)) | 420 | if (jffs2_prealloc_raw_node_refs(c, c->nextblock, c->reserved_refs + 1)) |
421 | return -ENOMEM; | 421 | return -ENOMEM; |
422 | 422 | ||
423 | /* claim remaining space on the page | 423 | /* claim remaining space on the page |