[JFFS2][XATTR] using 'delete marker' for xdatum/xref deletion
- When xdatum is removed, a new xdatum with 'delete marker' is written. (version==0xffffffff means 'delete marker') - When xref is removed, a new xref with 'delete marker' is written. (odd-numbered xseqno means 'delete marker') - delete_xattr_(datum/xref)_delay() are new deletion functions are added. We can only use them if we can detect the target obsolete xdatum/xref as a orphan or errir one. (e.g when inode deletion, or detecting crc error) [1/3] jffs2-xattr-v6-01-delete_marker.patch Signed-off-by: KaiGai Kohei <kaigai@ak.jp.nec.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This commit is contained in:
committed by
David Woodhouse
parent
6d4f8224d4
commit
c9f700f840
@@ -310,8 +310,6 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs,
|
||||
#ifdef CONFIG_JFFS2_FS_XATTR
|
||||
case JFFS2_NODETYPE_XATTR: {
|
||||
struct jffs2_sum_xattr_mem *temp;
|
||||
if (je32_to_cpu(node->x.version) == 0xffffffff)
|
||||
return 0;
|
||||
temp = kmalloc(sizeof(struct jffs2_sum_xattr_mem), GFP_KERNEL);
|
||||
if (!temp)
|
||||
goto no_mem;
|
||||
@@ -327,10 +325,6 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs,
|
||||
}
|
||||
case JFFS2_NODETYPE_XREF: {
|
||||
struct jffs2_sum_xref_mem *temp;
|
||||
|
||||
if (je32_to_cpu(node->r.ino) == 0xffffffff
|
||||
&& je32_to_cpu(node->r.xid) == 0xffffffff)
|
||||
return 0;
|
||||
temp = kmalloc(sizeof(struct jffs2_sum_xref_mem), GFP_KERNEL);
|
||||
if (!temp)
|
||||
goto no_mem;
|
||||
@@ -483,22 +477,20 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
|
||||
|
||||
xd = jffs2_setup_xattr_datum(c, je32_to_cpu(spx->xid),
|
||||
je32_to_cpu(spx->version));
|
||||
if (IS_ERR(xd)) {
|
||||
if (PTR_ERR(xd) == -EEXIST) {
|
||||
/* a newer version of xd exists */
|
||||
if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(spx->totlen))))
|
||||
return err;
|
||||
sp += JFFS2_SUMMARY_XATTR_SIZE;
|
||||
break;
|
||||
}
|
||||
JFFS2_NOTICE("allocation of xattr_datum failed\n");
|
||||
if (IS_ERR(xd))
|
||||
return PTR_ERR(xd);
|
||||
if (xd->version > je32_to_cpu(spx->version)) {
|
||||
/* node is not the newest one */
|
||||
struct jffs2_raw_node_ref *raw
|
||||
= sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED,
|
||||
PAD(je32_to_cpu(spx->totlen)), NULL);
|
||||
raw->next_in_ino = xd->node->next_in_ino;
|
||||
xd->node->next_in_ino = raw;
|
||||
} else {
|
||||
xd->version = je32_to_cpu(spx->version);
|
||||
sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED,
|
||||
PAD(je32_to_cpu(spx->totlen)), (void *)xd);
|
||||
}
|
||||
|
||||
xd->node = sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED,
|
||||
PAD(je32_to_cpu(spx->totlen)), NULL);
|
||||
/* FIXME */ xd->node->next_in_ino = (void *)xd;
|
||||
|
||||
*pseudo_random += je32_to_cpu(spx->xid);
|
||||
sp += JFFS2_SUMMARY_XATTR_SIZE;
|
||||
|
||||
@@ -519,14 +511,11 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
|
||||
JFFS2_NOTICE("allocation of xattr_datum failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
ref->ino = 0xfffffffe;
|
||||
ref->xid = 0xfffffffd;
|
||||
ref->next = c->xref_temp;
|
||||
c->xref_temp = ref;
|
||||
|
||||
ref->node = sum_link_node_ref(c, jeb, je32_to_cpu(spr->offset) | REF_UNCHECKED,
|
||||
PAD(sizeof(struct jffs2_raw_xref)), NULL);
|
||||
/* FIXME */ ref->node->next_in_ino = (void *)ref;
|
||||
sum_link_node_ref(c, jeb, je32_to_cpu(spr->offset) | REF_UNCHECKED,
|
||||
PAD(sizeof(struct jffs2_raw_xref)), (void *)ref);
|
||||
|
||||
*pseudo_random += ref->node->flash_offset;
|
||||
sp += JFFS2_SUMMARY_XREF_SIZE;
|
||||
|
Reference in New Issue
Block a user