diff options
Diffstat (limited to 'fs/jffs2/write.c')
-rw-r--r-- | fs/jffs2/write.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c index 0a194759bbbd..ea411518d801 100644 --- a/fs/jffs2/write.c +++ b/fs/jffs2/write.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: write.c,v 1.95 2005/08/17 13:46:23 dedekind Exp $ | 10 | * $Id: write.c,v 1.96 2005/09/07 08:34:55 havasi Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -153,13 +153,15 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 | |||
153 | jffs2_dbg_acct_paranoia_check(c, jeb); | 153 | jffs2_dbg_acct_paranoia_check(c, jeb); |
154 | 154 | ||
155 | if (alloc_mode == ALLOC_GC) { | 155 | if (alloc_mode == ALLOC_GC) { |
156 | ret = jffs2_reserve_space_gc(c, sizeof(*ri) + datalen, &flash_ofs, &dummy); | 156 | ret = jffs2_reserve_space_gc(c, sizeof(*ri) + datalen, &flash_ofs, |
157 | &dummy, JFFS2_SUMMARY_INODE_SIZE); | ||
157 | } else { | 158 | } else { |
158 | /* Locking pain */ | 159 | /* Locking pain */ |
159 | up(&f->sem); | 160 | up(&f->sem); |
160 | jffs2_complete_reservation(c); | 161 | jffs2_complete_reservation(c); |
161 | 162 | ||
162 | ret = jffs2_reserve_space(c, sizeof(*ri) + datalen, &flash_ofs, &dummy, alloc_mode); | 163 | ret = jffs2_reserve_space(c, sizeof(*ri) + datalen, &flash_ofs, |
164 | &dummy, alloc_mode, JFFS2_SUMMARY_INODE_SIZE); | ||
163 | down(&f->sem); | 165 | down(&f->sem); |
164 | } | 166 | } |
165 | 167 | ||
@@ -299,13 +301,15 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff | |||
299 | jffs2_dbg_acct_paranoia_check(c, jeb); | 301 | jffs2_dbg_acct_paranoia_check(c, jeb); |
300 | 302 | ||
301 | if (alloc_mode == ALLOC_GC) { | 303 | if (alloc_mode == ALLOC_GC) { |
302 | ret = jffs2_reserve_space_gc(c, sizeof(*rd) + namelen, &flash_ofs, &dummy); | 304 | ret = jffs2_reserve_space_gc(c, sizeof(*rd) + namelen, &flash_ofs, |
305 | &dummy, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | ||
303 | } else { | 306 | } else { |
304 | /* Locking pain */ | 307 | /* Locking pain */ |
305 | up(&f->sem); | 308 | up(&f->sem); |
306 | jffs2_complete_reservation(c); | 309 | jffs2_complete_reservation(c); |
307 | 310 | ||
308 | ret = jffs2_reserve_space(c, sizeof(*rd) + namelen, &flash_ofs, &dummy, alloc_mode); | 311 | ret = jffs2_reserve_space(c, sizeof(*rd) + namelen, &flash_ofs, |
312 | &dummy, alloc_mode, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | ||
309 | down(&f->sem); | 313 | down(&f->sem); |
310 | } | 314 | } |
311 | 315 | ||
@@ -362,7 +366,8 @@ int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
362 | retry: | 366 | retry: |
363 | D2(printk(KERN_DEBUG "jffs2_commit_write() loop: 0x%x to write to 0x%x\n", writelen, offset)); | 367 | D2(printk(KERN_DEBUG "jffs2_commit_write() loop: 0x%x to write to 0x%x\n", writelen, offset)); |
364 | 368 | ||
365 | ret = jffs2_reserve_space(c, sizeof(*ri) + JFFS2_MIN_DATA_LEN, &phys_ofs, &alloclen, ALLOC_NORMAL); | 369 | ret = jffs2_reserve_space(c, sizeof(*ri) + JFFS2_MIN_DATA_LEN, &phys_ofs, |
370 | &alloclen, ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); | ||
366 | if (ret) { | 371 | if (ret) { |
367 | D1(printk(KERN_DEBUG "jffs2_reserve_space returned %d\n", ret)); | 372 | D1(printk(KERN_DEBUG "jffs2_reserve_space returned %d\n", ret)); |
368 | break; | 373 | break; |
@@ -449,7 +454,8 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str | |||
449 | /* Try to reserve enough space for both node and dirent. | 454 | /* Try to reserve enough space for both node and dirent. |
450 | * Just the node will do for now, though | 455 | * Just the node will do for now, though |
451 | */ | 456 | */ |
452 | ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL); | 457 | ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL, |
458 | JFFS2_SUMMARY_INODE_SIZE); | ||
453 | D1(printk(KERN_DEBUG "jffs2_do_create(): reserved 0x%x bytes\n", alloclen)); | 459 | D1(printk(KERN_DEBUG "jffs2_do_create(): reserved 0x%x bytes\n", alloclen)); |
454 | if (ret) { | 460 | if (ret) { |
455 | up(&f->sem); | 461 | up(&f->sem); |
@@ -478,7 +484,8 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str | |||
478 | 484 | ||
479 | up(&f->sem); | 485 | up(&f->sem); |
480 | jffs2_complete_reservation(c); | 486 | jffs2_complete_reservation(c); |
481 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_NORMAL); | 487 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, |
488 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | ||
482 | 489 | ||
483 | if (ret) { | 490 | if (ret) { |
484 | /* Eep. */ | 491 | /* Eep. */ |
@@ -549,7 +556,8 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, | |||
549 | if (!rd) | 556 | if (!rd) |
550 | return -ENOMEM; | 557 | return -ENOMEM; |
551 | 558 | ||
552 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_DELETION); | 559 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, |
560 | ALLOC_DELETION, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | ||
553 | if (ret) { | 561 | if (ret) { |
554 | jffs2_free_raw_dirent(rd); | 562 | jffs2_free_raw_dirent(rd); |
555 | return ret; | 563 | return ret; |
@@ -658,7 +666,8 @@ int jffs2_do_link (struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint | |||
658 | if (!rd) | 666 | if (!rd) |
659 | return -ENOMEM; | 667 | return -ENOMEM; |
660 | 668 | ||
661 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_NORMAL); | 669 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, |
670 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | ||
662 | if (ret) { | 671 | if (ret) { |
663 | jffs2_free_raw_dirent(rd); | 672 | jffs2_free_raw_dirent(rd); |
664 | return ret; | 673 | return ret; |