Commit 8a13695c authored by KaiGai Kohei's avatar KaiGai Kohei Committed by David Woodhouse

[JFFS2][XATTR] rid unnecessary writing of delete marker.

In the followinf situation, an explicit delete marker is not
necessary, because we can certainlly detect those obsolete
xattr_datum or xattr_ref on next mounting.

- When to delete xattr_datum node.
- When to delete xattr_ref node on removing inode.
- When to delete xattr_ref node on updating xattr.

This patch rids writing delete marker in those situations.
Signed-off-by: default avatarKaiGai Kohei <kaigai@ak.jp.nec.com>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent a1ae76e9
......@@ -332,10 +332,8 @@ static int jffs2_scan_xattr_node(struct jffs2_sb_info *c, struct jffs2_erasebloc
xid = je32_to_cpu(rx->xid);
version = je32_to_cpu(rx->version);
totlen = sizeof(struct jffs2_raw_xattr);
if (version != XDATUM_DELETE_MARKER)
totlen += rx->name_len + 1 + je16_to_cpu(rx->value_len);
totlen = PAD(totlen);
totlen = PAD(sizeof(struct jffs2_raw_xattr)
+ rx->name_len + 1 + je16_to_cpu(rx->value_len));
if (totlen != je32_to_cpu(rx->totlen)) {
JFFS2_WARNING("node length mismatch at %#08x, read=%u, calc=%u\n",
ofs, je32_to_cpu(rx->totlen), totlen);
......
This diff is collapsed.
......@@ -16,6 +16,7 @@
#define JFFS2_XFLAGS_HOT (0x01) /* This datum is HOT */
#define JFFS2_XFLAGS_BIND (0x02) /* This datum is not reclaimed */
#define JFFS2_XFLAGS_DEAD (0x40) /* This datum is already dead */
#define JFFS2_XFLAGS_INVALID (0x80) /* This datum contains crc error */
struct jffs2_xattr_datum
......@@ -60,34 +61,12 @@ struct jffs2_xattr_ref
struct jffs2_xattr_ref *next; /* chained from ic->xref_list */
};
#define XDATUM_DELETE_MARKER (0xffffffff)
#define XREF_DELETE_MARKER (0x00000001)
static inline int is_xattr_datum_dead(struct jffs2_xattr_datum *xd)
{
return (xd->version == XDATUM_DELETE_MARKER);
}
static inline void set_xattr_datum_dead(struct jffs2_xattr_datum *xd)
{
xd->version = XDATUM_DELETE_MARKER;
}
static inline int is_xattr_ref_dead(struct jffs2_xattr_ref *ref)
{
return ((ref->xseqno & XREF_DELETE_MARKER) != 0);
}
static inline void set_xattr_ref_dead(struct jffs2_xattr_ref *ref)
{
ref->xseqno |= XREF_DELETE_MARKER;
}
static inline void clr_xattr_ref_dead(struct jffs2_xattr_ref *ref)
{
ref->xseqno &= ~XREF_DELETE_MARKER;
}
#ifdef CONFIG_JFFS2_FS_XATTR
extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment