Commit 9fe4854cd1f60273f9a3ece053f4789605f58a5e

Authored by David Woodhouse
1 parent 5fa433942b

[JFFS2] Remove flash offset argument from various functions.

We don't need the upper layers to deal with the physical offset. It's
_always_ c->nextblock->offset + c->sector_size - c->nextblock->free_size
so we might as well just let the actual write functions deal with that.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>

Showing 9 changed files with 135 additions and 115 deletions Side-by-side Diff

... ... @@ -308,7 +308,7 @@
308 308 struct jffs2_full_dnode *fn;
309 309 struct jffs2_full_dirent *fd;
310 310 int namelen;
311   - uint32_t alloclen, phys_ofs;
  311 + uint32_t alloclen;
312 312 int ret, targetlen = strlen(target);
313 313  
314 314 /* FIXME: If you care. We'd need to use frags for the target
... ... @@ -327,8 +327,8 @@
327 327 * Just the node will do for now, though
328 328 */
329 329 namelen = dentry->d_name.len;
330   - ret = jffs2_reserve_space(c, sizeof(*ri) + targetlen, &phys_ofs, &alloclen,
331   - ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
  330 + ret = jffs2_reserve_space(c, sizeof(*ri) + targetlen, &alloclen,
  331 + ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
332 332  
333 333 if (ret) {
334 334 jffs2_free_raw_inode(ri);
... ... @@ -356,7 +356,7 @@
356 356 ri->data_crc = cpu_to_je32(crc32(0, target, targetlen));
357 357 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
358 358  
359   - fn = jffs2_write_dnode(c, f, ri, target, targetlen, phys_ofs, ALLOC_NORMAL);
  359 + fn = jffs2_write_dnode(c, f, ri, target, targetlen, ALLOC_NORMAL);
360 360  
361 361 jffs2_free_raw_inode(ri);
362 362  
... ... @@ -400,8 +400,8 @@
400 400 return ret;
401 401 }
402 402  
403   - ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen,
404   - ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen));
  403 + ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen,
  404 + ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen));
405 405 if (ret) {
406 406 /* Eep. */
407 407 jffs2_clear_inode(inode);
... ... @@ -433,7 +433,7 @@
433 433 rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
434 434 rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen));
435 435  
436   - fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, phys_ofs, ALLOC_NORMAL);
  436 + fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, ALLOC_NORMAL);
437 437  
438 438 if (IS_ERR(fd)) {
439 439 /* dirent failed to write. Delete the inode normally
... ... @@ -471,7 +471,7 @@
471 471 struct jffs2_full_dnode *fn;
472 472 struct jffs2_full_dirent *fd;
473 473 int namelen;
474   - uint32_t alloclen, phys_ofs;
  474 + uint32_t alloclen;
475 475 int ret;
476 476  
477 477 mode |= S_IFDIR;
... ... @@ -486,8 +486,8 @@
486 486 * Just the node will do for now, though
487 487 */
488 488 namelen = dentry->d_name.len;
489   - ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL,
490   - JFFS2_SUMMARY_INODE_SIZE);
  489 + ret = jffs2_reserve_space(c, sizeof(*ri), &alloclen, ALLOC_NORMAL,
  490 + JFFS2_SUMMARY_INODE_SIZE);
491 491  
492 492 if (ret) {
493 493 jffs2_free_raw_inode(ri);
... ... @@ -512,7 +512,7 @@
512 512 ri->data_crc = cpu_to_je32(0);
513 513 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
514 514  
515   - fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, ALLOC_NORMAL);
  515 + fn = jffs2_write_dnode(c, f, ri, NULL, 0, ALLOC_NORMAL);
516 516  
517 517 jffs2_free_raw_inode(ri);
518 518  
... ... @@ -542,8 +542,8 @@
542 542 return ret;
543 543 }
544 544  
545   - ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen,
546   - ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen));
  545 + ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen,
  546 + ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen));
547 547 if (ret) {
548 548 /* Eep. */
549 549 jffs2_clear_inode(inode);
... ... @@ -575,7 +575,7 @@
575 575 rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
576 576 rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen));
577 577  
578   - fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, phys_ofs, ALLOC_NORMAL);
  578 + fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, ALLOC_NORMAL);
579 579  
580 580 if (IS_ERR(fd)) {
581 581 /* dirent failed to write. Delete the inode normally
... ... @@ -631,7 +631,7 @@
631 631 int namelen;
632 632 union jffs2_device_node dev;
633 633 int devlen = 0;
634   - uint32_t alloclen, phys_ofs;
  634 + uint32_t alloclen;
635 635 int ret;
636 636  
637 637 if (!new_valid_dev(rdev))
... ... @@ -650,7 +650,7 @@
650 650 * Just the node will do for now, though
651 651 */
652 652 namelen = dentry->d_name.len;
653   - ret = jffs2_reserve_space(c, sizeof(*ri) + devlen, &phys_ofs, &alloclen,
  653 + ret = jffs2_reserve_space(c, sizeof(*ri) + devlen, &alloclen,
654 654 ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
655 655  
656 656 if (ret) {
... ... @@ -678,7 +678,7 @@
678 678 ri->data_crc = cpu_to_je32(crc32(0, &dev, devlen));
679 679 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
680 680  
681   - fn = jffs2_write_dnode(c, f, ri, (char *)&dev, devlen, phys_ofs, ALLOC_NORMAL);
  681 + fn = jffs2_write_dnode(c, f, ri, (char *)&dev, devlen, ALLOC_NORMAL);
682 682  
683 683 jffs2_free_raw_inode(ri);
684 684  
... ... @@ -708,8 +708,8 @@
708 708 return ret;
709 709 }
710 710  
711   - ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen,
712   - ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen));
  711 + ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen,
  712 + ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen));
713 713 if (ret) {
714 714 /* Eep. */
715 715 jffs2_clear_inode(inode);
... ... @@ -744,7 +744,7 @@
744 744 rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
745 745 rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen));
746 746  
747   - fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, phys_ofs, ALLOC_NORMAL);
  747 + fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, ALLOC_NORMAL);
748 748  
749 749 if (IS_ERR(fd)) {
750 750 /* dirent failed to write. Delete the inode normally
... ... @@ -134,13 +134,13 @@
134 134 struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
135 135 struct jffs2_raw_inode ri;
136 136 struct jffs2_full_dnode *fn;
137   - uint32_t phys_ofs, alloc_len;
  137 + uint32_t alloc_len;
138 138  
139 139 D1(printk(KERN_DEBUG "Writing new hole frag 0x%x-0x%x between current EOF and new page\n",
140 140 (unsigned int)inode->i_size, pageofs));
141 141  
142   - ret = jffs2_reserve_space(c, sizeof(ri), &phys_ofs, &alloc_len,
143   - ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
  142 + ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len,
  143 + ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
144 144 if (ret)
145 145 return ret;
146 146  
... ... @@ -166,7 +166,7 @@
166 166 ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
167 167 ri.data_crc = cpu_to_je32(0);
168 168  
169   - fn = jffs2_write_dnode(c, f, &ri, NULL, 0, phys_ofs, ALLOC_NORMAL);
  169 + fn = jffs2_write_dnode(c, f, &ri, NULL, 0, ALLOC_NORMAL);
170 170  
171 171 if (IS_ERR(fn)) {
172 172 ret = PTR_ERR(fn);
... ... @@ -37,7 +37,7 @@
37 37 unsigned char *mdata = NULL;
38 38 int mdatalen = 0;
39 39 unsigned int ivalid;
40   - uint32_t phys_ofs, alloclen;
  40 + uint32_t alloclen;
41 41 int ret;
42 42 D1(printk(KERN_DEBUG "jffs2_setattr(): ino #%lu\n", inode->i_ino));
43 43 ret = inode_change_ok(inode, iattr);
... ... @@ -79,8 +79,8 @@
79 79 return -ENOMEM;
80 80 }
81 81  
82   - ret = jffs2_reserve_space(c, sizeof(*ri) + mdatalen, &phys_ofs, &alloclen,
83   - ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
  82 + ret = jffs2_reserve_space(c, sizeof(*ri) + mdatalen, &alloclen,
  83 + ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
84 84 if (ret) {
85 85 jffs2_free_raw_inode(ri);
86 86 if (S_ISLNK(inode->i_mode & S_IFMT))
... ... @@ -131,7 +131,7 @@
131 131 else
132 132 ri->data_crc = cpu_to_je32(0);
133 133  
134   - new_metadata = jffs2_write_dnode(c, f, ri, mdata, mdatalen, phys_ofs, ALLOC_NORMAL);
  134 + new_metadata = jffs2_write_dnode(c, f, ri, mdata, mdatalen, ALLOC_NORMAL);
135 135 if (S_ISLNK(inode->i_mode))
136 136 kfree(mdata);
137 137  
... ... @@ -545,7 +545,7 @@
545 545 if (ic && alloclen > sizeof(struct jffs2_raw_inode) + JFFS2_MIN_DATA_LEN)
546 546 alloclen = sizeof(struct jffs2_raw_inode) + JFFS2_MIN_DATA_LEN;
547 547  
548   - ret = jffs2_reserve_space_gc(c, alloclen, &phys_ofs, &alloclen, rawlen);
  548 + ret = jffs2_reserve_space_gc(c, alloclen, &alloclen, rawlen);
549 549 /* 'rawlen' is not the exact summary size; it is only an upper estimation */
550 550  
551 551 if (ret)
552 552  
... ... @@ -626,13 +626,13 @@
626 626  
627 627 /* OK, all the CRCs are good; this node can just be copied as-is. */
628 628 retry:
629   - nraw->flash_offset = phys_ofs;
  629 + nraw->flash_offset = phys_ofs = write_ofs(c);
630 630  
631 631 ret = jffs2_flash_write(c, phys_ofs, rawlen, &retlen, (char *)node);
632 632  
633 633 if (ret || (retlen != rawlen)) {
634 634 printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n",
635   - rawlen, phys_ofs, ret, retlen);
  635 + rawlen, nraw->flash_offset, ret, retlen);
636 636 if (retlen) {
637 637 nraw->flash_offset |= REF_OBSOLETE;
638 638 jffs2_add_physical_node_ref(c, nraw, rawlen, NULL);
... ... @@ -653,7 +653,7 @@
653 653 jffs2_dbg_acct_sanity_check(c,jeb);
654 654 jffs2_dbg_acct_paranoia_check(c, jeb);
655 655  
656   - ret = jffs2_reserve_space_gc(c, rawlen, &phys_ofs, &dummy, rawlen);
  656 + ret = jffs2_reserve_space_gc(c, rawlen, &dummy, rawlen);
657 657 /* this is not the exact summary size of it,
658 658 it is only an upper estimation */
659 659  
... ... @@ -696,7 +696,7 @@
696 696 struct jffs2_node_frag *last_frag;
697 697 union jffs2_device_node dev;
698 698 char *mdata = NULL, mdatalen = 0;
699   - uint32_t alloclen, phys_ofs, ilen;
  699 + uint32_t alloclen, ilen;
700 700 int ret;
701 701  
702 702 if (S_ISBLK(JFFS2_F_I_MODE(f)) ||
... ... @@ -722,7 +722,7 @@
722 722  
723 723 }
724 724  
725   - ret = jffs2_reserve_space_gc(c, sizeof(ri) + mdatalen, &phys_ofs, &alloclen,
  725 + ret = jffs2_reserve_space_gc(c, sizeof(ri) + mdatalen, &alloclen,
726 726 JFFS2_SUMMARY_INODE_SIZE);
727 727 if (ret) {
728 728 printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_metadata failed: %d\n",
... ... @@ -760,7 +760,7 @@
760 760 ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
761 761 ri.data_crc = cpu_to_je32(crc32(0, mdata, mdatalen));
762 762  
763   - new_fn = jffs2_write_dnode(c, f, &ri, mdata, mdatalen, phys_ofs, ALLOC_GC);
  763 + new_fn = jffs2_write_dnode(c, f, &ri, mdata, mdatalen, ALLOC_GC);
764 764  
765 765 if (IS_ERR(new_fn)) {
766 766 printk(KERN_WARNING "Error writing new dnode: %ld\n", PTR_ERR(new_fn));
... ... @@ -781,7 +781,7 @@
781 781 {
782 782 struct jffs2_full_dirent *new_fd;
783 783 struct jffs2_raw_dirent rd;
784   - uint32_t alloclen, phys_ofs;
  784 + uint32_t alloclen;
785 785 int ret;
786 786  
787 787 rd.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
788 788  
... ... @@ -803,14 +803,14 @@
803 803 rd.node_crc = cpu_to_je32(crc32(0, &rd, sizeof(rd)-8));
804 804 rd.name_crc = cpu_to_je32(crc32(0, fd->name, rd.nsize));
805 805  
806   - ret = jffs2_reserve_space_gc(c, sizeof(rd)+rd.nsize, &phys_ofs, &alloclen,
  806 + ret = jffs2_reserve_space_gc(c, sizeof(rd)+rd.nsize, &alloclen,
807 807 JFFS2_SUMMARY_DIRENT_SIZE(rd.nsize));
808 808 if (ret) {
809 809 printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_dirent failed: %d\n",
810 810 sizeof(rd)+rd.nsize, ret);
811 811 return ret;
812 812 }
813   - new_fd = jffs2_write_dirent(c, f, &rd, fd->name, rd.nsize, phys_ofs, ALLOC_GC);
  813 + new_fd = jffs2_write_dirent(c, f, &rd, fd->name, rd.nsize, ALLOC_GC);
814 814  
815 815 if (IS_ERR(new_fd)) {
816 816 printk(KERN_WARNING "jffs2_write_dirent in garbage_collect_dirent failed: %ld\n", PTR_ERR(new_fd));
... ... @@ -938,7 +938,7 @@
938 938 struct jffs2_raw_inode ri;
939 939 struct jffs2_node_frag *frag;
940 940 struct jffs2_full_dnode *new_fn;
941   - uint32_t alloclen, phys_ofs, ilen;
  941 + uint32_t alloclen, ilen;
942 942 int ret;
943 943  
944 944 D1(printk(KERN_DEBUG "Writing replacement hole node for ino #%u from offset 0x%x to 0x%x\n",
945 945  
... ... @@ -1017,14 +1017,14 @@
1017 1017 ri.data_crc = cpu_to_je32(0);
1018 1018 ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
1019 1019  
1020   - ret = jffs2_reserve_space_gc(c, sizeof(ri), &phys_ofs, &alloclen,
1021   - JFFS2_SUMMARY_INODE_SIZE);
  1020 + ret = jffs2_reserve_space_gc(c, sizeof(ri), &alloclen,
  1021 + JFFS2_SUMMARY_INODE_SIZE);
1022 1022 if (ret) {
1023 1023 printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_hole failed: %d\n",
1024 1024 sizeof(ri), ret);
1025 1025 return ret;
1026 1026 }
1027   - new_fn = jffs2_write_dnode(c, f, &ri, NULL, 0, phys_ofs, ALLOC_GC);
  1027 + new_fn = jffs2_write_dnode(c, f, &ri, NULL, 0, ALLOC_GC);
1028 1028  
1029 1029 if (IS_ERR(new_fn)) {
1030 1030 printk(KERN_WARNING "Error writing new hole node: %ld\n", PTR_ERR(new_fn));
... ... @@ -1086,7 +1086,7 @@
1086 1086 {
1087 1087 struct jffs2_full_dnode *new_fn;
1088 1088 struct jffs2_raw_inode ri;
1089   - uint32_t alloclen, phys_ofs, offset, orig_end, orig_start;
  1089 + uint32_t alloclen, offset, orig_end, orig_start;
1090 1090 int ret = 0;
1091 1091 unsigned char *comprbuf = NULL, *writebuf;
1092 1092 unsigned long pg;
... ... @@ -1243,7 +1243,7 @@
1243 1243 uint32_t cdatalen;
1244 1244 uint16_t comprtype = JFFS2_COMPR_NONE;
1245 1245  
1246   - ret = jffs2_reserve_space_gc(c, sizeof(ri) + JFFS2_MIN_DATA_LEN, &phys_ofs,
  1246 + ret = jffs2_reserve_space_gc(c, sizeof(ri) + JFFS2_MIN_DATA_LEN,
1247 1247 &alloclen, JFFS2_SUMMARY_INODE_SIZE);
1248 1248  
1249 1249 if (ret) {
... ... @@ -1280,7 +1280,7 @@
1280 1280 ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
1281 1281 ri.data_crc = cpu_to_je32(crc32(0, comprbuf, cdatalen));
1282 1282  
1283   - new_fn = jffs2_write_dnode(c, f, &ri, comprbuf, cdatalen, phys_ofs, ALLOC_GC);
  1283 + new_fn = jffs2_write_dnode(c, f, &ri, comprbuf, cdatalen, ALLOC_GC);
1284 1284  
1285 1285 jffs2_free_comprbuf(comprbuf, writebuf);
1286 1286  
... ... @@ -167,6 +167,8 @@
167 167  
168 168 #define INOCACHE_HASHSIZE 128
169 169  
  170 +#define write_ofs(c) ((c)->nextblock->offset + (c)->sector_size - (c)->nextblock->free_size)
  171 +
170 172 /*
171 173 Larger representation of a raw node, kept in-core only when the
172 174 struct inode for this particular ino is instantiated.
173 175  
... ... @@ -325,9 +327,9 @@
325 327  
326 328 /* nodemgmt.c */
327 329 int jffs2_thread_should_wake(struct jffs2_sb_info *c);
328   -int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs,
  330 +int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
329 331 uint32_t *len, int prio, uint32_t sumsize);
330   -int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs,
  332 +int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize,
331 333 uint32_t *len, uint32_t sumsize);
332 334 int jffs2_add_physical_node_ref(struct jffs2_sb_info *c,
333 335 struct jffs2_raw_node_ref *new,
334 336  
... ... @@ -339,14 +341,21 @@
339 341 /* write.c */
340 342 int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, uint32_t mode, struct jffs2_raw_inode *ri);
341 343  
342   -struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const unsigned char *data, uint32_t datalen, uint32_t flash_ofs, int alloc_mode);
343   -struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_dirent *rd, const unsigned char *name, uint32_t namelen, uint32_t flash_ofs, int alloc_mode);
  344 +struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
  345 + struct jffs2_raw_inode *ri, const unsigned char *data,
  346 + uint32_t datalen, int alloc_mode);
  347 +struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
  348 + struct jffs2_raw_dirent *rd, const unsigned char *name,
  349 + uint32_t namelen, int alloc_mode);
344 350 int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
345 351 struct jffs2_raw_inode *ri, unsigned char *buf,
346 352 uint32_t offset, uint32_t writelen, uint32_t *retlen);
347   -int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const char *name, int namelen);
348   -int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, const char *name, int namelen, struct jffs2_inode_info *dead_f, uint32_t time);
349   -int jffs2_do_link (struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint32_t ino, uint8_t type, const char *name, int namelen, uint32_t time);
  353 +int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, struct jffs2_inode_info *f,
  354 + struct jffs2_raw_inode *ri, const char *name, int namelen);
  355 +int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, const char *name,
  356 + int namelen, struct jffs2_inode_info *dead_f, uint32_t time);
  357 +int jffs2_do_link(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint32_t ino,
  358 + uint8_t type, const char *name, int namelen, uint32_t time);
350 359  
351 360  
352 361 /* readinode.c */
... ... @@ -23,13 +23,12 @@
23 23 * jffs2_reserve_space - request physical space to write nodes to flash
24 24 * @c: superblock info
25 25 * @minsize: Minimum acceptable size of allocation
26   - * @ofs: Returned value of node offset
27 26 * @len: Returned value of allocation length
28 27 * @prio: Allocation type - ALLOC_{NORMAL,DELETION}
29 28 *
30 29 * Requests a block of physical space on the flash. Returns zero for success
31   - * and puts 'ofs' and 'len' into the appriopriate place, or returns -ENOSPC
32   - * or other error if appropriate.
  30 + * and puts 'len' into the appropriate place, or returns -ENOSPC or other
  31 + * error if appropriate. Doesn't return len since that's
33 32 *
34 33 * If it returns zero, jffs2_reserve_space() also downs the per-filesystem
35 34 * allocation semaphore, to prevent more than one allocation from being
36 35  
... ... @@ -40,9 +39,9 @@
40 39 */
41 40  
42 41 static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
43   - uint32_t *ofs, uint32_t *len, uint32_t sumsize);
  42 + uint32_t *len, uint32_t sumsize);
44 43  
45   -int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs,
  44 +int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
46 45 uint32_t *len, int prio, uint32_t sumsize)
47 46 {
48 47 int ret = -EAGAIN;
... ... @@ -132,7 +131,7 @@
132 131 spin_lock(&c->erase_completion_lock);
133 132 }
134 133  
135   - ret = jffs2_do_reserve_space(c, minsize, ofs, len, sumsize);
  134 + ret = jffs2_do_reserve_space(c, minsize, len, sumsize);
136 135 if (ret) {
137 136 D1(printk(KERN_DEBUG "jffs2_reserve_space: ret is %d\n", ret));
138 137 }
... ... @@ -143,8 +142,8 @@
143 142 return ret;
144 143 }
145 144  
146   -int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs,
147   - uint32_t *len, uint32_t sumsize)
  145 +int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize,
  146 + uint32_t *len, uint32_t sumsize)
148 147 {
149 148 int ret = -EAGAIN;
150 149 minsize = PAD(minsize);
... ... @@ -153,7 +152,7 @@
153 152  
154 153 spin_lock(&c->erase_completion_lock);
155 154 while(ret == -EAGAIN) {
156   - ret = jffs2_do_reserve_space(c, minsize, ofs, len, sumsize);
  155 + ret = jffs2_do_reserve_space(c, minsize, len, sumsize);
157 156 if (ret) {
158 157 D1(printk(KERN_DEBUG "jffs2_reserve_space_gc: looping, ret is %d\n", ret));
159 158 }
160 159  
... ... @@ -259,10 +258,11 @@
259 258 }
260 259  
261 260 /* Called with alloc sem _and_ erase_completion_lock */
262   -static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len, uint32_t sumsize)
  261 +static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
  262 + uint32_t *len, uint32_t sumsize)
263 263 {
264 264 struct jffs2_eraseblock *jeb = c->nextblock;
265   - uint32_t reserved_size; /* for summary information at the end of the jeb */
  265 + uint32_t reserved_size; /* for summary information at the end of the jeb */
266 266 int ret;
267 267  
268 268 restart:
... ... @@ -349,7 +349,6 @@
349 349 }
350 350 /* OK, jeb (==c->nextblock) is now pointing at a block which definitely has
351 351 enough space */
352   - *ofs = jeb->offset + (c->sector_size - jeb->free_size);
353 352 *len = jeb->free_size - reserved_size;
354 353  
355 354 if (c->cleanmarker_size && jeb->used_size == c->cleanmarker_size &&
... ... @@ -365,7 +364,8 @@
365 364 spin_lock(&c->erase_completion_lock);
366 365 }
367 366  
368   - D1(printk(KERN_DEBUG "jffs2_do_reserve_space(): Giving 0x%x bytes at 0x%x\n", *len, *ofs));
  367 + D1(printk(KERN_DEBUG "jffs2_do_reserve_space(): Giving 0x%x bytes at 0x%x\n",
  368 + *len, jeb->offset + (c->sector_size - jeb->free_size)));
369 369 return 0;
370 370 }
371 371  
... ... @@ -265,12 +265,14 @@
265 265  
266 266  
267 267 /* ... and get an allocation of space from a shiny new block instead */
268   - ret = jffs2_reserve_space_gc(c, end-start, &ofs, &len, JFFS2_SUMMARY_NOSUM_SIZE);
  268 + ret = jffs2_reserve_space_gc(c, end-start, &len, JFFS2_SUMMARY_NOSUM_SIZE);
269 269 if (ret) {
270 270 printk(KERN_WARNING "Failed to allocate space for wbuf recovery. Data loss ensues.\n");
271 271 kfree(buf);
272 272 return;
273 273 }
  274 + ofs = write_ofs(c);
  275 +
274 276 if (end-start >= c->wbuf_pagesize) {
275 277 /* Need to do another write immediately, but it's possible
276 278 that this is just because the wbuf itself is completely
... ... @@ -56,12 +56,15 @@
56 56 /* jffs2_write_dnode - given a raw_inode, allocate a full_dnode for it,
57 57 write it to the flash, link it into the existing inode/fragment list */
58 58  
59   -struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const unsigned char *data, uint32_t datalen, uint32_t flash_ofs, int alloc_mode)
  59 +struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
  60 + struct jffs2_raw_inode *ri, const unsigned char *data,
  61 + uint32_t datalen, int alloc_mode)
60 62  
61 63 {
62 64 struct jffs2_raw_node_ref *raw;
63 65 struct jffs2_full_dnode *fn;
64 66 size_t retlen;
  67 + uint32_t flash_ofs;
65 68 struct kvec vecs[2];
66 69 int ret;
67 70 int retried = 0;
... ... @@ -77,8 +80,6 @@
77 80 vecs[1].iov_base = (unsigned char *)data;
78 81 vecs[1].iov_len = datalen;
79 82  
80   - jffs2_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len);
81   -
82 83 if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) {
83 84 printk(KERN_WARNING "jffs2_write_dnode: ri->totlen (0x%08x) != sizeof(*ri) (0x%08zx) + datalen (0x%08x)\n", je32_to_cpu(ri->totlen), sizeof(*ri), datalen);
84 85 }
85 86  
... ... @@ -102,8 +103,10 @@
102 103 retry:
103 104 fn->raw = raw;
104 105  
105   - raw->flash_offset = flash_ofs;
  106 + raw->flash_offset = flash_ofs = write_ofs(c);
106 107  
  108 + jffs2_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len);
  109 +
107 110 if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(ri->version) < f->highest_version)) {
108 111 BUG_ON(!retried);
109 112 D1(printk(KERN_DEBUG "jffs2_write_dnode : dnode_version %d, "
110 113  
111 114  
... ... @@ -147,19 +150,20 @@
147 150 jffs2_dbg_acct_paranoia_check(c, jeb);
148 151  
149 152 if (alloc_mode == ALLOC_GC) {
150   - ret = jffs2_reserve_space_gc(c, sizeof(*ri) + datalen, &flash_ofs,
151   - &dummy, JFFS2_SUMMARY_INODE_SIZE);
  153 + ret = jffs2_reserve_space_gc(c, sizeof(*ri) + datalen, &dummy,
  154 + JFFS2_SUMMARY_INODE_SIZE);
152 155 } else {
153 156 /* Locking pain */
154 157 up(&f->sem);
155 158 jffs2_complete_reservation(c);
156 159  
157   - ret = jffs2_reserve_space(c, sizeof(*ri) + datalen, &flash_ofs,
158   - &dummy, alloc_mode, JFFS2_SUMMARY_INODE_SIZE);
  160 + ret = jffs2_reserve_space(c, sizeof(*ri) + datalen, &dummy,
  161 + alloc_mode, JFFS2_SUMMARY_INODE_SIZE);
159 162 down(&f->sem);
160 163 }
161 164  
162 165 if (!ret) {
  166 + flash_ofs = write_ofs(c);
163 167 D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", flash_ofs));
164 168  
165 169 jffs2_dbg_acct_sanity_check(c,jeb);
166 170  
... ... @@ -200,12 +204,15 @@
200 204 return fn;
201 205 }
202 206  
203   -struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_dirent *rd, const unsigned char *name, uint32_t namelen, uint32_t flash_ofs, int alloc_mode)
  207 +struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
  208 + struct jffs2_raw_dirent *rd, const unsigned char *name,
  209 + uint32_t namelen, int alloc_mode)
204 210 {
205 211 struct jffs2_raw_node_ref *raw;
206 212 struct jffs2_full_dirent *fd;
207 213 size_t retlen;
208 214 struct kvec vecs[2];
  215 + uint32_t flash_ofs = write_ofs(c);
209 216 int retried = 0;
210 217 int ret;
211 218  
212 219  
213 220  
... ... @@ -286,19 +293,20 @@
286 293 jffs2_dbg_acct_paranoia_check(c, jeb);
287 294  
288 295 if (alloc_mode == ALLOC_GC) {
289   - ret = jffs2_reserve_space_gc(c, sizeof(*rd) + namelen, &flash_ofs,
290   - &dummy, JFFS2_SUMMARY_DIRENT_SIZE(namelen));
  296 + ret = jffs2_reserve_space_gc(c, sizeof(*rd) + namelen, &dummy,
  297 + JFFS2_SUMMARY_DIRENT_SIZE(namelen));
291 298 } else {
292 299 /* Locking pain */
293 300 up(&f->sem);
294 301 jffs2_complete_reservation(c);
295 302  
296   - ret = jffs2_reserve_space(c, sizeof(*rd) + namelen, &flash_ofs,
297   - &dummy, alloc_mode, JFFS2_SUMMARY_DIRENT_SIZE(namelen));
  303 + ret = jffs2_reserve_space(c, sizeof(*rd) + namelen, &dummy,
  304 + alloc_mode, JFFS2_SUMMARY_DIRENT_SIZE(namelen));
298 305 down(&f->sem);
299 306 }
300 307  
301 308 if (!ret) {
  309 + flash_ofs = write_ofs(c);
302 310 D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", flash_ofs));
303 311 jffs2_dbg_acct_sanity_check(c,jeb);
304 312 jffs2_dbg_acct_paranoia_check(c, jeb);
305 313  
... ... @@ -339,14 +347,14 @@
339 347 struct jffs2_full_dnode *fn;
340 348 unsigned char *comprbuf = NULL;
341 349 uint16_t comprtype = JFFS2_COMPR_NONE;
342   - uint32_t phys_ofs, alloclen;
  350 + uint32_t alloclen;
343 351 uint32_t datalen, cdatalen;
344 352 int retried = 0;
345 353  
346 354 retry:
347 355 D2(printk(KERN_DEBUG "jffs2_commit_write() loop: 0x%x to write to 0x%x\n", writelen, offset));
348 356  
349   - ret = jffs2_reserve_space(c, sizeof(*ri) + JFFS2_MIN_DATA_LEN, &phys_ofs,
  357 + ret = jffs2_reserve_space(c, sizeof(*ri) + JFFS2_MIN_DATA_LEN,
350 358 &alloclen, ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
351 359 if (ret) {
352 360 D1(printk(KERN_DEBUG "jffs2_reserve_space returned %d\n", ret));
... ... @@ -374,7 +382,7 @@
374 382 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
375 383 ri->data_crc = cpu_to_je32(crc32(0, comprbuf, cdatalen));
376 384  
377   - fn = jffs2_write_dnode(c, f, ri, comprbuf, cdatalen, phys_ofs, ALLOC_NORETRY);
  385 + fn = jffs2_write_dnode(c, f, ri, comprbuf, cdatalen, ALLOC_NORETRY);
378 386  
379 387 jffs2_free_comprbuf(comprbuf, buf);
380 388  
381 389  
... ... @@ -428,13 +436,13 @@
428 436 struct jffs2_raw_dirent *rd;
429 437 struct jffs2_full_dnode *fn;
430 438 struct jffs2_full_dirent *fd;
431   - uint32_t alloclen, phys_ofs;
  439 + uint32_t alloclen;
432 440 int ret;
433 441  
434 442 /* Try to reserve enough space for both node and dirent.
435 443 * Just the node will do for now, though
436 444 */
437   - ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL,
  445 + ret = jffs2_reserve_space(c, sizeof(*ri), &alloclen, ALLOC_NORMAL,
438 446 JFFS2_SUMMARY_INODE_SIZE);
439 447 D1(printk(KERN_DEBUG "jffs2_do_create(): reserved 0x%x bytes\n", alloclen));
440 448 if (ret) {
... ... @@ -445,7 +453,7 @@
445 453 ri->data_crc = cpu_to_je32(0);
446 454 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
447 455  
448   - fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, ALLOC_NORMAL);
  456 + fn = jffs2_write_dnode(c, f, ri, NULL, 0, ALLOC_NORMAL);
449 457  
450 458 D1(printk(KERN_DEBUG "jffs2_do_create created file with mode 0x%x\n",
451 459 jemode_to_cpu(ri->mode)));
... ... @@ -464,7 +472,7 @@
464 472  
465 473 up(&f->sem);
466 474 jffs2_complete_reservation(c);
467   - ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen,
  475 + ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen,
468 476 ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen));
469 477  
470 478 if (ret) {
... ... @@ -496,7 +504,7 @@
496 504 rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
497 505 rd->name_crc = cpu_to_je32(crc32(0, name, namelen));
498 506  
499   - fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, phys_ofs, ALLOC_NORMAL);
  507 + fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, ALLOC_NORMAL);
500 508  
501 509 jffs2_free_raw_dirent(rd);
502 510  
... ... @@ -525,7 +533,7 @@
525 533 {
526 534 struct jffs2_raw_dirent *rd;
527 535 struct jffs2_full_dirent *fd;
528   - uint32_t alloclen, phys_ofs;
  536 + uint32_t alloclen;
529 537 int ret;
530 538  
531 539 if (1 /* alternative branch needs testing */ ||
... ... @@ -536,7 +544,7 @@
536 544 if (!rd)
537 545 return -ENOMEM;
538 546  
539   - ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen,
  547 + ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen,
540 548 ALLOC_DELETION, JFFS2_SUMMARY_DIRENT_SIZE(namelen));
541 549 if (ret) {
542 550 jffs2_free_raw_dirent(rd);
... ... @@ -560,7 +568,7 @@
560 568 rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
561 569 rd->name_crc = cpu_to_je32(crc32(0, name, namelen));
562 570  
563   - fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, phys_ofs, ALLOC_DELETION);
  571 + fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, ALLOC_DELETION);
564 572  
565 573 jffs2_free_raw_dirent(rd);
566 574  
567 575  
... ... @@ -639,14 +647,14 @@
639 647 {
640 648 struct jffs2_raw_dirent *rd;
641 649 struct jffs2_full_dirent *fd;
642   - uint32_t alloclen, phys_ofs;
  650 + uint32_t alloclen;
643 651 int ret;
644 652  
645 653 rd = jffs2_alloc_raw_dirent();
646 654 if (!rd)
647 655 return -ENOMEM;
648 656  
649   - ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen,
  657 + ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen,
650 658 ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen));
651 659 if (ret) {
652 660 jffs2_free_raw_dirent(rd);
... ... @@ -672,7 +680,7 @@
672 680 rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
673 681 rd->name_crc = cpu_to_je32(crc32(0, name, namelen));
674 682  
675   - fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, phys_ofs, ALLOC_NORMAL);
  683 + fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, ALLOC_NORMAL);
676 684  
677 685 jffs2_free_raw_dirent(rd);
678 686  
... ... @@ -49,9 +49,9 @@
49 49 * is used to be as a wrapper of do_verify_xattr_datum() and do_load_xattr_datum().
50 50 * If xd need to call do_verify_xattr_datum() at first, it's called before calling
51 51 * do_load_xattr_datum(). The meanings of return value is same as do_verify_xattr_datum().
52   - * save_xattr_datum(c, xd, phys_ofs)
  52 + * save_xattr_datum(c, xd)
53 53 * is used to write xdatum to medium. xd->version will be incremented.
54   - * create_xattr_datum(c, xprefix, xname, xvalue, xsize, phys_ofs)
  54 + * create_xattr_datum(c, xprefix, xname, xvalue, xsize)
55 55 * is used to create new xdatum and write to medium.
56 56 * -------------------------------------------------- */
57 57  
... ... @@ -301,7 +301,7 @@
301 301 return rc;
302 302 }
303 303  
304   -static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd, uint32_t phys_ofs)
  304 +static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd)
305 305 {
306 306 /* must be called under down_write(xattr_sem) */
307 307 struct jffs2_raw_xattr rx;
... ... @@ -309,6 +309,7 @@
309 309 struct kvec vecs[2];
310 310 uint32_t length;
311 311 int rc, totlen;
  312 + uint32_t phys_ofs = write_ofs(c);
312 313  
313 314 BUG_ON(!xd->xname);
314 315  
... ... @@ -369,8 +370,7 @@
369 370  
370 371 static struct jffs2_xattr_datum *create_xattr_datum(struct jffs2_sb_info *c,
371 372 int xprefix, const char *xname,
372   - const char *xvalue, int xsize,
373   - uint32_t phys_ofs)
  373 + const char *xvalue, int xsize)
374 374 {
375 375 /* must be called under down_write(xattr_sem) */
376 376 struct jffs2_xattr_datum *xd;
... ... @@ -419,7 +419,7 @@
419 419 xd->value_len = xsize;
420 420 xd->data_crc = crc32(0, data, xd->name_len + 1 + xd->value_len);
421 421  
422   - rc = save_xattr_datum(c, xd, phys_ofs);
  422 + rc = save_xattr_datum(c, xd);
423 423 if (rc) {
424 424 kfree(xd->xname);
425 425 jffs2_free_xattr_datum(xd);
426 426  
... ... @@ -446,9 +446,9 @@
446 446 * delete_xattr_ref(c, ref)
447 447 * is used to delete jffs2_xattr_ref object. If the reference counter of xdatum
448 448 * is refered by this xref become 0, delete_xattr_datum() is called later.
449   - * save_xattr_ref(c, ref, phys_ofs)
  449 + * save_xattr_ref(c, ref)
450 450 * is used to write xref to medium.
451   - * create_xattr_ref(c, ic, xd, phys_ofs)
  451 + * create_xattr_ref(c, ic, xd)
452 452 * is used to create a new xref and write to medium.
453 453 * jffs2_xattr_delete_inode(c, ic)
454 454 * is called to remove xrefs related to obsolete inode when inode is unlinked.
455 455  
... ... @@ -554,12 +554,13 @@
554 554 jffs2_free_xattr_ref(ref);
555 555 }
556 556  
557   -static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref, uint32_t phys_ofs)
  557 +static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref)
558 558 {
559 559 /* must be called under down_write(xattr_sem) */
560 560 struct jffs2_raw_node_ref *raw;
561 561 struct jffs2_raw_xref rr;
562 562 uint32_t length;
  563 + uint32_t phys_ofs = write_ofs(c);
563 564 int ret;
564 565  
565 566 raw = jffs2_alloc_raw_node_ref();
... ... @@ -604,7 +605,7 @@
604 605 }
605 606  
606 607 static struct jffs2_xattr_ref *create_xattr_ref(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic,
607   - struct jffs2_xattr_datum *xd, uint32_t phys_ofs)
  608 + struct jffs2_xattr_datum *xd)
608 609 {
609 610 /* must be called under down_write(xattr_sem) */
610 611 struct jffs2_xattr_ref *ref;
... ... @@ -616,7 +617,7 @@
616 617 ref->ic = ic;
617 618 ref->xd = xd;
618 619  
619   - ret = save_xattr_ref(c, ref, phys_ofs);
  620 + ret = save_xattr_ref(c, ref);
620 621 if (ret) {
621 622 jffs2_free_xattr_ref(ref);
622 623 return ERR_PTR(ret);
... ... @@ -1062,7 +1063,7 @@
1062 1063 struct jffs2_inode_cache *ic = f->inocache;
1063 1064 struct jffs2_xattr_datum *xd;
1064 1065 struct jffs2_xattr_ref *ref, *newref, **pref;
1065   - uint32_t phys_ofs, length, request;
  1066 + uint32_t length, request;
1066 1067 int rc;
1067 1068  
1068 1069 rc = check_xattr_ref_inode(c, ic);
... ... @@ -1070,7 +1071,7 @@
1070 1071 return rc;
1071 1072  
1072 1073 request = PAD(sizeof(struct jffs2_raw_xattr) + strlen(xname) + 1 + size);
1073   - rc = jffs2_reserve_space(c, request, &phys_ofs, &length,
  1074 + rc = jffs2_reserve_space(c, request, &length,
1074 1075 ALLOC_NORMAL, JFFS2_SUMMARY_XATTR_SIZE);
1075 1076 if (rc) {
1076 1077 JFFS2_WARNING("jffs2_reserve_space()=%d, request=%u\n", rc, request);
... ... @@ -1117,7 +1118,7 @@
1117 1118 goto out;
1118 1119 }
1119 1120 found:
1120   - xd = create_xattr_datum(c, xprefix, xname, buffer, size, phys_ofs);
  1121 + xd = create_xattr_datum(c, xprefix, xname, buffer, size);
1121 1122 if (IS_ERR(xd)) {
1122 1123 rc = PTR_ERR(xd);
1123 1124 goto out;
... ... @@ -1127,7 +1128,7 @@
1127 1128  
1128 1129 /* create xattr_ref */
1129 1130 request = PAD(sizeof(struct jffs2_raw_xref));
1130   - rc = jffs2_reserve_space(c, request, &phys_ofs, &length,
  1131 + rc = jffs2_reserve_space(c, request, &length,
1131 1132 ALLOC_NORMAL, JFFS2_SUMMARY_XREF_SIZE);
1132 1133 if (rc) {
1133 1134 JFFS2_WARNING("jffs2_reserve_space()=%d, request=%u\n", rc, request);
... ... @@ -1141,7 +1142,7 @@
1141 1142 down_write(&c->xattr_sem);
1142 1143 if (ref)
1143 1144 *pref = ref->next;
1144   - newref = create_xattr_ref(c, ic, xd, phys_ofs);
  1145 + newref = create_xattr_ref(c, ic, xd);
1145 1146 if (IS_ERR(newref)) {
1146 1147 if (ref) {
1147 1148 ref->next = ic->xref;
... ... @@ -1170,7 +1171,7 @@
1170 1171 * -------------------------------------------------- */
1171 1172 int jffs2_garbage_collect_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd)
1172 1173 {
1173   - uint32_t phys_ofs, totlen, length, old_ofs;
  1174 + uint32_t totlen, length, old_ofs;
1174 1175 int rc = -EINVAL;
1175 1176  
1176 1177 down_write(&c->xattr_sem);
1177 1178  
... ... @@ -1190,13 +1191,13 @@
1190 1191 } else if (unlikely(rc < 0))
1191 1192 goto out;
1192 1193 }
1193   - rc = jffs2_reserve_space_gc(c, totlen, &phys_ofs, &length, JFFS2_SUMMARY_XATTR_SIZE);
  1194 + rc = jffs2_reserve_space_gc(c, totlen, &length, JFFS2_SUMMARY_XATTR_SIZE);
1194 1195 if (rc || length < totlen) {
1195 1196 JFFS2_WARNING("jffs2_reserve_space()=%d, request=%u\n", rc, totlen);
1196 1197 rc = rc ? rc : -EBADFD;
1197 1198 goto out;
1198 1199 }
1199   - rc = save_xattr_datum(c, xd, phys_ofs);
  1200 + rc = save_xattr_datum(c, xd);
1200 1201 if (!rc)
1201 1202 dbg_xattr("xdatum (xid=%u, version=%u) GC'ed from %#08x to %08x\n",
1202 1203 xd->xid, xd->version, old_ofs, ref_offset(xd->node));
... ... @@ -1208,7 +1209,7 @@
1208 1209  
1209 1210 int jffs2_garbage_collect_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref)
1210 1211 {
1211   - uint32_t phys_ofs, totlen, length, old_ofs;
  1212 + uint32_t totlen, length, old_ofs;
1212 1213 int rc = -EINVAL;
1213 1214  
1214 1215 down_write(&c->xattr_sem);
1215 1216  
... ... @@ -1219,14 +1220,14 @@
1219 1220 if (totlen != sizeof(struct jffs2_raw_xref))
1220 1221 goto out;
1221 1222  
1222   - rc = jffs2_reserve_space_gc(c, totlen, &phys_ofs, &length, JFFS2_SUMMARY_XREF_SIZE);
  1223 + rc = jffs2_reserve_space_gc(c, totlen, &length, JFFS2_SUMMARY_XREF_SIZE);
1223 1224 if (rc || length < totlen) {
1224 1225 JFFS2_WARNING("%s: jffs2_reserve_space() = %d, request = %u\n",
1225 1226 __FUNCTION__, rc, totlen);
1226 1227 rc = rc ? rc : -EBADFD;
1227 1228 goto out;
1228 1229 }
1229   - rc = save_xattr_ref(c, ref, phys_ofs);
  1230 + rc = save_xattr_ref(c, ref);
1230 1231 if (!rc)
1231 1232 dbg_xattr("xref (ino=%u, xid=%u) GC'ed from %#08x to %08x\n",
1232 1233 ref->ic->ino, ref->xd->xid, old_ofs, ref_offset(ref->node));