Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4464
b: refs/heads/master
c: e4803c3
h: refs/heads/master
v: v3
  • Loading branch information
Estelle Hammache authored and Thomas Gleixner committed May 23, 2005
1 parent 8e8517d commit 387e852
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ed3786a599f5639c99dfcceaef1b064ab5e2e9f9
refs/heads/master: e4803c30d64391d84635061eaebfc7d66de9d6ab
33 changes: 32 additions & 1 deletion trunk/fs/jffs2/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: write.c,v 1.87 2004/11/16 20:36:12 dwmw2 Exp $
* $Id: write.c,v 1.88 2005/01/24 21:13:39 hammache Exp $
*
*/

Expand Down Expand Up @@ -136,6 +136,21 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
raw->__totlen = PAD(sizeof(*ri)+datalen);
raw->next_phys = NULL;

if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(ri->version) < f->highest_version))
{
if (! retried)
{
BUG();
}
else
{
D1(printk(KERN_DEBUG "jffs2_write_dnode : dnode_version %d, highest version %d -> updating dnode\n",
je32_to_cpu(ri->version), f->highest_version));
ri->version = cpu_to_je32(++f->highest_version);
ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
}
}

ret = jffs2_flash_writev(c, vecs, cnt, flash_ofs, &retlen,
(alloc_mode==ALLOC_GC)?0:f->inocache->ino);

Expand Down Expand Up @@ -280,6 +295,22 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
raw->__totlen = PAD(sizeof(*rd)+namelen);
raw->next_phys = NULL;

if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(rd->version) < f->highest_version))
{
if (! retried)
{
BUG();
}
else
{
D1(printk(KERN_DEBUG "jffs2_write_dirent : dirent_version %d, highest version %d -> updating dirent\n",
je32_to_cpu(rd->version), f->highest_version));
rd->version = cpu_to_je32(++f->highest_version);
fd->version = je32_to_cpu(rd->version);
rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
}
}

ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen,
(alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino));
if (ret || (retlen != sizeof(*rd) + namelen)) {
Expand Down

0 comments on commit 387e852

Please sign in to comment.