diff options
author | KaiGai Kohei <kaigai@ak.jp.nec.com> | 2006-06-10 21:35:15 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-06-27 11:16:26 -0400 |
commit | c9f700f840bd481b3e01fcad1ba8da01794a6726 (patch) | |
tree | 786f4a6a3f3a2d619ae4230a62f95361fcd3245a /fs/jffs2/xattr.h | |
parent | 6d4f8224d4ee065e0e3186cc554468d735e6015d (diff) |
[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>
Diffstat (limited to 'fs/jffs2/xattr.h')
-rw-r--r-- | fs/jffs2/xattr.h | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h index 2c199856c582..06ab7b880212 100644 --- a/fs/jffs2/xattr.h +++ b/fs/jffs2/xattr.h | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #define JFFS2_XFLAGS_HOT (0x01) /* This datum is HOT */ | 17 | #define JFFS2_XFLAGS_HOT (0x01) /* This datum is HOT */ |
18 | #define JFFS2_XFLAGS_BIND (0x02) /* This datum is not reclaimed */ | 18 | #define JFFS2_XFLAGS_BIND (0x02) /* This datum is not reclaimed */ |
19 | #define JFFS2_XFLAGS_INVALID (0x80) /* This datum contains crc error */ | ||
19 | 20 | ||
20 | struct jffs2_xattr_datum | 21 | struct jffs2_xattr_datum |
21 | { | 22 | { |
@@ -23,7 +24,7 @@ struct jffs2_xattr_datum | |||
23 | struct jffs2_raw_node_ref *node; | 24 | struct jffs2_raw_node_ref *node; |
24 | uint8_t class; | 25 | uint8_t class; |
25 | uint8_t flags; | 26 | uint8_t flags; |
26 | uint16_t xprefix; /* see JFFS2_XATTR_PREFIX_* */ | 27 | uint16_t xprefix; /* see JFFS2_XATTR_PREFIX_* */ |
27 | 28 | ||
28 | struct list_head xindex; /* chained from c->xattrindex[n] */ | 29 | struct list_head xindex; /* chained from c->xattrindex[n] */ |
29 | uint32_t refcnt; /* # of xattr_ref refers this */ | 30 | uint32_t refcnt; /* # of xattr_ref refers this */ |
@@ -47,6 +48,7 @@ struct jffs2_xattr_ref | |||
47 | uint8_t flags; /* Currently unused */ | 48 | uint8_t flags; /* Currently unused */ |
48 | u16 unused; | 49 | u16 unused; |
49 | 50 | ||
51 | uint32_t xseqno; | ||
50 | union { | 52 | union { |
51 | struct jffs2_inode_cache *ic; /* reference to jffs2_inode_cache */ | 53 | struct jffs2_inode_cache *ic; /* reference to jffs2_inode_cache */ |
52 | uint32_t ino; /* only used in scanning/building */ | 54 | uint32_t ino; /* only used in scanning/building */ |
@@ -58,6 +60,34 @@ struct jffs2_xattr_ref | |||
58 | struct jffs2_xattr_ref *next; /* chained from ic->xref_list */ | 60 | struct jffs2_xattr_ref *next; /* chained from ic->xref_list */ |
59 | }; | 61 | }; |
60 | 62 | ||
63 | #define XDATUM_DELETE_MARKER (0xffffffff) | ||
64 | #define XREF_DELETE_MARKER (0x00000001) | ||
65 | static inline int is_xattr_datum_dead(struct jffs2_xattr_datum *xd) | ||
66 | { | ||
67 | return (xd->version == XDATUM_DELETE_MARKER); | ||
68 | } | ||
69 | |||
70 | static inline void set_xattr_datum_dead(struct jffs2_xattr_datum *xd) | ||
71 | { | ||
72 | xd->version = XDATUM_DELETE_MARKER; | ||
73 | } | ||
74 | |||
75 | static inline int is_xattr_ref_dead(struct jffs2_xattr_ref *ref) | ||
76 | { | ||
77 | return ((ref->xseqno & XREF_DELETE_MARKER) != 0); | ||
78 | } | ||
79 | |||
80 | static inline void set_xattr_ref_dead(struct jffs2_xattr_ref *ref) | ||
81 | { | ||
82 | ref->xseqno |= XREF_DELETE_MARKER; | ||
83 | } | ||
84 | |||
85 | static inline void clr_xattr_ref_dead(struct jffs2_xattr_ref *ref) | ||
86 | { | ||
87 | ref->xseqno &= ~XREF_DELETE_MARKER; | ||
88 | } | ||
89 | |||
90 | |||
61 | #ifdef CONFIG_JFFS2_FS_XATTR | 91 | #ifdef CONFIG_JFFS2_FS_XATTR |
62 | 92 | ||
63 | extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c); | 93 | extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c); |
@@ -70,9 +100,13 @@ extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c | |||
70 | extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); | 100 | extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); |
71 | extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); | 101 | extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); |
72 | 102 | ||
73 | extern int jffs2_garbage_collect_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd); | 103 | extern int jffs2_garbage_collect_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd, |
74 | extern int jffs2_garbage_collect_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref); | 104 | struct jffs2_raw_node_ref *raw); |
105 | extern int jffs2_garbage_collect_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref, | ||
106 | struct jffs2_raw_node_ref *raw); | ||
75 | extern int jffs2_verify_xattr(struct jffs2_sb_info *c); | 107 | extern int jffs2_verify_xattr(struct jffs2_sb_info *c); |
108 | extern void jffs2_release_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd); | ||
109 | extern void jffs2_release_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref); | ||
76 | 110 | ||
77 | extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname, | 111 | extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname, |
78 | char *buffer, size_t size); | 112 | char *buffer, size_t size); |